Skip to content

Commit

Permalink
Add a confirmation when ignoring a user
Browse files Browse the repository at this point in the history
Fixes element-hq/element-web#14746

Doesn't apply when un-ignoring.
  • Loading branch information
turt2live committed May 17, 2022
1 parent 5f8aeca commit 4cbe662
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/components/views/right_panel/UserInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -373,15 +373,25 @@ const UserOptionsSection: React.FC<{
// Only allow the user to ignore the user if its not ourselves
// same goes for jumping to read receipt
if (!isMe) {
const onIgnoreToggle = () => {
const onIgnoreToggle = async () => {
const ignoredUsers = cli.getIgnoredUsers();
if (isIgnored) {
const index = ignoredUsers.indexOf(member.userId);
if (index !== -1) ignoredUsers.splice(index, 1);
} else {
// ask the user to confirm
const [accepted] = await Modal.createTrackedDialog("Confirm Ignore User", "", QuestionDialog, {
title: _t("Do you want to ignore this user?"),
description: _t(
"You won't see messages from %(targetName)s anymore. Are you sure you want to ignore them?",
{ targetName: member.name },
),
}).finished;
if (!accepted) return;
ignoredUsers.push(member.userId);
}

// noinspection ES6MissingAwait
cli.setIgnoredUsers(ignoredUsers);
};

Expand Down
2 changes: 2 additions & 0 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -2008,6 +2008,8 @@
"%(count)s sessions|one": "%(count)s session",
"Hide sessions": "Hide sessions",
"Message": "Message",
"Do you want to ignore this user?": "Do you want to ignore this user?",
"You won't see messages from %(targetName)s anymore. Are you sure you want to ignore them?": "You won't see messages from %(targetName)s anymore. Are you sure you want to ignore them?",
"Jump to read receipt": "Jump to read receipt",
"Mention": "Mention",
"Share Link to User": "Share Link to User",
Expand Down

0 comments on commit 4cbe662

Please sign in to comment.