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:
Toby Zerner
2015-06-23 10:34:33 +09:30
parent 3a7efe202e
commit 64e5d50533
8 changed files with 80 additions and 30 deletions

View File

@ -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) }));
}