mirror of
https://github.com/discourse/discourse.git
synced 2025-06-10 17:43:41 +08:00
DEV: group mentions related specs into context (#21434)
This commit is contained in:

committed by
GitHub

parent
22521d3428
commit
c45fff9405
@ -136,6 +136,7 @@ describe Chat::MessageCreator do
|
|||||||
expect(events.map { _1[:event_name] }).to include(:chat_message_created)
|
expect(events.map { _1[:event_name] }).to include(:chat_message_created)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "with mentions" do
|
||||||
it "creates mentions and mention notifications for public chat" do
|
it "creates mentions and mention notifications for public chat" do
|
||||||
message =
|
message =
|
||||||
described_class.create(
|
described_class.create(
|
||||||
@ -293,7 +294,9 @@ describe Chat::MessageCreator do
|
|||||||
user: user1,
|
user: user1,
|
||||||
content: "hello there @#{user_group.name}",
|
content: "hello there @#{user_group.name}",
|
||||||
)
|
)
|
||||||
}.to change { user2.chat_mentions.count }.by(1).and change { user3.chat_mentions.count }.by(1)
|
}.to change { user2.chat_mentions.count }.by(1).and change { user3.chat_mentions.count }.by(
|
||||||
|
1,
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "creates a mention notifications only for group users that are participating in private chat" do
|
it "creates a mention notifications only for group users that are participating in private chat" do
|
||||||
@ -366,6 +369,7 @@ describe Chat::MessageCreator do
|
|||||||
mention = user2.chat_mentions.where(chat_message: message).first
|
mention = user2.chat_mentions.where(chat_message: message).first
|
||||||
expect(mention.notification).to be_nil
|
expect(mention.notification).to be_nil
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context "when ignore_channel_wide_mention is enabled" do
|
context "when ignore_channel_wide_mention is enabled" do
|
||||||
before { user2.user_option.update(ignore_channel_wide_mention: true) }
|
before { user2.user_option.update(ignore_channel_wide_mention: true) }
|
||||||
|
Reference in New Issue
Block a user