mirror of
https://github.com/flarum/framework.git
synced 2024-11-30 13:36:10 +08:00
Added simply confirmation popup for hiding / deleting posts (#2135)
This commit is contained in:
parent
d31a747631
commit
b38bd60362
|
@ -2,6 +2,7 @@ import EditPostComposer from '../components/EditPostComposer';
|
||||||
import Button from '../../common/components/Button';
|
import Button from '../../common/components/Button';
|
||||||
import Separator from '../../common/components/Separator';
|
import Separator from '../../common/components/Separator';
|
||||||
import ItemList from '../../common/utils/ItemList';
|
import ItemList from '../../common/utils/ItemList';
|
||||||
|
import extractText from '../../common/utils/extractText';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The `PostControls` utility constructs a list of buttons for a post which
|
* The `PostControls` utility constructs a list of buttons for a post which
|
||||||
|
@ -145,6 +146,7 @@ export default {
|
||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
*/
|
*/
|
||||||
hideAction() {
|
hideAction() {
|
||||||
|
if (!confirm(extractText(app.translator.trans('core.forum.post_controls.hide_confirmation')))) return;
|
||||||
this.pushAttributes({ hiddenAt: new Date(), hiddenUser: app.session.user });
|
this.pushAttributes({ hiddenAt: new Date(), hiddenUser: app.session.user });
|
||||||
|
|
||||||
return this.save({ isHidden: true }).then(() => m.redraw());
|
return this.save({ isHidden: true }).then(() => m.redraw());
|
||||||
|
@ -167,6 +169,7 @@ export default {
|
||||||
* @return {Promise}
|
* @return {Promise}
|
||||||
*/
|
*/
|
||||||
deleteAction(context) {
|
deleteAction(context) {
|
||||||
|
if (!confirm(extractText(app.translator.trans('core.forum.post_controls.delete_confirmation')))) return;
|
||||||
if (context) context.loading = true;
|
if (context) context.loading = true;
|
||||||
|
|
||||||
return this.delete()
|
return this.delete()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user