1
0
mirror of https://github.com/flarum/core.git synced 2025-07-20 08:11:27 +02:00

Allow discussions to be hidden and restored

This commit is contained in:
Toby Zerner
2015-09-22 17:48:21 +09:30
parent c7ed189cf3
commit 264725d872
19 changed files with 321 additions and 23 deletions

View File

@@ -114,25 +114,34 @@ export default {
/**
* Hide a post.
*
* @return {Promise}
*/
hideAction() {
this.save({ isHidden: true });
this.pushAttributes({ hideTime: new Date(), hideUser: app.session.user });
return this.save({ isHidden: true }).then(() => m.redraw());
},
/**
* Restore a post.
*
* @return {Promise}
*/
restoreAction() {
this.save({ isHidden: false });
this.pushAttributes({ hideTime: null, hideUser: null });
return this.save({ isHidden: false }).then(() => m.redraw());
},
/**
* Delete a post.
*
* @return {Promise}
*/
deleteAction() {
this.delete();
this.discussion().removePost(this.id());
return this.delete();
}
};