Commit f554aa38d504387aae09d4000bd208078e1c3c1b

Authored by Dmitriy Zaporozhets
1 parent 48c682b5

Update commentable controllers with new note vars

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
app/controllers/projects/commit_controller.rb
@@ -24,9 +24,8 @@ class Projects::CommitController &lt; Projects::ApplicationController @@ -24,9 +24,8 @@ class Projects::CommitController &lt; Projects::ApplicationController
24 @line_notes = result[:line_notes] 24 @line_notes = result[:line_notes]
25 @branches = result[:branches] 25 @branches = result[:branches]
26 @notes_count = result[:notes_count] 26 @notes_count = result[:notes_count]
27 - @target_type = "Commit"  
28 @notes = project.notes.for_commit_id(@commit.id).not_inline.fresh 27 @notes = project.notes.for_commit_id(@commit.id).not_inline.fresh
29 - @target_id = @commit.id 28 + @noteable = @commit
30 29
31 @comments_allowed = @reply_allowed = true 30 @comments_allowed = @reply_allowed = true
32 @comments_target = { noteable_type: 'Commit', 31 @comments_target = { noteable_type: 'Commit',
app/controllers/projects/issues_controller.rb
@@ -50,8 +50,7 @@ class Projects::IssuesController &lt; Projects::ApplicationController @@ -50,8 +50,7 @@ class Projects::IssuesController &lt; Projects::ApplicationController
50 def show 50 def show
51 @note = @project.notes.new(noteable: @issue) 51 @note = @project.notes.new(noteable: @issue)
52 @notes = @issue.notes.inc_author.fresh 52 @notes = @issue.notes.inc_author.fresh
53 - @target_type = 'Issue'  
54 - @target_id = @issue.id 53 + @noteable = @issue
55 54
56 respond_with(@issue) 55 respond_with(@issue)
57 end 56 end
app/controllers/projects/merge_requests_controller.rb
@@ -200,8 +200,7 @@ class Projects::MergeRequestsController &lt; Projects::ApplicationController @@ -200,8 +200,7 @@ class Projects::MergeRequestsController &lt; Projects::ApplicationController
200 @note = @project.notes.new(noteable: @merge_request) 200 @note = @project.notes.new(noteable: @merge_request)
201 @notes = @merge_request.mr_and_commit_notes.inc_author.fresh 201 @notes = @merge_request.mr_and_commit_notes.inc_author.fresh
202 @discussions = Note.discussions_from_notes(@notes) 202 @discussions = Note.discussions_from_notes(@notes)
203 - @target_type = 'MergeRequest'  
204 - @target_id = @merge_request.id 203 + @noteable = @merge_request
205 204
206 # Get commits from repository 205 # Get commits from repository
207 # or from cache if already merged 206 # or from cache if already merged
app/controllers/projects/snippets_controller.rb
@@ -49,8 +49,7 @@ class Projects::SnippetsController &lt; Projects::ApplicationController @@ -49,8 +49,7 @@ class Projects::SnippetsController &lt; Projects::ApplicationController
49 def show 49 def show
50 @note = @project.notes.new(noteable: @snippet) 50 @note = @project.notes.new(noteable: @snippet)
51 @notes = @snippet.notes.fresh 51 @notes = @snippet.notes.fresh
52 - @target_type = 'Snippet'  
53 - @target_id = @snippet.id 52 + @noteable = @snippet
54 end 53 end
55 54
56 def destroy 55 def destroy