[openstreetmap/openstreetmap-website] Add UserMute to control private message visibility (PR #4284)
Andy Allan
notifications at github.com
Sat Oct 21 16:39:17 UTC 2023
@gravitystorm 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])
We prefer `find_by` instead of `where().first`, but `Model.find(id)` is still preferred to `Model.find_by(:id => id)`.
I think some kind of scoping is necessary to avoid unmuting other people's messages, although I'd normally try to find a `current_user.something.find()` to scope them rather than building a where query.
--
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4284#discussion_r1367758826
You are receiving this because you are subscribed to this thread.
Message ID: <openstreetmap/openstreetmap-website/pull/4284/review/1691290031 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20231021/4c6ee5b0/attachment-0001.htm>
More information about the rails-dev
mailing list