mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 03:51:07 +08:00
FIX: lowercase username for add/rem group members
This fix searches for users based on the downcased username so that if you pass in usernames to add/remove from a group and you don't have the casing just right it will still find the correct users. I updated the tests to add a username that has a mix of upper and lowercase letters to verify this functionality.
This commit is contained in:
@ -484,7 +484,7 @@ class GroupsController < ApplicationController
|
||||
|
||||
def users_from_params
|
||||
if params[:usernames].present?
|
||||
users = User.where(username: params[:usernames].split(","))
|
||||
users = User.where(username_lower: params[:usernames].split(",").map(&:downcase))
|
||||
raise Discourse::InvalidParameters.new(:usernames) if users.blank?
|
||||
elsif params[:user_ids].present?
|
||||
users = User.where(id: params[:user_ids].split(","))
|
||||
|
Reference in New Issue
Block a user