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