mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
Have log_out method return json.
This commit helps improve the discourse_api experience so that we can check the json response if it was a success or not. This commit also checks that a 404 is sent instead of a 500 if a bad user_id is passed in.
This commit is contained in:
@ -66,10 +66,14 @@ class Admin::UsersController < Admin::AdminController
|
||||
end
|
||||
|
||||
def log_out
|
||||
@user.auth_token = nil
|
||||
@user.save!
|
||||
MessageBus.publish "/logout", @user.id, user_ids: [@user.id]
|
||||
render nothing: true
|
||||
if @user
|
||||
@user.auth_token = nil
|
||||
@user.save!
|
||||
MessageBus.publish "/logout", @user.id, user_ids: [@user.id]
|
||||
render json: success_json
|
||||
else
|
||||
render json: {error: I18n.t('admin_js.admin.users.id_not_found')}, status: 404
|
||||
end
|
||||
end
|
||||
|
||||
def refresh_browsers
|
||||
|
Reference in New Issue
Block a user