mirror of
https://github.com/vector-im/element-web.git
synced 2025-12-25 19:21:18 +01:00
Make it work
This commit is contained in:
parent
b934d6b290
commit
527b44bb7a
@ -72,10 +72,10 @@ export const useBanButtonViewModel = (props: RoomAdminToolsProps): BanButtonStat
|
||||
};
|
||||
|
||||
const msc4333Config = cli.msc4333Moderation.getModerationConfigFor(props.room.roomId);
|
||||
if (msc4333Config) {
|
||||
commonProps["children"] = [<p key={1}>Test</p>];
|
||||
if (msc4333Config && !isBanned) {
|
||||
const managementRoom = cli.getRoom(msc4333Config.managementRoomId);
|
||||
commonProps["children"] = [<p key={1}>You are banning this user using {managementRoom?.name} (via {msc4333Config.botUserId}).</p>];
|
||||
}
|
||||
console.log(msc4333Config);
|
||||
|
||||
let finished: Promise<[success?: boolean, reason?: string, rooms?: Room[]]>;
|
||||
|
||||
@ -127,10 +127,18 @@ export const useBanButtonViewModel = (props: RoomAdminToolsProps): BanButtonStat
|
||||
}
|
||||
|
||||
const fn = (roomId: string): Promise<unknown> => {
|
||||
if (isBanned) {
|
||||
return cli.unban(roomId, member.userId);
|
||||
} else {
|
||||
return cli.ban(roomId, member.userId, reason || undefined);
|
||||
try {
|
||||
if (isBanned) {
|
||||
return cli.unban(roomId, member.userId);
|
||||
} else {
|
||||
if (msc4333Config) {
|
||||
return cli.sendMessage(msc4333Config.managementRoomId, msc4333Config.banCommand.render(member.userId, roomId, reason || ""))
|
||||
}
|
||||
return cli.ban(roomId, member.userId, reason || undefined);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
throw e; // re-throw
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user