X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/bf11e06e635ecb86e31f60c9dfc0e575c8f2a937..d8e51614cb04da1f61ec403af49d249209c1f7f9:/app/models/note.rb diff --git a/app/models/note.rb b/app/models/note.rb index 8c6137479..c3e0d776c 100644 --- a/app/models/note.rb +++ b/app/models/note.rb @@ -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