1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

Fix some actions being logged on idempotent calls

This commit is contained in:
trwnh 2022-11-08 23:06:20 -06:00 committed by GitHub
parent 53817294fc
commit 0222970ab2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -46,8 +46,10 @@ class Api::V1::Admin::AccountsController < Api::BaseController
def enable
authorize @account.user, :enable?
@account.user.enable!
log_action :enable, @account.user
if @account.user.disabled
@account.user.enable!
log_action :enable, @account.user
end
render json: @account, serializer: REST::Admin::AccountSerializer
end
@ -71,15 +73,19 @@ class Api::V1::Admin::AccountsController < Api::BaseController
def unsensitive
authorize @account, :unsensitive?
@account.unsensitize!
log_action :unsensitive, @account
if @account.sensitized?
@account.unsensitize!
log_action :unsensitive, @account
end
render json: @account, serializer: REST::Admin::AccountSerializer
end
def unsilence
authorize @account, :unsilence?
@account.unsilence!
log_action :unsilence, @account
if @account.silenced?
@account.unsilence!
log_action :unsilence, @account
end
render json: @account, serializer: REST::Admin::AccountSerializer
end