mirror of
https://github.com/flarum/framework.git
synced 2025-05-23 23:29:57 +08:00
Allow author to delete discussion if there are no replies
Also disallow the first post in a discussion to be deleted or hidden (thus preventing discussions with zero posts) closes flarum/core#90 closes flarum/core#92
This commit is contained in:
@ -37,11 +37,14 @@ export default function(app) {
|
||||
items.add('restore', ActionButton.component({ icon: 'reply', label: 'Restore', onclick: restoreAction.bind(this) }));
|
||||
} else {
|
||||
items.add('edit', ActionButton.component({ icon: 'pencil', label: 'Edit', onclick: editAction.bind(this) }));
|
||||
items.add('hide', ActionButton.component({ icon: 'times', label: 'Delete', onclick: hideAction.bind(this) }));
|
||||
|
||||
if (this.number() != 1) {
|
||||
items.add('hide', ActionButton.component({ icon: 'times', label: 'Delete', onclick: hideAction.bind(this) }));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((this.contentType() !== 'comment' || this.isHidden()) && this.canDelete()) {
|
||||
if ((this.contentType() !== 'comment' || this.isHidden()) && this.canDelete() && this.number() != 1) {
|
||||
items.add('delete', ActionButton.component({ icon: 'times', label: 'Delete', onclick: deleteAction.bind(this) }));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user