From d63f4548c00b242462042daf02ac712fae40bc91 Mon Sep 17 00:00:00 2001 From: Rishabh Date: Wed, 28 Sep 2022 17:26:38 +0530 Subject: [PATCH] Removed attribution sources from UI if site is invite-only refs https://github.com/TryGhost/Team/issues/1986 - removes attribution section from dashboard and post analytics if site is invite only --- ghost/admin/app/controllers/dashboard.js | 3 ++- ghost/admin/app/controllers/posts/analytics.js | 2 +- ghost/admin/app/models/setting.js | 1 + ghost/admin/app/services/members-utils.js | 4 ++++ ghost/admin/app/templates/dashboard.hbs | 4 +++- 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/ghost/admin/app/controllers/dashboard.js b/ghost/admin/app/controllers/dashboard.js index 32db332b08..7cf59b2c13 100644 --- a/ghost/admin/app/controllers/dashboard.js +++ b/ghost/admin/app/controllers/dashboard.js @@ -17,6 +17,7 @@ const DAYS_OPTIONS = [{ export default class DashboardController extends Controller { @service dashboardStats; + @service membersUtils; daysOptions = DAYS_OPTIONS; @@ -26,7 +27,7 @@ export default class DashboardController extends Controller { return {}; } - @action + @action onDaysChange(selected) { this.days = selected.value; } diff --git a/ghost/admin/app/controllers/posts/analytics.js b/ghost/admin/app/controllers/posts/analytics.js index fb8ad4c835..a9421e4c87 100644 --- a/ghost/admin/app/controllers/posts/analytics.js +++ b/ghost/admin/app/controllers/posts/analytics.js @@ -105,7 +105,7 @@ export default class AnalyticsController extends Controller { } get showSources() { - return this.feature.get('sourceAttribution') && !this.post.emailOnly; + return this.feature.get('sourceAttribution') && !this.membersUtils.isMembersInviteOnly && !this.post.emailOnly; } get isLoaded() { diff --git a/ghost/admin/app/models/setting.js b/ghost/admin/app/models/setting.js index 44b83f830d..d35e76d307 100644 --- a/ghost/admin/app/models/setting.js +++ b/ghost/admin/app/models/setting.js @@ -73,6 +73,7 @@ export default Model.extend(ValidationEngine, { membersEnabled: attr('boolean'), paidMembersEnabled: attr('boolean'), + membersInviteOnly: attr('boolean'), commentsEnabled: attr(), // "off", "free", "paid" diff --git a/ghost/admin/app/services/members-utils.js b/ghost/admin/app/services/members-utils.js index 45df1837f6..c2af1fc6e8 100644 --- a/ghost/admin/app/services/members-utils.js +++ b/ghost/admin/app/services/members-utils.js @@ -14,6 +14,10 @@ export default class MembersUtilsService extends Service { return this.settings.get('paidMembersEnabled'); } + get isMembersInviteOnly() { + return this.settings.get('membersInviteOnly'); + } + /** * Note: always use paidMembersEnabled! Only use this getter for the Stripe Connection UI. */ diff --git a/ghost/admin/app/templates/dashboard.hbs b/ghost/admin/app/templates/dashboard.hbs index 29f23643fb..264b080b04 100644 --- a/ghost/admin/app/templates/dashboard.hbs +++ b/ghost/admin/app/templates/dashboard.hbs @@ -30,7 +30,9 @@ - + {{#unless this.membersUtils.isMembersInviteOnly}} + + {{/unless}} {{/if}} {{/if}} {{#if this.areNewslettersEnabled}}