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

This commit is contained in:
Barış Soner Uşaklı
2024-08-27 10:23:21 -04:00
parent 5fa8ddbcf9
commit c0b30ea4ef
2 changed files with 5 additions and 1 deletions

View File

@@ -179,6 +179,7 @@
"cant-chat-with-yourself": "You can't chat with yourself!", "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-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", "chat-disabled": "Chat system disabled",
"too-many-messages": "You have sent too many messages, please wait awhile.", "too-many-messages": "You have sent too many messages, please wait awhile.",
"invalid-chat-message": "Invalid chat message", "invalid-chat-message": "Invalid chat message",

View File

@@ -363,7 +363,10 @@ Messaging.canMessageUser = async (uid, toUid) => {
user.blocks.is(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]]'); throw new Error('[[error:chat-restricted]]');
} }