You’ve signed the CLA, udan11. Thank you! This pull request is ready for review.
This pull request has been mentioned on Discourse Meta. There might be relevant details there:
- user creates post … gets notice
- admin deletes post
- user creates another post… gets notice
- admin undeletes old post, now 2 posts have a notice
Simplest workaround is to blow up the notice on undelete, trickier one is just to remove other dupe notices on undelete.
Why check for posts older than 1 day? Also, the order doesn’t seem right
last_post_time = Post.where(user_id: @user.id) .order(created_at: :desc) .limit(1) .pluck(:created_at) .first
The order in the query for
last_post_time should be descending.