Class: GroupShowSerializer
Class Method Summary
collapse
Instance Method Summary
collapse
#bio_cooked, #bio_excerpt, #can_admin_group, #can_edit_group, #can_see_members, #display_name, #include_bio_raw?, #include_can_admin_group?, #include_can_edit_group?, #include_display_name?, #include_has_messages?, #include_incoming_email?
expire_cache_fragment!, fragment_cache
#include!
Class Method Details
.admin_attributes(*attrs) ⇒ Object
12
13
14
15
16
17
18
19
|
# File 'app/serializers/group_show_serializer.rb', line 12
def self.admin_attributes(*attrs)
attributes(*attrs)
attrs.each do |attr|
define_method "include_#{attr}?" do
scope.is_admin?
end
end
end
|
.admin_or_owner_attributes(*attrs) ⇒ Object
49
50
51
52
53
54
55
56
|
# File 'app/serializers/group_show_serializer.rb', line 49
def self.admin_or_owner_attributes(*attrs)
attributes(*attrs)
attrs.each do |attr|
define_method "include_#{attr}?" do
scope.is_admin? || (include_is_group_owner? && is_group_owner)
end
end
end
|
Instance Method Details
#associated_group_ids ⇒ Object
129
130
131
|
# File 'app/serializers/group_show_serializer.rb', line 129
def associated_group_ids
object.associated_groups.map(&:id)
end
|
#include_associated_group_ids? ⇒ Boolean
133
134
135
|
# File 'app/serializers/group_show_serializer.rb', line 133
def include_associated_group_ids?
scope.can_associate_groups?
end
|
#include_flair_icon? ⇒ Boolean
109
110
111
|
# File 'app/serializers/group_show_serializer.rb', line 109
def include_flair_icon?
flair_icon.present? && (is_group_owner || scope.is_admin?)
end
|
#include_flair_type? ⇒ Boolean
113
114
115
|
# File 'app/serializers/group_show_serializer.rb', line 113
def include_flair_type?
flair_type.present? && (is_group_owner || scope.is_admin?)
end
|
#include_is_group_owner? ⇒ Boolean
77
78
79
|
# File 'app/serializers/group_show_serializer.rb', line 77
def include_is_group_owner?
authenticated? && fetch_group_user&.owner
end
|
#include_is_group_owner_display? ⇒ Boolean
85
86
87
|
# File 'app/serializers/group_show_serializer.rb', line 85
def include_is_group_owner_display?
authenticated?
end
|
#include_is_group_user? ⇒ Boolean
69
70
71
|
# File 'app/serializers/group_show_serializer.rb', line 69
def include_is_group_user?
authenticated?
end
|
#include_mentionable? ⇒ Boolean
93
94
95
|
# File 'app/serializers/group_show_serializer.rb', line 93
def include_mentionable?
authenticated?
end
|
#include_messageable? ⇒ Boolean
97
98
99
|
# File 'app/serializers/group_show_serializer.rb', line 97
def include_messageable?
authenticated?
end
|
#is_group_owner ⇒ Object
81
82
83
|
# File 'app/serializers/group_show_serializer.rb', line 81
def is_group_owner
true
end
|
#is_group_owner_display ⇒ Object
89
90
91
|
# File 'app/serializers/group_show_serializer.rb', line 89
def is_group_owner_display
!!fetch_group_user&.owner
end
|
#is_group_user ⇒ Object
73
74
75
|
# File 'app/serializers/group_show_serializer.rb', line 73
def is_group_user
!!fetch_group_user
end
|
#mentionable ⇒ Object
101
102
103
|
# File 'app/serializers/group_show_serializer.rb', line 101
def mentionable
Group.mentionable(scope.user).exists?(id: object.id)
end
|
#messageable ⇒ Object
105
106
107
|
# File 'app/serializers/group_show_serializer.rb', line 105
def messageable
scope.can_send_private_message?(object)
end
|