summaryrefslogtreecommitdiff
path: root/app/controllers/concerns/hooks_execution.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-05-25 19:26:55 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2017-05-25 19:26:55 +0300
commit10a914fbf31b465ac2190730b826f7752ece7da4 (patch)
tree1c02aa995de8ed24bce41d6fcd461c7f92a8f83c /app/controllers/concerns/hooks_execution.rb
parent5d5b97cdd692802fc38a12d958a67d73686b97ab (diff)
parentd70f7f5d25aa8753ee3fa26a7564b7d379e72c2d (diff)
downloadgitlab-ce-dz-codeclimate-compare.tar.gz
Merge remote-tracking branch 'origin/master' into dz-codeclimate-comparedz-codeclimate-compare
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
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