From 568a13101ef9de7b6ee50ef2b554be93097add1a Mon Sep 17 00:00:00 2001 From: Rafael dos Santos Silva Date: Wed, 16 Mar 2022 16:23:14 -0300 Subject: [PATCH] DEV: Use reserved assigned notification type (#302) --- jobs/regular/assign_notification.rb | 4 ++-- jobs/regular/unassign_notification.rb | 2 +- spec/jobs/regular/assign_notification_spec.rb | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/jobs/regular/assign_notification.rb b/jobs/regular/assign_notification.rb index 33c1102..9da8882 100644 --- a/jobs/regular/assign_notification.rb +++ b/jobs/regular/assign_notification.rb @@ -27,7 +27,7 @@ module Jobs user: user, post: post, username: assigned_by.username, - notification_type: Notification.types[:custom], + notification_type: Notification.types[:assigned] || Notification.types[:custom], excerpt: I18n.t( (assigned_to_user ? "discourse_assign.topic_assigned_excerpt" : "discourse_assign.topic_group_assigned_excerpt"), @@ -39,7 +39,7 @@ module Jobs next if args[:silent] Notification.create!( - notification_type: Notification.types[:custom], + notification_type: Notification.types[:assigned] || Notification.types[:custom], user_id: user.id, topic_id: topic.id, post_number: post.post_number, diff --git a/jobs/regular/unassign_notification.rb b/jobs/regular/unassign_notification.rb index bae8936..f33dc56 100644 --- a/jobs/regular/unassign_notification.rb +++ b/jobs/regular/unassign_notification.rb @@ -14,7 +14,7 @@ module Jobs Assigner.publish_topic_tracking_state(topic, user.id) Notification.where( - notification_type: Notification.types[:custom], + notification_type: Notification.types[:assigned] || Notification.types[:custom], user_id: user.id, topic_id: topic.id, ).where("data like '%discourse_assign.assign_notification%' OR data like '%discourse_assign.assign_group_notification%'").destroy_all diff --git a/spec/jobs/regular/assign_notification_spec.rb b/spec/jobs/regular/assign_notification_spec.rb index 1809a7e..0aa4eb2 100644 --- a/spec/jobs/regular/assign_notification_spec.rb +++ b/spec/jobs/regular/assign_notification_spec.rb @@ -47,7 +47,7 @@ RSpec.describe Jobs::AssignNotification do it 'sends a high priority notification to the assignee' do Notification.expects(:create!).with( - notification_type: Notification.types[:custom], + notification_type: Notification.types[:assigned] || Notification.types[:custom], user_id: user2.id, topic_id: topic.id, post_number: 1, @@ -96,7 +96,7 @@ RSpec.describe Jobs::AssignNotification do it 'sends a high priority notification to all group members' do [user2, user3, user4].each do |user| Notification.expects(:create!).with( - notification_type: Notification.types[:custom], + notification_type: Notification.types[:assigned] || Notification.types[:custom], user_id: user.id, topic_id: topic.id, post_number: 1,