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.
This commit is contained in:
parent
3d0ccf8642
commit
3877ef2cfa
|
@ -256,6 +256,7 @@ class PostAlerter
|
||||||
end
|
end
|
||||||
|
|
||||||
def should_notify_edit?(notification, post, opts)
|
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)
|
notification.data_hash["display_username"] != (opts[:display_username].presence || post.user.username)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -122,12 +122,16 @@ describe PostAlerter do
|
||||||
freeze_time 2.hours.from_now
|
freeze_time 2.hours.from_now
|
||||||
post.revise(admin, raw: 'I made another revision')
|
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')
|
post.revise(Fabricate(:admin), raw: 'I made a revision')
|
||||||
|
|
||||||
freeze_time 2.hours.from_now
|
freeze_time 2.hours.from_now
|
||||||
post.revise(admin, raw: 'I made another revision')
|
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
|
end
|
||||||
|
|
||||||
it 'notifies flaggers when flagged post gets unhidden by edit' do
|
it 'notifies flaggers when flagged post gets unhidden by edit' do
|
||||||
|
|
Loading…
Reference in New Issue