mirror of
https://github.com/element-hq/element-web
synced 2024-11-24 18:25:49 +03:00
Add unresponsive /ignore and /unignore commands
Signed-off-by: Travis Ralston <travpc@gmail.com>
This commit is contained in:
parent
2bc866b997
commit
2d517079d9
1 changed files with 29 additions and 0 deletions
|
@ -240,6 +240,35 @@ const commands = {
|
|||
return reject(this.getUsage());
|
||||
}),
|
||||
|
||||
ignore: new Command("ignore", "<userId>", function(roomId, args) {
|
||||
if (args) {
|
||||
const matches = args.match(/^(\S+)$/);
|
||||
if (matches) {
|
||||
const ignoredUsers = MatrixClientPeg.get().getIgnoredUsers();
|
||||
ignoredUsers.push(matches[1]); // de-duped internally below
|
||||
return success(
|
||||
MatrixClientPeg.get().setIgnoredUsers(ignoredUsers),
|
||||
);
|
||||
}
|
||||
}
|
||||
return reject(this.getUsage());
|
||||
}),
|
||||
|
||||
unignore: new Command("unignore", "<userId>", function(roomId, args) {
|
||||
if (args) {
|
||||
const matches = args.match(/^(\S+)$/);
|
||||
if (matches) {
|
||||
const ignoredUsers = MatrixClientPeg.get().getIgnoredUsers();
|
||||
const index = ignoredUsers.indexOf(matches[1]);
|
||||
if (index !== -1) ignoredUsers.splice(index, 1);
|
||||
return success(
|
||||
MatrixClientPeg.get().setIgnoredUsers(ignoredUsers),
|
||||
);
|
||||
}
|
||||
}
|
||||
return reject(this.getUsage());
|
||||
}),
|
||||
|
||||
// Define the power level of a user
|
||||
op: new Command("op", "<userId> [<power level>]", function(roomId, args) {
|
||||
if (args) {
|
||||
|
|
Loading…
Reference in a new issue