FIX: Check whether group is mentionable by user when cooking post.

This commit is contained in:
Guo Xiang Tan
2018-11-22 16:01:03 +08:00
parent 0739c3b1d1
commit 3f636b2d19
4 changed files with 70 additions and 14 deletions

View File

@@ -225,7 +225,9 @@ describe PrettyText do
Fabricate(:user, username: username)
end
group = Fabricate(:group)
group = Fabricate(:group,
mentionable_level: Group::ALIAS_LEVELS[:everyone]
)
[
[
@@ -241,6 +243,14 @@ describe PrettyText do
end
end
it "does not create mention for a non mentionable group" do
group = Fabricate(:group, mentionable_level: Group::ALIAS_LEVELS[:nobody])
expect(PrettyText.cook("test @#{group.name} test")).to eq(
%Q|<p>test <span class="mention">@#{group.name}</span> test</p>|
)
end
it 'does not mention staged users' do
user = Fabricate(:user, staged: true)