[openstreetmap/openstreetmap-website] Add UserMute to control private message visibility (PR #4284)

Gregory Igelmund notifications at github.com
Thu Oct 26 18:59:35 UTC 2023


@grekko commented on this pull request.



> +    create(:user_mute, :owner => user, :subject => muted_user)
+
+    message = build(:message, :sender => muted_user, :recipient => user)
+    message.save
+
+    assert_predicate message, :muted?
+  end
+
+  def test_messages_by_admins_or_moderators_are_never_muted
+    user = create(:user)
+
+    [create(:administrator_user), create(:moderator_user)].each do |admin_or_moderator|
+      create(:user_mute, :owner => user, :subject => admin_or_moderator)
+
+      message = build(:message, :sender => admin_or_moderator, :recipient => user)
+      message.save

🤔 yeah, I would expect so. I am not sure the code calls `build` and `save` – I think this can and should just be `create` – thanks!

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

Message ID: <openstreetmap/openstreetmap-website/pull/4284/review/1700444797 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20231026/9434680e/attachment-0001.htm>


More information about the rails-dev mailing list