Skip to content

A platform for community discussion. Free, open, simple.

FIX: correct group membership on cards for admins

Jeff Wong3d1ff8e0ad63
diff --git a/app/assets/javascripts/discourse/templates/components/group-card-contents.hbs b/app/assets/javascripts/discourse/templates/components/group-card-contents.hbs
index b458965cec3..5f05fe132ca 100644
--- a/app/assets/javascripts/discourse/templates/components/group-card-contents.hbs
+++ b/app/assets/javascripts/discourse/templates/components/group-card-contents.hbs
@@ -47,7 +47,7 @@
{{ group.user_count }}
</h3>
<h3>
- {{#if group.is_group_owner}}
+ {{#if group.is_group_owner_display}}
{{i18n "groups.index.is_group_owner"}}
{{else if group.is_group_user}}
diff --git a/app/serializers/group_show_serializer.rb b/app/serializers/group_show_serializer.rb
index e97d49e9eb6..2772e08c4fa 100644
--- a/app/serializers/group_show_serializer.rb
+++ b/app/serializers/group_show_serializer.rb
@@ -1,5 +1,5 @@
class GroupShowSerializer < BasicGroupSerializer
- attributes :is_group_user, :is_group_owner, :mentionable, :messageable
+ attributes :is_group_user, :is_group_owner, :is_group_owner_display, :mentionable, :messageable
def include_is_group_user?
authenticated?
@@ -17,6 +17,14 @@ class GroupShowSerializer < BasicGroupSerializer
scope.is_admin? || fetch_group_user&.owner
end
+ def include_is_group_owner_display?
+ authenticated?
+ end
+
+ def is_group_owner_display
+ !!fetch_group_user&.owner
+ end
+
def include_mentionable?
authenticated?
end