Skip to content

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

Fix reason and journal init after merging from dev

Oliver Güntherfe3839d8cc15
diff --git a/spec/factories/notification_factory.rb b/spec/factories/notification_factory.rb
index 32fada51a40..c7ec7f97b1c 100644
--- a/spec/factories/notification_factory.rb
+++ b/spec/factories/notification_factory.rb
@@ -8,12 +8,15 @@ FactoryBot.define do
recipient factory: :user
project { association :project }
resource { association :work_package, project: project }
- actor { journal.try(:user) }
+ actor { nil }
- transient { journal }
+ transient do
+ journal { nil }
+ end
callback(:after_create) do |notification, evaluator|
- notification.journal = evaluator.journal || notification.work_package.journals.last
+ notification.journal = evaluator.journal || notification.resource.journals.last
+ notification.actor ||= notification.journal.try(:user)
notification.save!
end
end
diff --git a/spec/features/notifications/notification_center/notification_center_sidemenu_spec.rb b/spec/features/notifications/notification_center/notification_center_sidemenu_spec.rb
index da4d96df7ea..f607e385a49 100644
--- a/spec/features/notifications/notification_center/notification_center_sidemenu_spec.rb
+++ b/spec/features/notifications/notification_center/notification_center_sidemenu_spec.rb
@@ -22,7 +22,7 @@ describe "Notification center sidemenu", type: :feature, js: true do
recipient: recipient,
project: project,
resource: work_package,
- reason_ian: :watched
+ reason: :watched
end
let!(:notification2) do
@@ -30,7 +30,7 @@ describe "Notification center sidemenu", type: :feature, js: true do
recipient: recipient,
project: project2,
resource: work_package2,
- reason_ian: :assigned
+ reason: :assigned
end
let!(:notification3) do
@@ -38,7 +38,7 @@ describe "Notification center sidemenu", type: :feature, js: true do
recipient: recipient,
project: project3,
resource: work_package3,
- reason_ian: :responsible
+ reason: :responsible
end
let!(:notification4) do
@@ -46,7 +46,7 @@ describe "Notification center sidemenu", type: :feature, js: true do
recipient: recipient,
project: project3,
resource: work_package4,
- reason_ian: :mentioned
+ reason: :mentioned
end
let(:center) { ::Components::Notifications::Center.new }