mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
SECURITY: Update reviewable user serializer payload
Exclude email from reviewable user serializer based on user scope.
This commit is contained in:
@@ -16,4 +16,14 @@ class ReviewableUserSerializer < ReviewableSerializer
|
||||
def include_user_fields?
|
||||
object.target.present? && object.target.user_fields.present?
|
||||
end
|
||||
|
||||
def attributes(*args)
|
||||
data = super
|
||||
data[:payload]&.delete("email") if !include_email?
|
||||
data
|
||||
end
|
||||
|
||||
def include_email?
|
||||
scope.can_check_emails?(scope.user)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user