FIX: restrict other user's notification routes (#14442)

It was possible to see notifications of other users using routes:
- notifications/responses
- notifications/likes-received
- notifications/mentions
- notifications/edits

We weren't showing anything private (like notifications about private messages), only things that're publicly available in other places. But anyway, it feels strange that it's possible to look at notifications of someone else. Additionally, there is a risk that we can unintentionally leak something on these pages in the future.

This commit restricts these routes.
This commit is contained in:
Andrei Prigorshnev
2021-09-29 16:24:28 +04:00
committed by GitHub
parent 2d4b9595e8
commit b609f6c11c
4 changed files with 67 additions and 3 deletions
+10
View File
@@ -55,6 +55,16 @@ class UserAction < ActiveRecord::Base
assigned: 16)
end
def self.private_types
@private_types ||= [
WAS_LIKED,
RESPONSE,
MENTION,
QUOTE,
EDIT
]
end
def self.last_action_in_topic(user_id, topic_id)
UserAction.where(user_id: user_id,
target_topic_id: topic_id,