Allow /blockpms to block locked and semilocked users (#5923)

This commit is contained in:
Lusamine
2019-10-31 22:04:52 -05:00
committed by Guangcong Luo
parent c2d71d43f7
commit 684b03e2f3
2 changed files with 3 additions and 2 deletions

View File

@@ -679,7 +679,7 @@ const commands = {
if (target in Config.groups) {
user.blockPMs = target;
this.sendReply(`You are now blocking private messages, except from staff and ${target}.`);
} else if (target === 'autoconfirmed' || target === 'trusted') {
} else if (target === 'autoconfirmed' || target === 'trusted' || target === 'unlocked') {
user.blockPMs = target;
this.sendReply(`You are now blocking private messages, except from staff and ${target} users.`);
} else {
@@ -691,7 +691,7 @@ const commands = {
},
blockpmshelp: [
`/blockpms - Blocks private messages except from staff. Unblock them with /unblockpms.`,
`/blockpms [ac/trusted/+] - Blocks private messages except from staff and the specified group.`,
`/blockpms [unlocked/ac/trusted/+] - Blocks private messages except from staff and the specified group.`,
],
'!unblockpms': true,

View File

@@ -623,6 +623,7 @@ export class User extends Chat.MessageContext {
}
authAtLeast(minAuth: string, room: BasicChatRoom | null = null) {
if (!minAuth || minAuth === ' ') return true;
if (minAuth === 'unlocked') return !(this.locked || this.semilocked);
if (minAuth === 'trusted' && this.trusted) return true;
if (minAuth === 'autoconfirmed' && this.autoconfirmed) return true;