mirror of
https://github.com/discourse/discourse.git
synced 2025-01-31 14:38:30 +08:00
API endpoints should return a response, not nil
This commit is contained in:
parent
bc4c40abd4
commit
5214f82841
|
@ -301,7 +301,7 @@ class Admin::UsersController < Admin::AdminController
|
||||||
@user.deactivate(current_user)
|
@user.deactivate(current_user)
|
||||||
StaffActionLogger.new(current_user).log_user_deactivate(@user, I18n.t('user.deactivated_by_staff'), params.slice(:context))
|
StaffActionLogger.new(current_user).log_user_deactivate(@user, I18n.t('user.deactivated_by_staff'), params.slice(:context))
|
||||||
refresh_browser @user
|
refresh_browser @user
|
||||||
render body: nil
|
render json: success_json
|
||||||
end
|
end
|
||||||
|
|
||||||
def silence
|
def silence
|
||||||
|
|
|
@ -593,6 +593,19 @@ RSpec.describe Admin::UsersController do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#deactivate' do
|
||||||
|
fab!(:reg_user) { Fabricate(:active_user) }
|
||||||
|
|
||||||
|
it "returns success" do
|
||||||
|
put "/admin/users/#{reg_user.id}/deactivate.json"
|
||||||
|
expect(response.status).to eq(200)
|
||||||
|
json = ::JSON.parse(response.body)
|
||||||
|
expect(json['success']).to eq("OK")
|
||||||
|
reg_user.reload
|
||||||
|
expect(reg_user.active).to eq(false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe '#log_out' do
|
describe '#log_out' do
|
||||||
fab!(:reg_user) { Fabricate(:user) }
|
fab!(:reg_user) { Fabricate(:user) }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user