Banning a user now automatically hides all their posts
This commit is contained in:
@@ -40,6 +40,11 @@
|
||||
v-model="hero.auth.blocked"
|
||||
type="checkbox"
|
||||
> Ban / Block
|
||||
<p>
|
||||
<small>
|
||||
Banning a user also auto-hides all their guild posts.
|
||||
</small>
|
||||
</p>
|
||||
</label>
|
||||
</div>
|
||||
<div class="form-inline">
|
||||
|
||||
@@ -1028,9 +1028,10 @@ export default {
|
||||
this.$store.dispatch('hall:updateHero', { heroDetails: this.hero });
|
||||
},
|
||||
adminBlockUser () {
|
||||
this.hero.auth.blocked = true;
|
||||
|
||||
this.$store.dispatch('hall:updateHero', { heroDetails: this.hero });
|
||||
if (window.confirm('Ban user and auto-hide all posts?')) {
|
||||
this.hero.auth.blocked = true;
|
||||
this.$store.dispatch('hall:updateHero', { heroDetails: this.hero });
|
||||
}
|
||||
},
|
||||
adminUnblockUser () {
|
||||
this.hero.auth.blocked = false;
|
||||
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
NotFound,
|
||||
} from '../../libs/errors';
|
||||
import apiError from '../../libs/apiError';
|
||||
import { flagAllMessages } from '../../libs/chat/group-chat';
|
||||
import {
|
||||
validateItemPath,
|
||||
castItemVal,
|
||||
@@ -336,6 +337,7 @@ api.updateHero = {
|
||||
if (updateData.auth && updateData.auth.blocked === true) {
|
||||
hero.auth.blocked = updateData.auth.blocked;
|
||||
hero.preferences.sleep = true; // when blocking, have them rest at an inn to prevent damage
|
||||
await flagAllMessages(hero);
|
||||
}
|
||||
if (updateData.auth && updateData.auth.blocked === false) {
|
||||
hero.auth.blocked = false;
|
||||
|
||||
@@ -114,3 +114,9 @@ export function translateMessage (lang, info) {
|
||||
}
|
||||
return msg;
|
||||
}
|
||||
|
||||
export async function flagAllMessages (user) {
|
||||
const bulk = Chat.collection.initializeOrderedBulkOp();
|
||||
bulk.find({ uuid: user._id }).update({ $set: { flagCount: 3 } });
|
||||
await bulk.execute();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user