zulip/frontend_tests/node_tests
Tim Abbott 0d90bb2569 narrow: Fix messages being cached without flags set.
f0c680e9c0 introduced a call to
message_helper.process_new_message without first calling
message_store.set_message_flags on the message.

This resulted in it being possible as a race, when loading the Zulip
app to a stream/topic/near narrow, for a message to have the
`historical` flag be undefined due to not being initialized.

That invalid state, in turn, resulted in the message_list_view code
path for rendering the message feed incorrectly displaying additional
recipient bars around the message.

We could fix this by just calling message_store.set_message_booleans
in this code path. However, this bug exposes the fact that it's very
fragile to expect every code path to call that function before
message_helper.process_new_message.

So we instead fix this by moving message_store.set_message_booleans
inside message_helper.process_new_message.

One call point of concern in this change is maybe_add_narrow_messages,
which could theoretically reintroduce the double set_message_flags
bugs detailed in 9729b1a4ad. However, I
believe that to not be possible, because that call should never
experience a cache miss.

The other existing code paths were already calling
set_message_booleans immediately before
message_helper.process_new_message. They are still changing here, in
that we now do a cache lookup before attempting to call
set_message_booleans. Because the message booleans do not affect the
cache lookup and the local message object is discarded in case of a
cache hit, this should have no functional impact.

Because I found the existing comment at that call site confusing and
almost proposed removing it as pointless, extend the block comment to
explicitly mention that the purpose is refreshing our object.

