From dc9c812d9c8185b9ac22601c397febead25f84d4 Mon Sep 17 00:00:00 2001 From: Thibaut Patel Date: Mon, 12 Jul 2021 14:55:56 +0200 Subject: [PATCH] Renamed isAdmin/isOwner/isAdminOrOwner to reduce confusion issue https://github.com/TryGhost/Team/issues/857 - The goal is to avoid testing for the owner role only is cases where we should be testing for the owner or admin role - `isOwner` => `isOwnerOnly` - `isAdmin` => `isAdminOnly` - `isOwnerOrAdmin` => `isAdmin` (concerns now both Owner and Admins) --- .../admin/app/components/gh-contentfilter.js | 4 ++-- .../components/gh-members-recipient-select.js | 2 +- .../components/gh-members-segment-count.hbs | 2 +- .../app/components/gh-nav-menu/footer.js | 4 ++-- .../admin/app/components/gh-nav-menu/main.hbs | 2 +- .../admin/app/components/gh-nav-menu/main.js | 6 ++--- .../app/components/gh-post-settings-menu.js | 4 ++-- .../gh-post-settings-menu/email.hbs | 2 +- .../app/components/gh-publishmenu-draft.js | 4 ++-- ghost/admin/app/components/gh-publishmenu.js | 2 +- .../components/modal-confirm-email-send.hbs | 2 +- ghost/admin/app/controllers/editor.js | 4 ++-- ghost/admin/app/controllers/staff/user.js | 12 +++++----- ghost/admin/app/helpers/gh-user-can-admin.js | 2 +- ghost/admin/app/models/user.js | 6 ++--- ghost/admin/app/routes/dashboard.js | 2 +- ghost/admin/app/routes/launch.js | 2 +- ghost/admin/app/routes/member.js | 2 +- ghost/admin/app/routes/members.js | 2 +- ghost/admin/app/routes/pro.js | 2 +- ghost/admin/app/routes/settings/product.js | 2 +- ghost/admin/app/templates/dashboard.hbs | 4 ++-- ghost/admin/app/templates/member.hbs | 2 +- .../unit/helpers/gh-user-can-admin-test.js | 8 +++---- ghost/admin/tests/unit/models/user-test.js | 24 +++++++++---------- 25 files changed, 54 insertions(+), 54 deletions(-) diff --git a/ghost/admin/app/components/gh-contentfilter.js b/ghost/admin/app/components/gh-contentfilter.js index 3641c25dfa..72736c778a 100644 --- a/ghost/admin/app/components/gh-contentfilter.js +++ b/ghost/admin/app/components/gh-contentfilter.js @@ -8,7 +8,7 @@ export default class GhContentfilterComponent extends Component { @service router; get showCustomViewManagement() { - let isOwnerOrAdmin = get(this.args.currentUser || {}, 'isOwnerOrAdmin'); + let isAdmin = get(this.args.currentUser || {}, 'isAdmin'); let onPostsScreen = this.router.currentRouteName === 'posts'; let isDefaultView = this.customViews?.activeView?.isDefault; let hasFilter = this.args.selectedType.value @@ -17,7 +17,7 @@ export default class GhContentfilterComponent extends Component { || this.args.selectedTag.slug || this.args.selectedOrder.value; - return isOwnerOrAdmin && onPostsScreen && !isDefaultView && hasFilter; + return isAdmin && onPostsScreen && !isDefaultView && hasFilter; } calculateActionsDropdownPosition(trigger, content) { diff --git a/ghost/admin/app/components/gh-members-recipient-select.js b/ghost/admin/app/components/gh-members-recipient-select.js index 53b8216bd5..2a0b9f9a50 100644 --- a/ghost/admin/app/components/gh-members-recipient-select.js +++ b/ghost/admin/app/components/gh-members-recipient-select.js @@ -176,7 +176,7 @@ export default class GhMembersRecipientSelect extends Component { *fetchMemberCountsTask() { const user = yield this.session.user; - if (!user.isOwnerOrAdmin) { + if (!user.isAdmin) { return; } diff --git a/ghost/admin/app/components/gh-members-segment-count.hbs b/ghost/admin/app/components/gh-members-segment-count.hbs index 57045c0f53..fd8af31922 100644 --- a/ghost/admin/app/components/gh-members-segment-count.hbs +++ b/ghost/admin/app/components/gh-members-segment-count.hbs @@ -1,4 +1,4 @@ -{{#if this.session.user.isOwnerOrAdmin}} +{{#if this.session.user.isAdmin}} {{svg-jar "staff"}}Staff - {{#if this.session.user.isOwner}} + {{#if this.session.user.isOwnerOnly}}