From b7acd1224459c615c49dfd880668ac0ec23c48d0 Mon Sep 17 00:00:00 2001 From: Martin Brennan Date: Mon, 11 May 2020 14:06:31 +1000 Subject: [PATCH] FEATURE: Mark assign notifications as high priority (#67) --- lib/topic_assigner.rb | 1 + spec/lib/topic_assigner_spec.rb | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/lib/topic_assigner.rb b/lib/topic_assigner.rb index 59d97a5..fad8d2c 100644 --- a/lib/topic_assigner.rb +++ b/lib/topic_assigner.rb @@ -223,6 +223,7 @@ class ::TopicAssigner user_id: assign_to.id, topic_id: @topic.id, post_number: 1, + high_priority: true, data: { message: 'discourse_assign.assign_notification', display_username: @assigned_by.username, diff --git a/spec/lib/topic_assigner_spec.rb b/spec/lib/topic_assigner_spec.rb index 4d9d2e9..c492abb 100644 --- a/spec/lib/topic_assigner_spec.rb +++ b/spec/lib/topic_assigner_spec.rb @@ -88,6 +88,22 @@ RSpec.describe TopicAssigner do .to eq(TopicUser.notification_levels[:muted]) end + it "sends a high priority notification to the assignee" do + Notification.expects(:create!).with( + notification_type: Notification.types[:custom], + user_id: moderator.id, + topic_id: topic.id, + post_number: 1, + high_priority: true, + data: { + message: 'discourse_assign.assign_notification', + display_username: moderator2.username, + topic_title: topic.title + }.to_json + ) + assigner.assign(moderator) + end + context "when assigns_by_staff_mention is set to true" do let(:system_user) { Discourse.system_user } let(:moderator) { Fabricate(:admin, username: "modi", groups: [assign_allowed_group]) }