]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/note.rb
Display how long until a note will disappear
[rails.git] / app / models / note.rb
index 8c61374790af4cf2b65c8099d544753136e9b995..c3e0d776c61416fb32ed29d0af81c05279cff1e6 100644 (file)
@@ -66,6 +66,18 @@ class Note < ApplicationRecord
     !closed_at.nil?
   end
 
+  def freshly_closed?
+    return false unless closed?
+
+    Time.now.utc < freshly_closed_until
+  end
+
+  def freshly_closed_until
+    return nil unless closed?
+
+    closed_at + 7.days
+  end
+
   # Return the author object, derived from the first comment
   def author
     comments.first.author