mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
SECURITY: Do not reveal post whisperer in personal messages.
Prior to this fix, post whisperer in personal messages are revealed in the topic's participants list even though non-staff users are unable to see the whisper.
This commit is contained in:
@@ -458,14 +458,18 @@ class PostCreator
|
||||
|
||||
def ensure_in_allowed_users
|
||||
return unless @topic.private_message? && @topic.id
|
||||
return if @post.whisper?
|
||||
return if @topic.topic_allowed_users.exists?(user_id: @user.id)
|
||||
|
||||
unless @topic.topic_allowed_users.where(user_id: @user.id).exists?
|
||||
unless @topic.topic_allowed_groups.where('group_id IN (
|
||||
SELECT group_id FROM group_users where user_id = ?
|
||||
)', @user.id).exists?
|
||||
@topic.topic_allowed_users.create!(user_id: @user.id)
|
||||
end
|
||||
end
|
||||
return if @topic
|
||||
.topic_allowed_groups
|
||||
.where(
|
||||
"group_id IN (SELECT group_id FROM group_users where user_id = ?)",
|
||||
@user.id
|
||||
)
|
||||
.exists?
|
||||
|
||||
@topic.topic_allowed_users.create!(user_id: @user.id)
|
||||
end
|
||||
|
||||
def unarchive_message
|
||||
|
||||
Reference in New Issue
Block a user