]> git.openstreetmap.org Git - rails.git/commitdiff
Look at all note comments to find the close event
authorTom Hughes <tom@compton.nu>
Wed, 6 May 2020 13:06:04 +0000 (14:06 +0100)
committerTom Hughes <tom@compton.nu>
Wed, 6 May 2020 13:06:04 +0000 (14:06 +0100)
Fixes #2612

app/models/note.rb
app/views/browse/note.html.erb

index ec57b770bbc008c923b2394e71f02e4d24549521..ea88599a4a9db66fbf4c2df046f171f850a25195 100644 (file)
@@ -22,6 +22,7 @@ class Note < ApplicationRecord
   include GeoRecord
 
   has_many :comments, -> { left_joins(:author).where(:visible => true, :users => { :status => [nil, "active", "confirmed"] }).order(:created_at) }, :class_name => "NoteComment", :foreign_key => :note_id
+  has_many :all_comments, -> { left_joins(:author).order(:created_at) }, :class_name => "NoteComment", :foreign_key => :note_id
 
   validates :id, :uniqueness => true, :presence => { :on => :update },
                  :numericality => { :on => :update, :only_integer => true }
index 884f95d57914013481a76688b41e11d5110be888..ffc198b0a52ebf6c05db80184cb3fba30ac84a82 100644 (file)
@@ -15,7 +15,7 @@
     <%= note_event("opened", @note.created_at, @note.author) %>
     <% if @note.status == "closed" %>
       <br />
-      <%= note_event(@note.status, @note.closed_at, @note_comments.last.author) %>
+      <%= note_event(@note.status, @note.closed_at, @note.all_comments.last.author) %>
     <% end %>
   </div>