summaryrefslogtreecommitdiff
path: root/app/controllers/concerns/hooks_execution.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/concerns/hooks_execution.rb')
-rw-r--r--app/controllers/concerns/hooks_execution.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/app/controllers/concerns/hooks_execution.rb b/app/controllers/concerns/hooks_execution.rb
new file mode 100644
index 00000000000..846cd60518f
--- /dev/null
+++ b/app/controllers/concerns/hooks_execution.rb
@@ -0,0 +1,15 @@
+module HooksExecution
+ extend ActiveSupport::Concern
+
+ private
+
+ def set_hook_execution_notice(status, message)
+ if status && status >= 200 && status < 400
+ flash[:notice] = "Hook executed successfully: HTTP #{status}"
+ elsif status
+ flash[:alert] = "Hook executed successfully but returned HTTP #{status} #{message}"
+ else
+ flash[:alert] = "Hook execution failed: #{message}"
+ end
+ end
+end