From c0b30ea4efef88c154ac8b1dc9818325d71b076e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Tue, 27 Aug 2024 10:23:21 -0400 Subject: [PATCH] fix: closes #12758, show different error message for block --- public/language/en-GB/error.json | 1 + src/messaging/index.js | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/public/language/en-GB/error.json b/public/language/en-GB/error.json index d849187bae..c8d52acb6e 100644 --- a/public/language/en-GB/error.json +++ b/public/language/en-GB/error.json @@ -179,6 +179,7 @@ "cant-chat-with-yourself": "You can't chat with yourself!", "chat-restricted": "This user has restricted their chat messages. They must follow you before you can chat with them", + "chat-user-blocked": "You have been blocked by this user.", "chat-disabled": "Chat system disabled", "too-many-messages": "You have sent too many messages, please wait awhile.", "invalid-chat-message": "Invalid chat message", diff --git a/src/messaging/index.js b/src/messaging/index.js index 7a2cd617a6..eda2bd4ac0 100644 --- a/src/messaging/index.js +++ b/src/messaging/index.js @@ -363,7 +363,10 @@ Messaging.canMessageUser = async (uid, toUid) => { user.blocks.is(uid, toUid), ]); - if (isBlocked || (settings.restrictChat && !isAdmin && !isModerator && !isFollowing)) { + if (isBlocked) { + throw new Error('[[error:chat-user-blocked]]'); + } + if (settings.restrictChat && !isAdmin && !isModerator && !isFollowing) { throw new Error('[[error:chat-restricted]]'); }