diff options
Diffstat (limited to 'app/controllers/concerns/web_hooks/hook_actions.rb')
-rw-r--r-- | app/controllers/concerns/web_hooks/hook_actions.rb | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/app/controllers/concerns/web_hooks/hook_actions.rb b/app/controllers/concerns/web_hooks/hook_actions.rb index 75065ef9d24..f61600af951 100644 --- a/app/controllers/concerns/web_hooks/hook_actions.rb +++ b/app/controllers/concerns/web_hooks/hook_actions.rb @@ -18,7 +18,9 @@ module WebHooks self.hook = relation.new(hook_params) hook.save - unless hook.valid? + if hook.valid? + flash[:notice] = _('Webhook was created') + else self.hooks = relation.select(&:persisted?) flash[:alert] = hook.errors.full_messages.to_sentence.html_safe end @@ -28,8 +30,8 @@ module WebHooks def update if hook.update(hook_params) - flash[:notice] = _('Hook was successfully updated.') - redirect_to action: :index + flash[:notice] = _('Webhook was updated') + redirect_to action: :edit else render 'edit' end @@ -66,21 +68,14 @@ module WebHooks end def hook_param_names - param_names = %i[enable_ssl_verification token url push_events_branch_filter] - param_names.push(:branch_filter_strategy) if Feature.enabled?(:enhanced_webhook_support_regex) - param_names + %i[enable_ssl_verification token url push_events_branch_filter branch_filter_strategy] end def destroy_hook(hook) result = WebHooks::DestroyService.new(current_user).execute(hook) if result[:status] == :success - flash[:notice] = - if result[:async] - format(_("%{hook_type} was scheduled for deletion"), hook_type: hook.model_name.human) - else - format(_("%{hook_type} was deleted"), hook_type: hook.model_name.human) - end + flash[:notice] = result[:async] ? _('Webhook was scheduled for deletion') : _('Webhook was deleted') else flash[:alert] = result[:message] end |