diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 8570540d5c2..f3c837bf30a 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1130,9 +1130,7 @@ class UsersController < ApplicationController MessageBus.publish "/file-change", ["refresh"], user_ids: [user.id] - render json: { - success: true - } + render json: success_json end private diff --git a/spec/requests/users_controller_spec.rb b/spec/requests/users_controller_spec.rb index e64044ac071..67c96d6bde3 100644 --- a/spec/requests/users_controller_spec.rb +++ b/spec/requests/users_controller_spec.rb @@ -3265,13 +3265,14 @@ describe UsersController do context 'while logged in' do before do - sign_in(user) - sign_in(user) + 2.times { sign_in(user) } end it 'logs user out' do - ids = user.user_auth_tokens.map { |token| token.id } - post "/u/#{user.username}/preferences/revoke-auth-token.json", params: { token_id: ids[0] } + ids = user.user_auth_tokens.order(:created_at).pluck(:id) + + post "/u/#{user.username}/preferences/revoke-auth-token.json", + params: { token_id: ids[0] } expect(response.status).to eq(200)