UX: show if webhook is disabled (#7217)

+ show in staff logs when webhook is created/updated/destroyed
This commit is contained in:
Maja Komel
2019-03-21 16:13:09 +01:00
committed by Régis Hanol
parent bfcbc4d2d6
commit 34730a0b16
9 changed files with 75 additions and 5 deletions

View File

@ -34,6 +34,7 @@ class Admin::WebHooksController < Admin::AdminController
web_hook = WebHook.new(web_hook_params)
if web_hook.save
StaffActionLogger.new(current_user).log_web_hook(web_hook, UserHistory.actions[:web_hook_create])
render_serialized(web_hook, AdminWebHookSerializer, root: 'web_hook')
else
render_json_error web_hook.errors.full_messages
@ -42,6 +43,7 @@ class Admin::WebHooksController < Admin::AdminController
def update
if @web_hook.update_attributes(web_hook_params)
StaffActionLogger.new(current_user).log_web_hook(@web_hook, UserHistory.actions[:web_hook_update], changes: @web_hook.saved_changes)
render_serialized(@web_hook, AdminWebHookSerializer, root: 'web_hook')
else
render_json_error @web_hook.errors.full_messages
@ -50,6 +52,7 @@ class Admin::WebHooksController < Admin::AdminController
def destroy
@web_hook.destroy!
StaffActionLogger.new(current_user).log_web_hook(@web_hook, UserHistory.actions[:web_hook_destroy])
render json: success_json
end