Skip to content

Commit

Permalink
Added simply confirmation popup for hiding / deleting posts (#2135)
Browse files Browse the repository at this point in the history
  • Loading branch information
askvortsov1 authored and luceos committed May 7, 2020
1 parent d31a747 commit b38bd60
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions js/src/forum/utils/PostControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import EditPostComposer from '../components/EditPostComposer';
import Button from '../../common/components/Button';
import Separator from '../../common/components/Separator';
import ItemList from '../../common/utils/ItemList';
import extractText from '../../common/utils/extractText';

/**
* The `PostControls` utility constructs a list of buttons for a post which
Expand Down Expand Up @@ -145,6 +146,7 @@ export default {
* @return {Promise}
*/
hideAction() {
if (!confirm(extractText(app.translator.trans('core.forum.post_controls.hide_confirmation')))) return;
this.pushAttributes({ hiddenAt: new Date(), hiddenUser: app.session.user });

return this.save({ isHidden: true }).then(() => m.redraw());
Expand All @@ -167,6 +169,7 @@ export default {
* @return {Promise}
*/
deleteAction(context) {
if (!confirm(extractText(app.translator.trans('core.forum.post_controls.delete_confirmation')))) return;
if (context) context.loading = true;

return this.delete()
Expand Down

0 comments on commit b38bd60

Please sign in to comment.