mirror of
https://github.com/the-draupnir-project/Draupnir.git
synced 2026-10-23 01:21:16 +00:00
Update commands for removal of MPS managerManager.
This commit is contained in:
1 parent
fa499a49c3
commit
8d8cb0fe40
6 files changed
+11
-11
No files matched your search
@@ -43,7 +43,7 @@ export async function findPolicyRoomEditorFromRoomReference(draupnir: Draupnir,
|
||||
if (isError(policyRoomID)) {
|
||||
return policyRoomID;
|
||||
}
|
||||
return await draupnir.managerManager.policyRoomManager.getPolicyRoomEditor(policyRoomID.ok);
|
||||
return await draupnir.policyRoomManager.getPolicyRoomEditor(policyRoomID.ok);
|
||||
}
|
||||
|
||||
async function ban(
|
||||
@@ -97,7 +97,7 @@ defineInterfaceCommand({
|
||||
),
|
||||
prompt: async function (this: DraupnirContext, _parameter: ParameterDescription): Promise<PromptOptions> {
|
||||
return {
|
||||
suggestions: this.draupnir.managerManager.policyRoomManager.getEditablePolicyRoomIDs(
|
||||
suggestions: this.draupnir.policyRoomManager.getEditablePolicyRoomIDs(
|
||||
this.draupnir.clientUserID,
|
||||
PolicyRuleType.User
|
||||
)
|
||||
|
||||
@@ -39,7 +39,7 @@ export async function createList(
|
||||
alias: MatrixRoomAlias,
|
||||
...reasonParts: string[]
|
||||
): Promise<ActionResult<MatrixRoomID>> {
|
||||
const newList = await this.draupnir.managerManager.policyRoomManager.createPolicyRoom(
|
||||
const newList = await this.draupnir.policyRoomManager.createPolicyRoom(
|
||||
shortcode,
|
||||
[this.event.sender],
|
||||
{
|
||||
|
||||
@@ -47,7 +47,7 @@ export async function importCommand(
|
||||
if (isError(policyRoom)) {
|
||||
return policyRoom;
|
||||
}
|
||||
const policyRoomEditor = await this.draupnir.managerManager.policyRoomManager.getPolicyRoomEditor(
|
||||
const policyRoomEditor = await this.draupnir.policyRoomManager.getPolicyRoomEditor(
|
||||
policyRoom.ok
|
||||
);
|
||||
if (isError(policyRoomEditor)) {
|
||||
|
||||
@@ -62,7 +62,7 @@ export interface StatusInfo {
|
||||
export async function listInfo(draupnir: Draupnir): Promise<ListInfo[]> {
|
||||
const watchedListProfiles = draupnir.protectedRoomsSet.issuerManager.allWatchedLists;
|
||||
const issuerResults = await Promise.all(watchedListProfiles.map((profile) =>
|
||||
draupnir.managerManager.policyRoomManager.getPolicyRoomRevisionIssuer(profile.room)
|
||||
draupnir.policyRoomManager.getPolicyRoomRevisionIssuer(profile.room)
|
||||
));
|
||||
return issuerResults.map((result) => {
|
||||
if (isError(result)) {
|
||||
|
||||
@@ -64,7 +64,7 @@ async function unban(
|
||||
if (isError(policyRoom)) {
|
||||
return policyRoom;
|
||||
}
|
||||
const policyRoomEditor = await this.draupnir.managerManager.policyRoomManager.getPolicyRoomEditor(
|
||||
const policyRoomEditor = await this.draupnir.policyRoomManager.getPolicyRoomEditor(
|
||||
policyRoom.ok
|
||||
);
|
||||
if (isError(policyRoomEditor)) {
|
||||
@@ -120,7 +120,7 @@ defineInterfaceCommand({
|
||||
),
|
||||
prompt: async function (this: DraupnirContext) {
|
||||
return {
|
||||
suggestions: this.draupnir.managerManager.policyRoomManager.getEditablePolicyRoomIDs(
|
||||
suggestions: this.draupnir.policyRoomManager.getEditablePolicyRoomIDs(
|
||||
this.draupnir.clientUserID,
|
||||
PolicyRuleType.User
|
||||
)
|
||||
|
||||
@@ -67,7 +67,7 @@ async function promptBanPropagation(
|
||||
draupnir: Draupnir,
|
||||
change: MembershipChange,
|
||||
): Promise<void> {
|
||||
const editablePolicyRoomIDs = draupnir.managerManager.policyRoomManager.getEditablePolicyRoomIDs(
|
||||
const editablePolicyRoomIDs = draupnir.policyRoomManager.getEditablePolicyRoomIDs(
|
||||
draupnir.clientUserID,
|
||||
PolicyRuleType.User
|
||||
);
|
||||
@@ -211,7 +211,7 @@ export class BanPropagationProtection extends AbstractProtection implements Drau
|
||||
log.error(`Could not resolve the room reference for the policy list to ban a user within ${policyRoomRef.ok.toPermalink()}`, roomID.error);
|
||||
return;
|
||||
}
|
||||
const listResult = await this.draupnir.managerManager.policyRoomManager.getPolicyRoomEditor(roomID.ok)
|
||||
const listResult = await this.draupnir.policyRoomManager.getPolicyRoomEditor(roomID.ok)
|
||||
if (isError(listResult)) {
|
||||
log.error(`Could not find a policy list for the policy room ${policyRoomRef.ok.toPermalink()}`, listResult.error);
|
||||
return;
|
||||
@@ -233,7 +233,7 @@ export class BanPropagationProtection extends AbstractProtection implements Drau
|
||||
const policyRevision = this.protectedRoomsSet.issuerManager.policyListRevisionIssuer.currentRevision;
|
||||
const rulesMatchingUser = policyRevision.allRulesMatchingEntity(context.target, PolicyRuleType.User, Recommendation.Ban);
|
||||
const listsWithRules = new Set<StringRoomID>(rulesMatchingUser.map((rule) => rule.sourceEvent.room_id));
|
||||
const editablePolicyRooms = this.draupnir.managerManager.policyRoomManager.getEditablePolicyRoomIDs(this.draupnir.clientUserID, PolicyRuleType.User);
|
||||
const editablePolicyRooms = this.draupnir.policyRoomManager.getEditablePolicyRoomIDs(this.draupnir.clientUserID, PolicyRuleType.User);
|
||||
for (const roomIDWithPolicy of listsWithRules) {
|
||||
const editablePolicyRoom = editablePolicyRooms.find((room) => room.toRoomIDOrAlias() === roomIDWithPolicy);
|
||||
if (editablePolicyRoom === undefined) {
|
||||
@@ -241,7 +241,7 @@ export class BanPropagationProtection extends AbstractProtection implements Drau
|
||||
errors.push(new PermissionError(roomID, `${this.draupnir.clientUserID} doesn't have the power level to remove the policy banning ${context.target} within ${roomID.toPermalink()}`));
|
||||
continue;
|
||||
}
|
||||
const editorResult = await this.draupnir.managerManager.policyRoomManager.getPolicyRoomEditor(editablePolicyRoom);
|
||||
const editorResult = await this.draupnir.policyRoomManager.getPolicyRoomEditor(editablePolicyRoom);
|
||||
if (isError(editorResult)) {
|
||||
errors.push(RoomActionError.fromActionError(editablePolicyRoom, editorResult.error));
|
||||
continue;
|
||||
|
||||
Reference in new issue
Block a user