FIX: Staged users should not be mentionable.

This commit is contained in:
Guo Xiang Tan 2018-11-22 15:00:46 +08:00
parent 6111b285d9
commit 672e95bcb4
2 changed files with 9 additions and 1 deletions

View File

@ -460,7 +460,7 @@ module PrettyText
:user_type AS type,
username_lower AS name
FROM users
WHERE username_lower IN (:names)
WHERE username_lower IN (:names) AND staged = false
)
UNION
(

View File

@ -241,6 +241,14 @@ describe PrettyText do
end
end
it 'does not mention staged users' do
user = Fabricate(:user, staged: true)
expect(PrettyText.cook("something @#{user.username} something")).to eq(
%Q|<p>something <span class="mention">@#{user.username}</span> something</p>|
)
end
describe 'when mentions are disabled' do
before do
SiteSetting.enable_mentions = false