Commit 9159be3a50e3bc94f30f85d9640eeac212bf0948

Authored by randx
1 parent caeb65b1

Fix MR diff comments. Fix wiki comments loading error

app/assets/stylesheets/sections/notes.scss
@@ -14,7 +14,7 @@ @@ -14,7 +14,7 @@
14 border-top:1px solid #aaa; 14 border-top:1px solid #aaa;
15 } 15 }
16 #new-notes-list.reversed { 16 #new-notes-list.reversed {
17 - border-bottom:1px solid #aaa; 17 + border-bottom:1px solid #ccc;
18 } 18 }
19 19
20 .issue_notes, 20 .issue_notes,
@@ -227,7 +227,7 @@ td .line_note_link { @@ -227,7 +227,7 @@ td .line_note_link {
227 } 227 }
228 } 228 }
229 229
230 -.note-text { 230 +.note-text {
231 border: 1px solid #aaa; 231 border: 1px solid #aaa;
232 box-shadow:none; 232 box-shadow:none;
233 } 233 }
app/contexts/notes/load_context.rb
@@ -20,7 +20,7 @@ module Notes @@ -20,7 +20,7 @@ module Notes
20 # this is the only case, where the order is DESC 20 # this is the only case, where the order is DESC
21 project.common_notes.order("created_at DESC, id DESC").limit(50) 21 project.common_notes.order("created_at DESC, id DESC").limit(50)
22 when "wiki" 22 when "wiki"
23 - project.wikis.reverse.map {|w| w.notes.fresh }.flatten[0..20] 23 + project.wiki_notes.limit(20)
24 end 24 end
25 25
26 @notes = if after_id 26 @notes = if after_id
app/models/project.rb
@@ -171,6 +171,10 @@ class Project < ActiveRecord::Base @@ -171,6 +171,10 @@ class Project < ActiveRecord::Base
171 end 171 end
172 end 172 end
173 173
  174 + def wiki_notes
  175 + Note.where(noteable_id: wikis.map(&:id), noteable_type: 'Wiki', project_id: self.id)
  176 + end
  177 +
174 def project_id 178 def project_id
175 self.id 179 self.id
176 end 180 end
app/models/wiki.rb
@@ -28,7 +28,6 @@ class Wiki < ActiveRecord::Base @@ -28,7 +28,6 @@ class Wiki < ActiveRecord::Base
28 end 28 end
29 new_wiki 29 new_wiki
30 end 30 end
31 -  
32 end 31 end
33 end 32 end
34 # == Schema Information 33 # == Schema Information
app/views/merge_requests/diffs.html.haml
1 = render "show" 1 = render "show"
2 2
  3 +:javascript
  4 + $(function(){
  5 + PerLineNotes.init();
  6 + });