summaryrefslogtreecommitdiff
path: root/app/contexts/commit_load.rb
diff options
context:
space:
mode:
authorNihad Abbasov <narkoz.2008@gmail.com>2012-07-24 05:46:36 -0700
committerNihad Abbasov <narkoz.2008@gmail.com>2012-07-24 05:46:36 -0700
commiteca823c1c7cef45cc18c6ab36d2327650c85bfc3 (patch)
tree50b6d6cce1d1da7f5a6e08b497b1b35718db30a9 /app/contexts/commit_load.rb
parent024e0348904179a8dea81c01e27a5f014cf57499 (diff)
parent8b7e404b5b6944e9c92cc270b2e5d0005781d49d (diff)
downloadgitlab-ce-eca823c1c7cef45cc18c6ab36d2327650c85bfc3.tar.gz
Merge branch 'master' into api
Diffstat (limited to 'app/contexts/commit_load.rb')
-rw-r--r--app/contexts/commit_load.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/app/contexts/commit_load.rb b/app/contexts/commit_load.rb
new file mode 100644
index 00000000000..bab30d61007
--- /dev/null
+++ b/app/contexts/commit_load.rb
@@ -0,0 +1,26 @@
+class CommitLoad < BaseContext
+ def execute
+ result = {
+ :commit => nil,
+ :suppress_diff => false,
+ :line_notes => [],
+ :notes_count => 0,
+ :note => nil
+ }
+
+ commit = project.commit(params[:id])
+
+ if commit
+ commit = CommitDecorator.decorate(commit)
+ line_notes = project.commit_line_notes(commit)
+
+ result[:suppress_diff] = true if commit.diffs.size > 200 && !params[:force_show_diff]
+ result[:commit] = commit
+ result[:note] = project.build_commit_note(commit)
+ result[:line_notes] = line_notes
+ result[:notes_count] = line_notes.count + project.commit_notes(commit).count
+ end
+
+ result
+ end
+end