Fixes #21503.
2022-03-24 08:10:14 -07:00
..
lib events: Add functionality to mark messages as unread. 2022-03-15 18:00:35 -07:00
templates Revert "templates: Add {{#let}} block helper." 2021-04-13 17:41:10 -07:00
activity.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
alert_words.js alert_words: Fix alert words with HTML special characters. 2022-03-04 12:26:49 -08:00
alert_words_ui.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
billing.js frontend_tests: Fix unicorn/text-encoding-identifier-case. 2022-03-01 23:09:46 -08:00
billing_helpers.js node_tests: Add a few missing $ prefixes. 2022-03-17 13:10:23 -07:00
blueslip_stacktrace.js dependencies: Upgrade JavaScript dependencies. 2021-05-10 18:07:13 -07:00
bot_data.js node tests: Use {override} in run_test. 2021-06-16 12:55:53 -04:00
browser_history.js docs: Consistently hyphenate “web-public”. 2022-01-28 17:45:45 -08:00
buddy_data.js docs: Fix many spelling mistakes. 2022-02-07 18:51:06 -08:00
buddy_list.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
channel.js lint: Fix typos found by codespell. 2021-10-19 16:51:13 -07:00
color_data.js js: Convert static/js/color_data.js to ES6 module. 2021-02-28 14:23:00 -08:00
colorspace.js colorspace: Remove unused methods. 2021-05-21 16:53:30 -07:00
common.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
components.js js: Fix no-jquery/no-parse-html-literal. 2022-03-17 13:16:34 -07:00
compose.js node_tests: Add a few missing $ prefixes. 2022-03-17 13:10:23 -07:00
compose_actions.js hash_util: Rename _uri functions to _url. 2022-03-01 18:14:31 -08:00
compose_closed_ui.js zjsunit: Wire $ to zjquery by default. 2021-06-16 12:55:53 -04:00
compose_error.js compose: Use loading spinner as loading indicator. 2021-12-02 15:11:15 -08:00
compose_fade.js zjsunit: Wire $ to zjquery by default. 2021-06-16 12:55:53 -04:00
compose_pm_pill.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
compose_state.js node tests: Use {override} in run_test. 2021-06-16 12:55:53 -04:00
compose_ui.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
compose_validate.js js: Fix no-jquery/no-parse-html-literal. 2022-03-17 13:16:34 -07:00
compose_video.js integration: Generate dynamic name for BigBlueButton video calls. 2022-03-18 17:27:39 -07:00
composebox_typeahead.js docs: Add missing space in “time zone”. 2022-02-24 14:05:12 -08:00
copy_and_paste.js zjsunit: Optionally exercise template code. 2021-06-15 12:33:26 -04:00
deprecated_feature_notice.js deprecated_feature_notice: Migrate modal to dialog_widget. 2021-10-29 16:09:39 -07:00
dispatch.js settings: Remove bot from "Active bots" list on changing owners. 2022-03-22 15:38:43 -07:00
dispatch_subs.js zjsunit: Split deprecated __Rewire__ functionality out of override. 2022-01-08 10:01:27 -05:00
drafts.js js: Fix no-jquery/no-parse-html-literal. 2022-03-17 13:16:34 -07:00
dropdown_list_widget.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
echo.js echo: Clean up confusing handling of message flags in local echo. 2022-03-24 08:10:14 -07:00
emoji.js buddy_list: Show still image for animated emojis. 2021-09-12 16:24:29 -07:00
emoji_picker.js emoji: Add yellow_large_square and green_large_square emojis. 2022-02-02 16:26:31 -08:00
event_status.js pricing: Replace "Zulip Standard" with "Zulip Cloud Standard". 2022-02-09 11:00:24 -08:00
example1.js custom_check: Avoid use of assert to avoid confusion with assert.equal. 2021-06-10 09:15:57 -07:00
example2.js narrow: Fix messages being cached without flags set. 2022-03-24 08:10:14 -07:00
example3.js node_tests: Replace `set_global` with `mock_esm` in example4.js. 2021-07-22 09:47:47 -04:00
example4.js node_tests: Replace `set_global` with `mock_esm` in example4.js. 2021-07-22 09:47:47 -04:00
example5.js node tests: Use {override} in run_test. 2021-06-16 12:55:53 -04:00
example6.js node tests: Use {override} in run_test. 2021-06-16 12:55:53 -04:00
example7.js message feed: Notify user when messages are not being marked as read. 2022-02-18 14:48:31 -08:00
example8.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
fenced_code.js node tests: Move test to fenced_code.js. 2021-03-12 11:18:44 -05:00
fetch_status.js zjsunit: Lift restriction against mocking third party modules. 2021-03-12 10:06:30 -08:00
filter.js resolved_topic: Implement resolve, unresolve, and display. 2022-03-07 21:35:00 -08:00
fold_dict.js node_tests: Fix incorrect usage of assert.throws. 2021-08-10 13:18:53 -07:00
hash_util.js hash_util: Rename _uri functions to _url. 2022-03-01 18:14:31 -08:00
hashchange.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
hotkey.js zjsunit: Split deprecated __Rewire__ functionality out of override. 2022-01-08 10:01:27 -05:00
i18n.js docs: Fix many spelling mistakes. 2022-02-07 18:51:06 -08:00
input_pill.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
internal_url.js hash_util: Rename _uri functions to _url. 2022-03-01 18:14:31 -08:00
keydown_util.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
lazy_set.js custom_check: Avoid use of assert to avoid confusion with assert.equal. 2021-06-10 09:15:57 -07:00
lightbox.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
linkifiers.js refactor: Extract linkifier non-settings logic from `markdown.js`. 2021-05-19 11:59:28 -07:00
list_cursor.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
list_widget.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
markdown.js markdown: Simulate message flags in frontend markdown processor. 2022-03-24 08:10:14 -07:00
message_edit.js edit_history: Check edit history for stream and topic match. 2022-03-21 13:32:11 -07:00
message_events.js narrow: Fix messages being cached without flags set. 2022-03-24 08:10:14 -07:00
message_fetch.js narrow: Fix messages being cached without flags set. 2022-03-24 08:10:14 -07:00
message_flags.js zjsunit: Split deprecated __Rewire__ functionality out of with_field. 2022-01-08 10:01:27 -05:00
message_list.js bookend: Simplify can_toggle_subscription variable flow. 2022-01-31 16:39:16 -08:00
message_list_data.js message_list: Add helper for checking if a message list has unreads. 2022-02-18 14:48:31 -08:00
message_list_view.js message_edit: Don't display resolved topics as MOVED. 2022-03-10 12:00:53 -08:00
message_store.js narrow: Fix messages being cached without flags set. 2022-03-24 08:10:14 -07:00
muting.js docs: Fix many spelling mistakes. 2022-02-07 18:51:06 -08:00
narrow.js js: Fix no-jquery/no-parse-html-literal. 2022-03-17 13:16:34 -07:00
narrow_activate.js narrow: Call reset_ui_state at start of narrowing process. 2021-11-27 20:18:32 -08:00
narrow_local.js resolved_topic: Implement resolve, unresolve, and display. 2022-03-07 21:35:00 -08:00
narrow_state.js node tests: Use {override} in run_test. 2021-06-16 12:55:53 -04:00
narrow_unread.js zjsunit: Split deprecated __Rewire__ functionality out of override. 2022-01-08 10:01:27 -05:00
navbar_alerts.js navbar_alerts: Add alerts for demo org deadlines. 2021-09-10 16:31:54 -07:00
notifications.js zjsunit: Split deprecated __Rewire__ functionality out of override. 2022-01-08 10:01:27 -05:00
password.js password_quality: Switch zxcvbn to zxcvbn-ts. 2022-03-17 15:24:46 -07:00
peer_data.js stream_data: Rename is_subscribed to is_subscribed_by_name. 2021-11-22 15:44:30 -08:00
people.js stream create: Overhaul create-stream add-subscribers UI. 2022-03-07 16:58:58 -08:00
people_errors.js zjsunit: Split deprecated __Rewire__ functionality out of override. 2022-01-08 10:01:27 -05:00
pill_typeahead.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
pm_conversations.js js: Rename muting module to muted_topics. 2021-06-30 16:32:55 -07:00
pm_list.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
pm_list_data.js node tests: Avoid narrow_state mocking in pm_list* tests. 2022-03-16 11:57:58 -04:00
poll_widget.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
popovers.js popovers: Support reactivating users from user profile popover. 2022-03-18 15:19:13 -07:00
presence.js node tests: Use with_overrides for function. 2022-01-10 17:54:29 -08:00
reactions.js js: Fix no-jquery/no-parse-html-literal. 2022-03-17 13:16:34 -07:00
recent_senders.js node tests: Use {override} in run_test. 2021-06-16 12:55:53 -04:00
recent_topics.js recent topics: Revert time format changes for now. 2022-03-21 17:37:32 -07:00
reload_state.js node tests: Use {override} in run_test. 2021-06-16 12:55:53 -04:00
rendered_markdown.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
resolved_topic.js resolved_topic: Implement resolve, unresolve, and display. 2022-03-07 21:35:00 -08:00
rtl.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
schema.js node_tests: Don’t read from most deprecated global variables. 2021-02-10 07:40:22 -08:00
scroll_util.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
search_future.js node tests: Use now/future naming scheme for search tests. 2022-03-17 12:07:53 -04:00
search_now.js node tests: Add coverage for clear_search_form. 2022-03-17 12:07:53 -04:00
search_pill.js zjsunit: Split deprecated __Rewire__ functionality out of override. 2022-01-08 10:01:27 -05:00
search_suggestion_future.js node tests: Use now/future naming scheme for search tests. 2022-03-17 12:07:53 -04:00
search_suggestion_now.js node tests: Add spectator test for search suggestions. 2022-03-17 12:07:53 -04:00
server_events.js zjsunit: Wire $ to zjquery by default. 2021-06-16 12:55:53 -04:00
settings_bots.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
settings_config.js settings_config: Pass settings object as parameter to all_notifications. 2021-09-16 15:46:41 -07:00
settings_data.js settings: Add user_can_create_web_public_streams function. 2021-11-23 10:48:20 -08:00
settings_emoji.js zjsunit: Wire $ to zjquery by default. 2021-06-16 12:55:53 -04:00
settings_muted_topics.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
settings_muted_users.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
settings_org.js js: Fix no-jquery/no-parse-html-literal. 2022-03-17 13:16:34 -07:00
settings_profile_fields.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
settings_user_groups.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
spoilers.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
starred_messages.js zjsunit: Split deprecated __Rewire__ functionality out of override. 2022-01-08 10:01:27 -05:00
stream_create_subscribers_data.js stream create: Overhaul create-stream add-subscribers UI. 2022-03-07 16:58:58 -08:00
stream_data.js settings: Grey out muted streams in personal settings. 2022-03-03 14:51:15 -08:00
stream_events.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
stream_list.js js: Fix no-jquery/no-parse-html-literal. 2022-03-17 13:16:34 -07:00
stream_pill.js node tests: Directly test simple stream_pill helpers. 2022-02-22 16:29:36 -08:00
stream_search.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
stream_settings_ui.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
stream_sort.js zjsunit: Split deprecated __Rewire__ functionality out of override. 2022-01-08 10:01:27 -05:00
stream_topic_history.js zjsunit: Split deprecated __Rewire__ functionality out of with_field. 2022-01-08 10:01:27 -05:00
submessage.js node tests: Use {override} in run_test. 2021-06-16 12:55:53 -04:00
support.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
templates.js zjsunit: Optionally exercise template code. 2021-06-15 12:33:26 -04:00
timerender.js js: Fix no-jquery/no-parse-html-literal. 2022-03-17 13:16:34 -07:00
top_left_corner.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
topic_generator.js zjsunit: Split deprecated __Rewire__ functionality out of override. 2022-01-08 10:01:27 -05:00
topic_list_data.js topic_list_data: Move "if resolved" conditionals to a single place. 2022-03-07 21:35:00 -08:00
transmit.js zjsunit: Split deprecated __Rewire__ functionality out of override. 2022-01-08 10:01:27 -05:00
typeahead.js minor: Check if typeahead query exists. 2021-03-25 02:08:51 -07:00
typeahead_helper.js status_emoji: Show status emoji in compose_pm and mentions typeaheads. 2022-02-11 13:30:08 -08:00
typing_data.js js: Split out muted_users module from muting. 2021-06-30 16:32:55 -07:00
typing_events.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
typing_status.js zjsunit: Split deprecated __Rewire__ functionality out of override. 2022-01-08 10:01:27 -05:00
unread.js unread: Replace sender_id with other_user_id. 2022-03-10 13:33:21 -08:00
upgrade.js frontend_tests: Fix unicorn/text-encoding-identifier-case. 2022-03-01 23:09:46 -08:00
upload.js dependencies: Upgrade JavaScript dependencies. 2022-03-17 15:24:46 -07:00
user_events.js settings: Make banner asking to confirm new email sticky. 2022-01-05 14:42:23 -08:00
user_group_pill.js node tests: Directly test user_group_pill helpers. 2022-02-22 16:29:36 -08:00
user_groups.js user_groups: Hide system user groups from UI. 2021-09-16 13:11:03 -07:00
user_pill.js status_emoji: Show status emoji in compose_pm pills. 2022-02-11 13:30:08 -08:00
user_search.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
user_status.js user_status: Fix status emoji handling of deactivated custom emoji. 2021-11-20 20:57:54 -08:00
util.js messages: Show tippy tooltip for inline images. 2022-03-21 15:36:10 -07:00
vdom.js docs: Fix many spelling mistakes. 2022-02-07 18:51:06 -08:00
watchdog.js custom_check: Avoid use of assert to avoid confusion with assert.equal. 2021-06-10 09:15:57 -07:00
widgetize.js js: Prefix jQuery object variable names with $. 2022-03-16 12:52:07 -07:00
zblueslip.js docs: Fix many spelling mistakes. 2022-02-07 18:51:06 -08:00
zjquery.js js: Fix no-jquery/no-parse-html-literal. 2022-03-17 13:16:34 -07:00