mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 08:57:10 -06:00
FIX: mixed case group mentions were not getting highligted in composer
This commit is contained in:
parent
8f8ad3fe4a
commit
f387dfe226
@ -211,7 +211,6 @@ class UsersController < ApplicationController
|
||||
def is_local_username
|
||||
usernames = params[:usernames]
|
||||
usernames = [params[:username]] if usernames.blank?
|
||||
usernames.each(&:downcase!)
|
||||
|
||||
groups = Group.where(name: usernames).pluck(:name)
|
||||
mentionable_groups =
|
||||
@ -223,6 +222,7 @@ class UsersController < ApplicationController
|
||||
end
|
||||
|
||||
usernames -= groups
|
||||
usernames.each(&:downcase!)
|
||||
|
||||
result = User.where(staged: false)
|
||||
.where(username_lower: usernames)
|
||||
|
@ -1516,6 +1516,7 @@ describe UsersController do
|
||||
describe ".is_local_username" do
|
||||
|
||||
let(:user) { Fabricate(:user) }
|
||||
let(:group) { Fabricate(:group, name: "Discourse") }
|
||||
|
||||
it "finds the user" do
|
||||
xhr :get, :is_local_username, username: user.username
|
||||
@ -1524,6 +1525,13 @@ describe UsersController do
|
||||
expect(json["valid"][0]).to eq(user.username)
|
||||
end
|
||||
|
||||
it "finds the group" do
|
||||
xhr :get, :is_local_username, username: group.name
|
||||
expect(response).to be_success
|
||||
json = JSON.parse(response.body)
|
||||
expect(json["valid_groups"][0]).to eq(group.name)
|
||||
end
|
||||
|
||||
it "supports multiples usernames" do
|
||||
xhr :get, :is_local_username, usernames: [user.username, "system"]
|
||||
expect(response).to be_success
|
||||
|
Loading…
Reference in New Issue
Block a user