mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: first class group mentions built in
If you allow a group to be mentioned it can be mentioned with the @ symbol. Keep in mind as a safety mechanism max_users_notified_per_group_mention is set to 100
This commit is contained in:
@@ -12,7 +12,7 @@ describe PostAlerter do
|
||||
context "unread" do
|
||||
it "does not return whispers as unread posts" do
|
||||
op = Fabricate(:post)
|
||||
whisper = Fabricate(:post, raw: 'this is a whisper post',
|
||||
_whisper = Fabricate(:post, raw: 'this is a whisper post',
|
||||
user: Fabricate(:admin),
|
||||
topic: op.topic,
|
||||
reply_to_post_number: op.post_number,
|
||||
@@ -92,6 +92,26 @@ describe PostAlerter do
|
||||
end
|
||||
end
|
||||
|
||||
context '@group mentions' do
|
||||
|
||||
it 'notifies users correctly' do
|
||||
|
||||
group = Fabricate(:group, name: 'group', alias_level: Group::ALIAS_LEVELS[:everyone])
|
||||
group.add(evil_trout)
|
||||
|
||||
expect {
|
||||
create_post_with_alerts(raw: "Hello @group how are you?")
|
||||
}.to change(evil_trout.notifications, :count).by(1)
|
||||
|
||||
|
||||
group.update_columns(alias_level: Group::ALIAS_LEVELS[:members_mods_and_admins])
|
||||
|
||||
expect {
|
||||
create_post_with_alerts(raw: "Hello @group you are not mentionable")
|
||||
}.to change(evil_trout.notifications, :count).by(0)
|
||||
end
|
||||
end
|
||||
|
||||
context '@mentions' do
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
|
||||
Reference in New Issue
Block a user