1
0
mirror of https://github.com/flarum/core.git synced 2025-07-20 16:21:18 +02: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:
Toby Zerner
2015-06-23 10:34:33 +09:30
parent dfe1a9bae5
commit 3223f65ce3
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) }));
}