mirror of
https://github.com/discourse/discourse.git
synced 2025-06-02 03:37:24 +08:00
FEATURE: Allow group owners to edit group name and avatar flair.
This commit is contained in:
@ -1,11 +1,25 @@
|
||||
class GroupShowSerializer < BasicGroupSerializer
|
||||
attributes :is_group_user
|
||||
attributes :is_group_user, :is_group_owner
|
||||
|
||||
def include_is_group_user?
|
||||
scope.authenticated?
|
||||
end
|
||||
|
||||
def is_group_user
|
||||
object.users.include?(scope.user)
|
||||
!!fetch_group_user
|
||||
end
|
||||
|
||||
def include_is_group_owner?
|
||||
scope.authenticated?
|
||||
end
|
||||
|
||||
def is_group_owner
|
||||
scope.is_admin? || fetch_group_user&.owner
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def fetch_group_user
|
||||
@group_user ||= object.group_users.find_by(user: scope.user)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user