diff options
author | Phil Hughes <me@iamphill.com> | 2017-05-30 10:34:15 +0100 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-05-30 10:34:15 +0100 |
commit | 3465e1e52c812a4a4f4fe941ab04569ebf2a2c12 (patch) | |
tree | 5e28219da36739e6c9abf7366105a6102dc47c5c /app/controllers/concerns | |
parent | 5227ea5bc483359bb8a9a40057587651ecb850c2 (diff) | |
parent | f47e86feaa91d4ba1b268c56dd0a488c7092b573 (diff) | |
download | gitlab-ce-3465e1e52c812a4a4f4fe941ab04569ebf2a2c12.tar.gz |
Merge branch 'master' into issue-edit-inline
Diffstat (limited to 'app/controllers/concerns')
-rw-r--r-- | app/controllers/concerns/diff_for_path.rb | 13 | ||||
-rw-r--r-- | app/controllers/concerns/hooks_execution.rb | 15 |
2 files changed, 16 insertions, 12 deletions
diff --git a/app/controllers/concerns/diff_for_path.rb b/app/controllers/concerns/diff_for_path.rb index 1efa9fe060f..d5388c4cd20 100644 --- a/app/controllers/concerns/diff_for_path.rb +++ b/app/controllers/concerns/diff_for_path.rb @@ -8,17 +8,6 @@ module DiffForPath return render_404 unless diff_file - diff_commit = commit_for_diff(diff_file) - blob = diff_file.blob(diff_commit) - - locals = { - diff_file: diff_file, - diff_commit: diff_commit, - diff_refs: diffs.diff_refs, - blob: blob, - project: project - } - - render json: { html: view_to_html_string('projects/diffs/_content', locals) } + render json: { html: view_to_html_string('projects/diffs/_content', diff_file: diff_file) } end end 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 |