Skip to content

Node.js based forum software built for the modern web

fix: closes #12758, show different error message for block

Barış Soner Uşaklıc0b30ea4efef
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]]');
}