Merge pull request #4389 from matrix-org/t3chguy/deop_fail
op/deop return error if trying to affect an unknown userpull/21833/head
commit
e5d4ab9fdb
|
@ -350,7 +350,7 @@ export const Commands = [
|
||||||
return success(cli.setRoomTopic(roomId, args));
|
return success(cli.setRoomTopic(roomId, args));
|
||||||
}
|
}
|
||||||
const room = cli.getRoom(roomId);
|
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 topicEvents = room.currentState.getStateEvents('m.room.topic', '');
|
||||||
const topic = topicEvents && topicEvents.getContent().topic;
|
const topic = topicEvents && topicEvents.getContent().topic;
|
||||||
|
@ -721,9 +721,10 @@ export const Commands = [
|
||||||
if (!isNaN(powerLevel)) {
|
if (!isNaN(powerLevel)) {
|
||||||
const cli = MatrixClientPeg.get();
|
const cli = MatrixClientPeg.get();
|
||||||
const room = cli.getRoom(roomId);
|
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', '');
|
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));
|
return success(cli.setPowerLevel(roomId, userId, powerLevel, powerLevelEvent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -742,9 +743,10 @@ export const Commands = [
|
||||||
if (matches) {
|
if (matches) {
|
||||||
const cli = MatrixClientPeg.get();
|
const cli = MatrixClientPeg.get();
|
||||||
const room = cli.getRoom(roomId);
|
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', '');
|
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));
|
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 this current room only": "Changes your avatar in this current room only",
|
||||||
"Changes your avatar in all rooms": "Changes your avatar in all rooms",
|
"Changes your avatar in all rooms": "Changes your avatar in all rooms",
|
||||||
"Gets or sets the room topic": "Gets or sets the room topic",
|
"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.",
|
"This room has no topic.": "This room has no topic.",
|
||||||
"Sets the room name": "Sets the room name",
|
"Sets the room name": "Sets the room name",
|
||||||
"Invites user with given id to current room": "Invites user with given id to current room",
|
"Invites user with given id to current room": "Invites user with given id to current room",
|
||||||
|
@ -196,6 +197,8 @@
|
||||||
"Unignored user": "Unignored user",
|
"Unignored user": "Unignored user",
|
||||||
"You are no longer ignoring %(userId)s": "You are no longer ignoring %(userId)s",
|
"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",
|
"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",
|
"Deops user with given id": "Deops user with given id",
|
||||||
"Opens the Developer Tools dialog": "Opens the Developer Tools dialog",
|
"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",
|
"Adds a custom widget by URL to the room": "Adds a custom widget by URL to the room",
|
||||||
|
|
Loading…
Reference in New Issue