mirror of
https://github.com/flarum/framework.git
synced 2024-12-13 07:03:35 +08:00
Make discussion edit permission specific to renaming
This commit is contained in:
parent
8aea1d1051
commit
9004aff630
|
@ -67,7 +67,7 @@ export default function(app) {
|
||||||
items.add('separator', Separator.component());
|
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) }));
|
items.add('rename', ActionButton.component({ icon: 'pencil', label: 'Rename', onclick: this.renameAction.bind(this) }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ Discussion.prototype.lastPost = Model.one('lastPost');
|
||||||
Discussion.prototype.lastPostNumber = Model.prop('lastPostNumber');
|
Discussion.prototype.lastPostNumber = Model.prop('lastPostNumber');
|
||||||
|
|
||||||
Discussion.prototype.canReply = Model.prop('canReply');
|
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.canDelete = Model.prop('canDelete');
|
||||||
|
|
||||||
Discussion.prototype.commentsCount = Model.prop('commentsCount');
|
Discussion.prototype.commentsCount = Model.prop('commentsCount');
|
||||||
|
|
|
@ -28,7 +28,7 @@ class DiscussionSerializer extends DiscussionBasicSerializer
|
||||||
'lastTime' => $discussion->last_time ? $discussion->last_time->toRFC3339String() : null,
|
'lastTime' => $discussion->last_time ? $discussion->last_time->toRFC3339String() : null,
|
||||||
'lastPostNumber' => $discussion->last_post_number,
|
'lastPostNumber' => $discussion->last_post_number,
|
||||||
'canReply' => $discussion->can($user, 'reply'),
|
'canReply' => $discussion->can($user, 'reply'),
|
||||||
'canEdit' => $discussion->can($user, 'edit'),
|
'canRename' => $discussion->can($user, 'rename'),
|
||||||
'canDelete' => $discussion->can($user, 'delete'),
|
'canDelete' => $discussion->can($user, 'delete'),
|
||||||
|
|
||||||
'readTime' => $state && $state->read_time ? $state->read_time->toRFC3339String() : null,
|
'readTime' => $state && $state->read_time ? $state->read_time->toRFC3339String() : null,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user