]> git.openstreetmap.org Git - rails.git/blobdiff - app/controllers/notes_controller.rb
Hide note comments made by deleted users
[rails.git] / app / controllers / notes_controller.rb
index 9d156ea1d15e492f43ab1ed65fb787073a2a8f74..94d0fdb55343cd4f708da802ead7921f63e0969a 100644 (file)
@@ -328,11 +328,13 @@ class NotesController < ApplicationController
                    end
 
     if closed_since < 0
-      notes.where("status != 'hidden'")
+      notes.where.not(:status => "hidden")
     elsif closed_since > 0
-      notes.where("(status = 'open' OR (status = 'closed' AND closed_at > '#{Time.now - closed_since.days}'))")
+      notes.where(:status => "open")
+           .or(notes.where(:status => "closed")
+                    .where(notes.arel_table[:closed_at].gt(Time.now - closed_since.days)))
     else
-      notes.where("status = 'open'")
+      notes.where(:status => "open")
     end
   end