mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
reactions: Handle missing realm emojis.
For the lines of code that I changed here, we were
getting field reports that the below code
was getting `undefined`:
emoji.all_realm_emojis.get(r.emoji_code)
It's not really clear to me how this could happen,
but we definitely should fail softly here. We
still report it as an error, but we let the function
return and don't trigger a TypeError.
If there's a legitimate reason for realms to delete
realm emojis, we should either downgrade this to a
warning or consider a strategy of back-fixing messages
when realm emojis get deleted.
This commit is contained in:
@@ -171,6 +171,24 @@ run_test("basics", () => {
|
||||
assert.deepEqual(result, expected_result);
|
||||
});
|
||||
|
||||
run_test("unknown realm emojis (add)", () => {
|
||||
blueslip.expect("error", "Cannot find/add realm emoji for code 'broken'.");
|
||||
reactions.add_clean_reaction({
|
||||
reaction_type: "realm_emoji",
|
||||
emoji_code: "broken",
|
||||
user_ids: [alice.user_id],
|
||||
});
|
||||
});
|
||||
|
||||
run_test("unknown realm emojis (insert)", () => {
|
||||
blueslip.expect("error", "Cannot find/insert realm emoji for code 'bogus'.");
|
||||
reactions.view.insert_new_reaction({
|
||||
reaction_type: "realm_emoji",
|
||||
emoji_code: "bogus",
|
||||
user_id: bob.user_id,
|
||||
});
|
||||
});
|
||||
|
||||
run_test("sending", () => {
|
||||
const message_id = 1001; // see above for setup
|
||||
let emoji_name = "smile"; // should be a current reaction
|
||||
|
||||
Reference in New Issue
Block a user