mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 13:14:58 +08:00
op/deop return error if trying to affect an unknown user
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
c000583099
commit
6d33138950
@ -350,7 +350,7 @@ export const Commands = [
|
||||
return success(cli.setRoomTopic(roomId, args));
|
||||
}
|
||||
const room = cli.getRoom(roomId);
|
||||
if (!room) return reject('Bad room ID: ' + roomId);
|
||||
if (!room) return reject(_t("Failed to set topic"));
|
||||
|
||||
const topicEvents = room.currentState.getStateEvents('m.room.topic', '');
|
||||
const topic = topicEvents && topicEvents.getContent().topic;
|
||||
@ -721,9 +721,10 @@ export const Commands = [
|
||||
if (!isNaN(powerLevel)) {
|
||||
const cli = MatrixClientPeg.get();
|
||||
const room = cli.getRoom(roomId);
|
||||
if (!room) return reject('Bad room ID: ' + roomId);
|
||||
if (!room) return reject(_t("Command failed"));
|
||||
|
||||
const powerLevelEvent = room.currentState.getStateEvents('m.room.power_levels', '');
|
||||
if (!powerLevelEvent.getContent().users[args]) return reject(_t("Could not find user in room"));
|
||||
return success(cli.setPowerLevel(roomId, userId, powerLevel, powerLevelEvent));
|
||||
}
|
||||
}
|
||||
@ -742,9 +743,10 @@ export const Commands = [
|
||||
if (matches) {
|
||||
const cli = MatrixClientPeg.get();
|
||||
const room = cli.getRoom(roomId);
|
||||
if (!room) return reject('Bad room ID: ' + roomId);
|
||||
if (!room) return reject(_t("Command failed"));
|
||||
|
||||
const powerLevelEvent = room.currentState.getStateEvents('m.room.power_levels', '');
|
||||
if (!powerLevelEvent.getContent().users[args]) return reject(_t("Could not find user in room"));
|
||||
return success(cli.setPowerLevel(roomId, args, undefined, powerLevelEvent));
|
||||
}
|
||||
}
|
||||
|
@ -177,6 +177,7 @@
|
||||
"Changes your avatar in this current room only": "Changes your avatar in this current room only",
|
||||
"Changes your avatar in all rooms": "Changes your avatar in all rooms",
|
||||
"Gets or sets the room topic": "Gets or sets the room topic",
|
||||
"Failed to set topic": "Failed to set topic",
|
||||
"This room has no topic.": "This room has no topic.",
|
||||
"Sets the room name": "Sets the room name",
|
||||
"Invites user with given id to current room": "Invites user with given id to current room",
|
||||
@ -196,6 +197,8 @@
|
||||
"Unignored user": "Unignored user",
|
||||
"You are no longer ignoring %(userId)s": "You are no longer ignoring %(userId)s",
|
||||
"Define the power level of a user": "Define the power level of a user",
|
||||
"Command failed": "Command failed",
|
||||
"Could not find user in room": "Could not find user in room",
|
||||
"Deops user with given id": "Deops user with given id",
|
||||
"Opens the Developer Tools dialog": "Opens the Developer Tools dialog",
|
||||
"Adds a custom widget by URL to the room": "Adds a custom widget by URL to the room",
|
||||
|
Loading…
Reference in New Issue
Block a user