diff --git a/zerver/lib/emoji.py b/zerver/lib/emoji.py index f3d83bfc9a..64109eb8f4 100644 --- a/zerver/lib/emoji.py +++ b/zerver/lib/emoji.py @@ -67,19 +67,19 @@ def check_emoji_request(realm: Realm, emoji_name: str, emoji_code: str, realm_emojis = realm.get_emoji() realm_emoji = realm_emojis.get(emoji_code) if realm_emoji is None: - raise JsonableError(_("No such realm emoji found.")) + raise JsonableError(_("Invalid custom emoji.")) if realm_emoji["deactivated"]: - raise JsonableError(_("This realm emoji has been deactivated.")) + raise JsonableError(_("This custom emoji has been deactivated.")) if emoji_name != emoji_code: raise JsonableError(_("Invalid emoji name.")) elif emoji_type == "zulip_extra_emoji": if emoji_code not in ["zulip"]: - raise JsonableError(_("No such extra emoji found.")) + raise JsonableError(_("Invalid emoji code.")) if emoji_name != emoji_code: raise JsonableError(_("Invalid emoji name.")) elif emoji_type == "unicode_emoji": if emoji_code not in codepoint_to_name: - raise JsonableError(_("No unicode emoji with this emoji code found.")) + raise JsonableError(_("Invalid emoji code.")) if name_to_codepoint.get(emoji_name) != emoji_code: raise JsonableError(_("Invalid emoji name.")) else: diff --git a/zerver/tests/test_reactions.py b/zerver/tests/test_reactions.py index 3589c2c0e9..2f9a5a890f 100644 --- a/zerver/tests/test_reactions.py +++ b/zerver/tests/test_reactions.py @@ -404,7 +404,7 @@ class DefaultEmojiReactionTests(EmojiReactionBase): 'emoji_code': 'TBD', } result = self.post_reaction(reaction_info) - self.assert_json_error(result, 'No unicode emoji with this emoji code found.') + self.assert_json_error(result, 'Invalid emoji code.') def test_add_default_emoji_invalid_name(self) -> None: reaction_info = { @@ -550,7 +550,7 @@ class ZulipExtraEmojiReactionTest(EmojiReactionBase): 'reaction_type': 'zulip_extra_emoji', } result = self.post_reaction(reaction_info) - self.assert_json_error(result, 'No such extra emoji found.') + self.assert_json_error(result, 'Invalid emoji code.') def test_add_invalid_emoji_name(self) -> None: reaction_info = { @@ -587,7 +587,7 @@ class RealmEmojiReactionTests(EmojiReactionBase): 'emoji_code': 'non_existent', } result = self.post_reaction(reaction_info) - self.assert_json_error(result, 'No such realm emoji found.') + self.assert_json_error(result, 'Invalid custom emoji.') def test_add_realm_emoji_invalid_name(self) -> None: reaction_info = { @@ -607,7 +607,7 @@ class RealmEmojiReactionTests(EmojiReactionBase): 'emoji_code': 'green_tick', } result = self.post_reaction(reaction_info) - self.assert_json_error(result, 'This realm emoji has been deactivated.') + self.assert_json_error(result, 'This custom emoji has been deactivated.') def test_add_to_existing_deactivated_realm_emoji_reaction(self) -> None: reaction_info = {