mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 03:10:46 -06:00
FIX: no notification was being sent when a post is hidden by community flags
This commit is contained in:
parent
9b3b39d8a2
commit
6831efe2e9
@ -13,7 +13,7 @@ module Jobs
|
|||||||
return if user.blank?
|
return if user.blank?
|
||||||
|
|
||||||
system_message = SystemMessage.new(user)
|
system_message = SystemMessage.new(user)
|
||||||
system_message.create(args[:message_type])
|
system_message.create(args[:message_type], args[:message_options]&.symbolize_keys || {})
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -572,7 +572,8 @@ SQL
|
|||||||
edit_delay: SiteSetting.cooldown_minutes_after_hiding_posts,
|
edit_delay: SiteSetting.cooldown_minutes_after_hiding_posts,
|
||||||
flag_reason: I18n.t("flag_reasons.#{post_action_type}"),
|
flag_reason: I18n.t("flag_reasons.#{post_action_type}"),
|
||||||
}
|
}
|
||||||
SystemMessage.create(post.user, :post_hidden, options)
|
|
||||||
|
Jobs.enqueue_in(5.seconds, :send_system_message, user_id: post.user.id, message_type: :post_hidden, message_options: options)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -16,10 +16,16 @@ describe Jobs::SendSystemMessage do
|
|||||||
let(:user) { Fabricate(:user) }
|
let(:user) { Fabricate(:user) }
|
||||||
|
|
||||||
it "should call SystemMessage.create" do
|
it "should call SystemMessage.create" do
|
||||||
SystemMessage.any_instance.expects(:create).with('welcome_invite')
|
SystemMessage.any_instance.expects(:create).with('welcome_invite', {})
|
||||||
Jobs::SendSystemMessage.new.execute(user_id: user.id, message_type: 'welcome_invite')
|
Jobs::SendSystemMessage.new.execute(user_id: user.id, message_type: 'welcome_invite')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "can send message parameters" do
|
||||||
|
options = { url: "/t/no-spammers-please/123", edit_delay: 5, flag_reason: "Flagged by community" }
|
||||||
|
SystemMessage.any_instance.expects(:create).with('post_hidden', options)
|
||||||
|
Jobs::SendSystemMessage.new.execute(user_id: user.id, message_type: 'post_hidden', message_options: options)
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user