From 25cc0631c946ebf8016a5e0e27b224e77fb1a0c1 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Wed, 5 Aug 2015 16:22:05 +0930 Subject: [PATCH] Determine user card editing permissions in one place --- .../js/admin/src/components/PermissionGrid.js | 5 ----- framework/core/js/forum/src/components/UserBio.js | 15 +++------------ .../core/js/forum/src/components/UserPage.js | 2 +- 3 files changed, 4 insertions(+), 18 deletions(-) diff --git a/framework/core/js/admin/src/components/PermissionGrid.js b/framework/core/js/admin/src/components/PermissionGrid.js index 6449dd37a..44d9625b2 100644 --- a/framework/core/js/admin/src/components/PermissionGrid.js +++ b/framework/core/js/admin/src/components/PermissionGrid.js @@ -184,11 +184,6 @@ export default class PermissionGrid extends Component { permission: 'discussion.delete' }); - items.add('suspendUsers', { - label: 'Suspend users', - permission: 'user.suspend' - }); - return items; } diff --git a/framework/core/js/forum/src/components/UserBio.js b/framework/core/js/forum/src/components/UserBio.js index b0b5fddf7..20e18d5c7 100644 --- a/framework/core/js/forum/src/components/UserBio.js +++ b/framework/core/js/forum/src/components/UserBio.js @@ -4,7 +4,7 @@ import classList from 'flarum/utils/classList'; /** * The `UserBio` component displays a user's bio, optionally letting the user - * edit it (if they have permission). + * edit it. */ export default class UserBio extends Component { constructor(...args) { @@ -51,7 +51,7 @@ export default class UserBio extends Component { return (
@@ -60,20 +60,11 @@ export default class UserBio extends Component { ); } - /** - * Check whether or not the bio can be edited. - * - * @return {Boolean} - */ - isEditable() { - return this.props.user.canEdit() && this.props.editable; - } - /** * Edit the bio. */ edit() { - if (!this.isEditable()) return; + if (!this.props.editable) return; this.editing = true; m.redraw(); diff --git a/framework/core/js/forum/src/components/UserPage.js b/framework/core/js/forum/src/components/UserPage.js index 0172db42a..95c3db142 100644 --- a/framework/core/js/forum/src/components/UserPage.js +++ b/framework/core/js/forum/src/components/UserPage.js @@ -39,7 +39,7 @@ export default class UserPage extends Component { UserCard.component({ user: this.user, className: 'Hero UserHero', - editable: this.user.canEdit(), + editable: this.user.canEdit() || this.user === app.session.user, controlsButtonClassName: 'Button' }),