OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
remove journal aggregate event
ulfertsa7febaf6a0e7
diff --git a/app/services/journals/create_service.rb b/app/services/journals/create_service.rbindex e5138b03a49..4a050e6458d 100644--- a/app/services/journals/create_service.rb+++ b/app/services/journals/create_service.rb@@ -614,23 +614,6 @@ module Journalspredecessor.user_id == user.idend- # TODO: check if this can be removed- # also check for the event and what it effects- def notify_aggregation_destruction(predecessor, journal)- OpenProject::Notifications.send(OpenProject::Events::JOURNAL_AGGREGATE_BEFORE_DESTROY,- journal:,- predecessor:)- end-- # TODO: check if this can be removed- def take_over_journal_details(predecessor, journal)- if predecessor.notes.present?- journal.update_columns(notes: predecessor.notes, version: predecessor.version)- else- journal.update_columns(version: predecessor.version)- end- end-def log_journal_creation(predecessor)if predecessorRails.logger.debug { "Aggregating journal #{predecessor.id} for #{journable_type} ##{journable.id}" }diff --git a/app/services/notifications/aggregated_journal_service.rb b/app/services/notifications/aggregated_journal_service.rbdeleted file mode 100644index c22c2dd798c..00000000000--- a/app/services/notifications/aggregated_journal_service.rb+++ /dev/null@@ -1,39 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2022 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2013 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See COPYRIGHT and LICENSE files for more details.-#++--class Notifications::AggregatedJournalService- ##- # Move existing notifications for aggregated events over- # if they have an immediate response associated- def self.relocate_immediate(journal:, predecessor:)- Notification- .where(journal_id: predecessor.id)- .where(reason: :mentioned)- .update_all(journal_id: journal.id, read_ian: false)- end-enddiff --git a/config/initializers/subscribe_listeners.rb b/config/initializers/subscribe_listeners.rbindex 8b6f39138f6..c37f7c70820 100644--- a/config/initializers/subscribe_listeners.rb+++ b/config/initializers/subscribe_listeners.rb@@ -41,10 +41,6 @@ Rails.application.config.after_initialize doJournals::CompletedJob.schedule(payload[:journal], payload[:send_notification])end- OpenProject::Notifications.subscribe(OpenProject::Events::JOURNAL_AGGREGATE_BEFORE_DESTROY) do |payload|- Notifications::AggregatedJournalService.relocate_immediate(**payload.slice(:journal, :predecessor))- end-OpenProject::Notifications.subscribe(OpenProject::Events::WATCHER_ADDED) do |payload|next unless payload[:send_notifications]diff --git a/lib/open_project/events.rb b/lib/open_project/events.rbindex de74e1611ff..b4f842238c1 100644--- a/lib/open_project/events.rb+++ b/lib/open_project/events.rb@@ -45,7 +45,6 @@ module OpenProjectATTACHMENT_CREATED = 'attachment_created'.freezeJOURNAL_CREATED = 'journal_created'.freeze- JOURNAL_AGGREGATE_BEFORE_DESTROY = 'journal_aggregate_before_destroy'.freezeMEMBER_CREATED = 'member_created'.freezeMEMBER_UPDATED = 'member_updated'.freezediff --git a/spec/services/notifications/aggregated_journal_service_integration_spec.rb b/spec/services/notifications/aggregated_journal_service_integration_spec.rbdeleted file mode 100644index 8366e0ff907..00000000000--- a/spec/services/notifications/aggregated_journal_service_integration_spec.rb+++ /dev/null@@ -1,51 +0,0 @@-#-- copyright-# OpenProject is an open source project management software.-# Copyright (C) 2012-2022 the OpenProject GmbH-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License version 3.-#-# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-# Copyright (C) 2006-2013 Jean-Philippe Lang-# Copyright (C) 2010-2013 the ChiliProject Team-#-# This program is free software; you can redistribute it and/or-# modify it under the terms of the GNU General Public License-# as published by the Free Software Foundation; either version 2-# of the License, or (at your option) any later version.-#-# This program is distributed in the hope that it will be useful,-# but WITHOUT ANY WARRANTY; without even the implied warranty of-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-# GNU General Public License for more details.-#-# You should have received a copy of the GNU General Public License-# along with this program; if not, write to the Free Software-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-#-# See COPYRIGHT and LICENSE files for more details.-#++--require 'spec_helper'-require_relative './mentioned_journals_shared'--describe Notifications::AggregatedJournalService, 'integration', type: :model do- include_context 'with a mentioned work package being updated again'-- it 'will relocate the notification to the newer journal' do- trigger_comment!-- expect(mentioned_notification).to be_present- journal = mentioned_notification.journal-- update_assignee!-- expect(mentioned_notification.reload).to be_present- expect(mentioned_notification.journal).to eq journal- expect(mentioned_notification.journal.updated_at).not_to eq journal.updated_at-- # Expect only one notification to be present- expect(Notification.where(recipient:, reason: :mentioned).count)- .to eq 1- end-end