FIX: don't ever fetch staged accounts in unseen mentions

This commit is contained in:
Régis Hanol
2015-11-27 18:16:50 +01:00
parent 5e93140f85
commit 76692235ae
2 changed files with 36 additions and 5 deletions

View File

@ -1539,4 +1539,32 @@ describe UsersController do
end
describe ".is_local_username" do
let(:user) { Fabricate(:user) }
it "finds the user" do
xhr :get, :is_local_username, username: user.username
expect(response).to be_success
json = JSON.parse(response.body)
expect(json["valid"][0]).to eq(user.username)
end
it "supports multiples usernames" do
xhr :get, :is_local_username, usernames: [user.username, "system"]
expect(response).to be_success
json = JSON.parse(response.body)
expect(json["valid"].size).to eq(2)
end
it "never includes staged accounts" do
staged = Fabricate(:user, staged: true)
xhr :get, :is_local_username, usernames: [staged.username]
expect(response).to be_success
json = JSON.parse(response.body)
expect(json["valid"].size).to eq(0)
end
end
end