From 9004aff63015699c49823a3b57428bfd0315c4e6 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Mon, 18 May 2015 12:34:03 +0930 Subject: [PATCH] Make discussion edit permission specific to renaming --- framework/core/js/forum/src/initializers/discussion-controls.js | 2 +- framework/core/js/lib/models/discussion.js | 2 +- framework/core/src/Api/Serializers/DiscussionSerializer.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/core/js/forum/src/initializers/discussion-controls.js b/framework/core/js/forum/src/initializers/discussion-controls.js index 1b9fecf6e..6d06ed0fa 100644 --- a/framework/core/js/forum/src/initializers/discussion-controls.js +++ b/framework/core/js/forum/src/initializers/discussion-controls.js @@ -67,7 +67,7 @@ export default function(app) { items.add('separator', Separator.component()); } - if (this.canEdit()) { + if (this.canRename()) { items.add('rename', ActionButton.component({ icon: 'pencil', label: 'Rename', onclick: this.renameAction.bind(this) })); } diff --git a/framework/core/js/lib/models/discussion.js b/framework/core/js/lib/models/discussion.js index 9e26da2f3..cfa11e4e9 100644 --- a/framework/core/js/lib/models/discussion.js +++ b/framework/core/js/lib/models/discussion.js @@ -30,7 +30,7 @@ Discussion.prototype.lastPost = Model.one('lastPost'); Discussion.prototype.lastPostNumber = Model.prop('lastPostNumber'); Discussion.prototype.canReply = Model.prop('canReply'); -Discussion.prototype.canEdit = Model.prop('canEdit'); +Discussion.prototype.canRename = Model.prop('canRename'); Discussion.prototype.canDelete = Model.prop('canDelete'); Discussion.prototype.commentsCount = Model.prop('commentsCount'); diff --git a/framework/core/src/Api/Serializers/DiscussionSerializer.php b/framework/core/src/Api/Serializers/DiscussionSerializer.php index bc844153c..d5c0205b7 100644 --- a/framework/core/src/Api/Serializers/DiscussionSerializer.php +++ b/framework/core/src/Api/Serializers/DiscussionSerializer.php @@ -28,7 +28,7 @@ class DiscussionSerializer extends DiscussionBasicSerializer 'lastTime' => $discussion->last_time ? $discussion->last_time->toRFC3339String() : null, 'lastPostNumber' => $discussion->last_post_number, 'canReply' => $discussion->can($user, 'reply'), - 'canEdit' => $discussion->can($user, 'edit'), + 'canRename' => $discussion->can($user, 'rename'), 'canDelete' => $discussion->can($user, 'delete'), 'readTime' => $state && $state->read_time ? $state->read_time->toRFC3339String() : null,