Give feedback for /ignore and /unignore

Signed-off-by: Travis Ralston <travpc@gmail.com>
This commit is contained in:
Travis Ralston 2017-09-14 16:21:36 -06:00
parent 2d517079d9
commit 13a251e29c
3 changed files with 36 additions and 4 deletions

View File

@ -244,10 +244,22 @@ const commands = {
if (args) {
const matches = args.match(/^(\S+)$/);
if (matches) {
const userId = matches[1];
const ignoredUsers = MatrixClientPeg.get().getIgnoredUsers();
ignoredUsers.push(matches[1]); // de-duped internally below
ignoredUsers.push(userId); // de-duped internally below
return success(
MatrixClientPeg.get().setIgnoredUsers(ignoredUsers),
MatrixClientPeg.get().setIgnoredUsers(ignoredUsers).then(() => {
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
Modal.createTrackedDialog('Slash Commands', 'User ignored', QuestionDialog, {
title: _t("Ignored user"),
description: (
<div>
<p>{_t("You are now ignoring %(userId)s", {userId: userId})}</p>
</div>
),
hasCancelButton: false,
});
}),
);
}
}
@ -258,11 +270,23 @@ const commands = {
if (args) {
const matches = args.match(/^(\S+)$/);
if (matches) {
const userId = matches[1];
const ignoredUsers = MatrixClientPeg.get().getIgnoredUsers();
const index = ignoredUsers.indexOf(matches[1]);
const index = ignoredUsers.indexOf(userId);
if (index !== -1) ignoredUsers.splice(index, 1);
return success(
MatrixClientPeg.get().setIgnoredUsers(ignoredUsers),
MatrixClientPeg.get().setIgnoredUsers(ignoredUsers).then(() => {
const QuestionDialog = sdk.getComponent("dialogs.QuestionDialog");
Modal.createTrackedDialog('Slash Commands', 'User unignored', QuestionDialog, {
title: _t("Unignored user"),
description: (
<div>
<p>{_t("You are no longer ignoring %(userId)s", {userId: userId})}</p>
</div>
),
hasCancelButton: false,
});
}),
);
}
}

View File

@ -266,6 +266,10 @@
"Labs": "Labs",
"Ignored Users": "Ignored Users",
"Unignore": "Unignore",
"You are now ignoring %(userId)s": "You are now ignoring %(userId)s",
"You are no longer ignoring %(userId)s": "You are no longer ignoring %(userId)s",
"Unignored user": "Unignored user",
"Ignored user": "Ignored user",
"Last seen": "Last seen",
"Leave room": "Leave room",
"left and rejoined": "left and rejoined",

View File

@ -233,6 +233,10 @@
"Labs": "Labs",
"Ignored Users": "Ignored Users",
"Unignore": "Unignore",
"You are now ignoring %(userId)s": "You are now ignoring %(userId)s",
"You are no longer ignoring %(userId)s": "You are no longer ignoring %(userId)s",
"Unignored user": "Unignored user",
"Ignored user": "Ignored user",
"Leave room": "Leave room",
"left and rejoined": "left and rejoined",
"left": "left",