FEATURE: Unconditionally notify on edits at least once a day

FEATURE: Unconditionally notify on edits at least once a day

This ensures that at a minimum you are notified once a day of repeat edits by the same user.

Long term we may consider winding this down to say 1 hour or making it configurable.

diff --git a/app/services/post_alerter.rb b/app/services/post_alerter.rb
index 7b1965b..196e4ae 100644
--- a/app/services/post_alerter.rb
+++ b/app/services/post_alerter.rb
@@ -256,6 +256,7 @@ class PostAlerter
   end
 
   def should_notify_edit?(notification, post, opts)
+    notification.created_at < 1.day.ago ||
     notification.data_hash["display_username"] != (opts[:display_username].presence || post.user.username)
   end
 
diff --git a/spec/services/post_alerter_spec.rb b/spec/services/post_alerter_spec.rb
index 2b3734f..f5f0d14 100644
--- a/spec/services/post_alerter_spec.rb
+++ b/spec/services/post_alerter_spec.rb
@@ -122,12 +122,16 @@ describe PostAlerter do
       freeze_time 2.hours.from_now
       post.revise(admin, raw: 'I made another revision')
 
+      # this we do not skip cause 1 day has passed
+      freeze_time 23.hours.from_now
+      post.revise(admin, raw: 'I made another revision xyz')
+
       post.revise(Fabricate(:admin), raw: 'I made a revision')
 
       freeze_time 2.hours.from_now
       post.revise(admin, raw: 'I made another revision')
 
-      expect(Notification.where(post_number: 1, topic_id: post.topic_id).count).to eq(4)
+      expect(Notification.where(post_number: 1, topic_id: post.topic_id).count).to eq(5)
     end
 
     it 'notifies flaggers when flagged post gets unhidden by edit' do

GitHub sha: 3877ef2c

This commit has been mentioned on Discourse Meta. There might be relevant details there: