FIX: Check parameter types

/u/is_local_username used to throw a 500 error
This commit is contained in:
Dan Ungureanu 2020-02-03 12:34:36 +02:00
parent baca59c1a6
commit a2f8ac9aac
No known key found for this signature in database
GPG Key ID: 0AA2A00D6ACC8B84

View File

@ -300,8 +300,10 @@ class UsersController < ApplicationController
end
def is_local_username
usernames = params[:usernames]
usernames = [params[:username]] if usernames.blank?
usernames = params[:usernames] if params[:usernames].present?
usernames = [params[:username]] if params[:username].present?
raise Discourse::InvalidParameters.new(:usernames) if !usernames.kind_of?(Array)
groups = Group.where(name: usernames).pluck(:name)
mentionable_groups =