Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 4cbe662

Browse files
committed
Add a confirmation when ignoring a user
Fixes element-hq/element-web#14746 Doesn't apply when un-ignoring.
1 parent 5f8aeca commit 4cbe662

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/components/views/right_panel/UserInfo.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,15 +373,25 @@ const UserOptionsSection: React.FC<{
373373
// Only allow the user to ignore the user if its not ourselves
374374
// same goes for jumping to read receipt
375375
if (!isMe) {
376-
const onIgnoreToggle = () => {
376+
const onIgnoreToggle = async () => {
377377
const ignoredUsers = cli.getIgnoredUsers();
378378
if (isIgnored) {
379379
const index = ignoredUsers.indexOf(member.userId);
380380
if (index !== -1) ignoredUsers.splice(index, 1);
381381
} else {
382+
// ask the user to confirm
383+
const [accepted] = await Modal.createTrackedDialog("Confirm Ignore User", "", QuestionDialog, {
384+
title: _t("Do you want to ignore this user?"),
385+
description: _t(
386+
"You won't see messages from %(targetName)s anymore. Are you sure you want to ignore them?",
387+
{ targetName: member.name },
388+
),
389+
}).finished;
390+
if (!accepted) return;
382391
ignoredUsers.push(member.userId);
383392
}
384393

394+
// noinspection ES6MissingAwait
385395
cli.setIgnoredUsers(ignoredUsers);
386396
};
387397

src/i18n/strings/en_EN.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2008,6 +2008,8 @@
20082008
"%(count)s sessions|one": "%(count)s session",
20092009
"Hide sessions": "Hide sessions",
20102010
"Message": "Message",
2011+
"Do you want to ignore this user?": "Do you want to ignore this user?",
2012+
"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?",
20112013
"Jump to read receipt": "Jump to read receipt",
20122014
"Mention": "Mention",
20132015
"Share Link to User": "Share Link to User",

0 commit comments

Comments
 (0)