[openstreetmap/openstreetmap-website] Check that commenters don't receive notifications about their own comments (PR #6486)

Pablo Brasero notifications at github.com
Wed Oct 29 15:18:52 UTC 2025


I noticed that the following code has a `if current_user != user` that is not tested anywhere:

https://github.com/openstreetmap/openstreetmap-website/blob/8e97f3b1017975fb51104a22175e6d4cd8d23eec/app/controllers/api/changeset_comments_controller.rb#L47-L49

I went to add a test, ended up doing a bit of refactoring. Two commits here:
1. Refactor checks of whether emails are being received by the expected recipients, using a custom assertion. I also use this at `test/controllers/api/notes_controller_test.rb` which is unrelated to my initial intention.
2. Add an assertion that an unsubscribed commenter doesn't receive a notification email about their own comment, plus a new test checking the same thing for a subscribed commenter. Also testing an unrelated user, since we are at it.
You can view, comment on, or merge this pull request online at:

  https://github.com/openstreetmap/openstreetmap-website/pull/6486

-- Commit Summary --

  * DRY tests with assertions to check whether an email was received
  * Test: users shouldn't receive notifications of own comments

-- File Changes --

    M test/controllers/api/changeset_comments_controller_test.rb (37)
    M test/controllers/api/notes_controller_test.rb (12)
    M test/test_helper.rb (23)

-- Patch Links --

https://github.com/openstreetmap/openstreetmap-website/pull/6486.patch
https://github.com/openstreetmap/openstreetmap-website/pull/6486.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/6486
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/6486 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20251029/ea0e9979/attachment-0001.htm>


More information about the rails-dev mailing list