mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 15:28:37 +08:00
REFACTOR: Move option to return emails into the serializer
This makes more sense than having the guardian take an accessor. The logic belongs in the Serializer, where the JSON is calculated. Also removed some of the DRYness in the spec. It's fewer lines and made it easier to test the option on the serializer.
This commit is contained in:
@ -54,7 +54,6 @@ class Guardian
|
||||
end
|
||||
end
|
||||
|
||||
attr_accessor :can_see_emails
|
||||
attr_reader :request
|
||||
|
||||
def initialize(user = nil, request = nil)
|
||||
@ -381,10 +380,6 @@ class Guardian
|
||||
)
|
||||
end
|
||||
|
||||
def can_see_emails?
|
||||
@can_see_emails
|
||||
end
|
||||
|
||||
def can_export_entity?(entity)
|
||||
return false unless @user
|
||||
return true if is_admin?
|
||||
|
Reference in New Issue
Block a user