From fa454a8e4714727324e6e6ea181bd31acaad1024 Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Fri, 7 May 2021 10:25:44 +0100 Subject: [PATCH] Hid segment count for non-admins refs https://github.com/TryGhost/Team/issues/496 refs https://github.com/TryGhost/Team/issues/581 Only owners and admins have browse access to members so they are the only ones able to fetch member counts. Don't render segment counts if there's no permission because we'll get errors back from the API and the count will be useless. --- ghost/admin/app/components/gh-members-segment-count.hbs | 4 +++- ghost/admin/app/components/gh-members-segment-count.js | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ghost/admin/app/components/gh-members-segment-count.hbs b/ghost/admin/app/components/gh-members-segment-count.hbs index 94fbfb1f8b..3a9aad3acd 100644 --- a/ghost/admin/app/components/gh-members-segment-count.hbs +++ b/ghost/admin/app/components/gh-members-segment-count.hbs @@ -1,7 +1,9 @@ +{{#if this.session.user.isOwnerOrAdmin}} {{format-number this.segmentTotal}} / {{format-number this.total}} members - \ No newline at end of file + +{{/if}} \ No newline at end of file diff --git a/ghost/admin/app/components/gh-members-segment-count.js b/ghost/admin/app/components/gh-members-segment-count.js index 3dbf1d9c1b..41e54da6cb 100644 --- a/ghost/admin/app/components/gh-members-segment-count.js +++ b/ghost/admin/app/components/gh-members-segment-count.js @@ -5,6 +5,7 @@ import {tracked} from '@glimmer/tracking'; export default class GhMembersSegmentCountComponent extends Component { @service store; + @service session; @tracked total = 0; @tracked segmentTotal = 0;