diff --git a/app/controllers/notes_controller.rb b/app/controllers/notes_controller.rb
index 000c7bbb641940b09568ef0d8537a1ba08507b8c..15ca963f281f82bfcae78ac588508c4df090f1d4 100644
--- a/app/controllers/notes_controller.rb
+++ b/app/controllers/notes_controller.rb
@@ -71,7 +71,6 @@ class NotesController < ProjectResourceController
 
   # Helps to distinguish e.g. commit notes in mr notes list
   def note_for_main_target?(note)
-    note.for_wall? ||
-      (@target_type.camelize == note.noteable_type && !note.for_diff_line?)
+    (@target_type.camelize == note.noteable_type && !note.for_diff_line?)
   end
 end
diff --git a/app/models/note.rb b/app/models/note.rb
index baf0634cf6271d66b8b0ead41fd4e81469e82247..8274b8665688df2883f3fae3cf32be73c6267fcf 100644
--- a/app/models/note.rb
+++ b/app/models/note.rb
@@ -88,7 +88,7 @@ class Note < ActiveRecord::Base
   end
 
   def discussion_id
-    @discussion_id ||= [:discussion, noteable_type.try(:underscore), noteable_id, line_code].join("-").to_sym
+    @discussion_id ||= [:discussion, noteable_type.try(:underscore), noteable_id || commit_id, line_code].join("-").to_sym
   end
 
   # Returns true if this is a downvote note,