Commit 5e1ef575df927a1132e8991f7d5dcc2f43217456
1 parent
ed26ecae
Exists in
master
and in
4 other branches
Add CommitController
Showing
1 changed file
with
33 additions
and
0 deletions
Show diff stats
| @@ -0,0 +1,33 @@ | @@ -0,0 +1,33 @@ | ||
| 1 | +# Controller for a specific Commit | ||
| 2 | +# | ||
| 3 | +# Not to be confused with CommitsController, plural. | ||
| 4 | +class CommitController < ApplicationController | ||
| 5 | + before_filter :project | ||
| 6 | + layout "project" | ||
| 7 | + | ||
| 8 | + # Authorize | ||
| 9 | + before_filter :add_project_abilities | ||
| 10 | + before_filter :authorize_read_project! | ||
| 11 | + before_filter :authorize_code_access! | ||
| 12 | + before_filter :require_non_empty_project | ||
| 13 | + | ||
| 14 | + def show | ||
| 15 | + result = CommitLoad.new(project, current_user, params).execute | ||
| 16 | + | ||
| 17 | + @commit = result[:commit] | ||
| 18 | + | ||
| 19 | + if @commit | ||
| 20 | + @suppress_diff = result[:suppress_diff] | ||
| 21 | + @note = result[:note] | ||
| 22 | + @line_notes = result[:line_notes] | ||
| 23 | + @notes_count = result[:notes_count] | ||
| 24 | + @comments_allowed = true | ||
| 25 | + else | ||
| 26 | + return git_not_found! | ||
| 27 | + end | ||
| 28 | + | ||
| 29 | + if result[:status] == :huge_commit | ||
| 30 | + render "huge_commit" and return | ||
| 31 | + end | ||
| 32 | + end | ||
| 33 | +end |