Skip to content

Commit 5d11114

Browse files
authored
Remove --true flag for unban command (#653)
Closes #648 by making `--true` the default behaviour. --------- Signed-off-by: nexy7574 <[email protected]>
1 parent 218d7cd commit 5d11114

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

src/commands/Unban.ts

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ export type DraupnirUnbanCommandContext = {
101101
};
102102

103103
export const DraupnirUnbanCommand = describeCommand({
104-
summary:
105-
"Removes an entity from a policy list. If the entity is a glob, then the flag --true must be provided to unban users matching the glob from all protected rooms.",
104+
summary: "Removes an entity from a policy list.",
106105
parameters: tuple(
107106
{
108107
name: "entity",
@@ -132,10 +131,14 @@ export const DraupnirUnbanCommand = describeCommand({
132131
},
133132
}
134133
),
134+
// This is a legacy option to unban the user from all rooms that we now ignore just so providing the option doesn't
135+
// cause an error.
135136
keywords: {
136137
keywordDescriptions: {
137138
true: {
138139
isFlag: true,
140+
description:
141+
"Legacy, now redundant option to unban the user from all rooms.",
139142
},
140143
},
141144
},
@@ -153,7 +156,6 @@ export const DraupnirUnbanCommand = describeCommand({
153156
issuerManager,
154157
clientUserID,
155158
unlistedUserRedactionQueue,
156-
managementRoomOutput,
157159
} = context;
158160
const policyRoomReference =
159161
typeof policyRoomDesignator === "string"
@@ -200,24 +202,11 @@ export const DraupnirUnbanCommand = describeCommand({
200202
}
201203
if (typeof entity === "string" || entity instanceof MatrixUserID) {
202204
const rawEnttiy = typeof entity === "string" ? entity : entity.toString();
203-
const isGlob = (string: string) =>
204-
string.includes("*") ? true : string.includes("?");
205205
const rule = new MatrixGlob(entity.toString());
206206
if (isStringUserID(rawEnttiy)) {
207207
unlistedUserRedactionQueue.removeUser(rawEnttiy);
208208
}
209-
if (
210-
!isGlob(rawEnttiy) ||
211-
keywords.getKeywordValue<boolean>("true", false)
212-
) {
213-
await unbanUserFromRooms(context, rule);
214-
} else {
215-
await managementRoomOutput.logMessage(
216-
LogLevel.WARN,
217-
"Unban",
218-
"Running unban without `unban <list> <user> true` will not override existing room level bans"
219-
);
220-
}
209+
await unbanUserFromRooms(context, rule);
221210
}
222211
return Ok(undefined);
223212
},

0 commit comments

Comments
 (0)