mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 23:58:31 -05:00
FIX: cannot show email for pending/inactive users
This commit is contained in:
parent
3dcccb5dee
commit
865194f409
2 changed files with 12 additions and 2 deletions
|
@ -94,7 +94,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def check_emails
|
||||
user = fetch_user_from_params
|
||||
user = fetch_user_from_params(include_inactive: true)
|
||||
guardian.ensure_can_check_emails!(user)
|
||||
|
||||
StaffActionLogger.new(current_user).log_check_email(user, context: params[:context])
|
||||
|
|
|
@ -1411,6 +1411,16 @@ describe UsersController do
|
|||
json["associated_accounts"].should be_present
|
||||
end
|
||||
|
||||
it "works on inactive users" do
|
||||
inactive_user = Fabricate(:user, active: false)
|
||||
Guardian.any_instance.expects(:can_check_emails?).returns(true)
|
||||
xhr :put, :check_emails, username: inactive_user.username
|
||||
response.should be_success
|
||||
json = JSON.parse(response.body)
|
||||
json["email"].should be_present
|
||||
json["associated_accounts"].should be_present
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue