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

Gregory Igelmund notifications at github.com
Mon Oct 23 10:40:43 UTC 2023


@grekko commented on this pull request.



> @@ -127,6 +134,23 @@ def mark
     render :action => "no_such_message", :status => :not_found
   end
 
+  # Moves message into Inbox by unsetting the muted-flag
+  def unmute
+    message = Message.where(:recipient => current_user).find(params[:message_id])

> I think some kind of scoping is necessary to avoid unmuting other people's messages

The query is already scoped to the `current_user`

```rb
Message.where(:recipient => current_user).find(params[:message_id])
```

But yes, I prefer a scope on the `current_user`, too. I'll change this too:

```rb
current_user.muted_messages.find(params[:message_id])
```

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

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


More information about the rails-dev mailing list