zulip/static/js
Ryan Rehman 6637f2dbb7 message list: Render new messages only after "newest" is found.
If a user sends a message while the latest batch of
messages are being fetched, the new message recieved
from `server_events` gets displayed temporarily out of
order (just after the the current batch of messages)
for the current narrow.

We could just discard the new message events if we havent
recieved the last message i.e. when `found_newest` = False,
since we would recieve them on furthur fetching of that
narrow.
But this would create another bug where the new messages
sent while fetching the last batch of messages would not
get rendered. Because, `found_newest` = True and we would
no longer fetch messages for that narrow, thus the new
messages would not get fetched and are also discarded from
the events codepath.

Thus to resolve both these bugs we use the following approach:

* We do not add the new batch of messages for the current narrow
  while `has_found_newest` = False.
* We store the latest message id which should be displayed at the
  bottom of the narrow in `fetch_status`.
* Ideally `expected_max_message_id`'s value should be equal to the
  last item's id in `MessageListData`.
* So the messages received while `has_found_newest` = False,
  will be fetched later and also the `expected_max_message_id`
  value gets updated.
* And after fetching the last batch where `has_found_newest` = True,
  we would again fetch messages if the `expected_max_message_id` is
  greater than the last message's id found on fetching by refusing to
  update the server provided `has_found_newest` = True in `fetch_status`.

Another benefit of not discarding the events is that the
message gets processed not rendered i.e. we still get desktop
notifications and unread count updates.

Fixes #14017
2020-06-16 10:47:52 -07:00
..
analytics js: Automatically convert var to let and const in most files. 2019-11-03 12:42:39 -08:00
billing free trial: Send users to /upgrade after realm creation. 2020-05-26 17:01:32 -07:00
bundles templates: Show Overlay of Recent Topics. 2020-06-09 22:08:31 -07:00
portico docs: Update most remaining references to zulipchat.com. 2020-06-08 18:10:45 -07:00
stats js: Use hasOwnProperty correctly or not at all. 2020-05-26 23:33:40 -07:00
types dependencies: Upgrade stacktrace-gps from 3.0.3 to 3.0.4. 2020-02-04 22:13:33 -08:00
activity.js right sidebar: Remove "GROUP PMs" section. 2020-05-27 17:57:50 -07:00
admin.js realm owner: Add frontend implementation of owner role. 2020-06-14 21:20:30 -07:00
alert_words.js refactor: Clean up alert_words API. 2020-02-27 11:10:13 -08:00
alert_words_ui.js lint: Add i18n linter rule for invalid i18n.t tags. 2020-05-27 14:09:56 -07:00
archive.js js: Use modern spread arguments syntax. 2020-02-11 17:43:35 -08:00
attachments_ui.js list_render: Clean up create/update. 2020-04-15 15:13:26 -07:00
avatar.js home/page_params: Add suffix `_mib` to clarify the size units. 2020-05-08 14:54:54 -07:00
blueslip.js js: Use hasOwnProperty correctly or not at all. 2020-05-26 23:33:40 -07:00
blueslip_stacktrace.ts dependencies: Upgrade stacktrace-gps from 3.0.3 to 3.0.4. 2020-02-04 22:13:33 -08:00
bot_data.js bot_data: Eliminate all uses of `bot.owner` (email). 2020-05-11 16:16:58 -07:00
buddy_data.js buddy_data: Extract all user list logic. 2020-04-03 14:51:35 -07:00
buddy_list.js js: Automatically convert _.each to for…of. 2020-02-07 14:09:47 -08:00
channel.js channel: Ignore error responses when reloading too. 2020-02-27 17:41:45 -08:00
click_handlers.js recent_topics: Add filter button to show muted topics. 2020-06-09 22:08:31 -07:00
color_data.js js: Convert _.pluck(a, "key") to item => item.key. 2020-02-27 17:20:34 -08:00
colorspace.js docs: Convert many http URLs to https. 2020-03-26 21:35:32 -07:00
common.js common: Account for string.match returning null. 2020-02-13 16:37:52 -08:00
components.js lint: Add i18n linter rule for invalid i18n.t tags. 2020-05-27 14:09:56 -07:00
compose.js compose: Change needs_subscribe_warning to use user_id. 2020-06-05 16:08:26 -07:00
compose_actions.js compose: Rewrite Zoom video call integration to use OAuth. 2020-06-03 16:39:12 -07:00
compose_fade.js refactor: Call compose_fade without triggers. 2020-06-13 15:35:39 -07:00
compose_pm_pill.js util.js: Remove util from window. 2020-02-15 12:20:20 -08:00
compose_state.js util: Kill off rtrim() helper. 2020-02-15 12:20:20 -08:00
compose_ui.js js: Convert _.map(a, …) to a.map(…). 2020-02-10 14:08:12 -08:00
composebox_typeahead.js typeahead: Advertise default codeblock language. 2020-05-12 11:40:12 -07:00
condense.js condense: Clean up continue/else/if idiom. 2020-04-02 14:44:35 -07:00
confirm_dialog.js modals: Use selectors for open_modal/close_modal. 2020-05-09 10:22:37 -07:00
copy_and_paste.js copy/paste: Extract visible_range() to fix error. 2020-04-02 16:57:01 -07:00
csrf.js js: Automatically convert var to let and const in most files. 2019-11-03 12:42:39 -08:00
debug.js js: Cleanup debug.js example to use ES syntax. 2020-03-09 14:07:13 -07:00
drafts.js drafts: Show drafts count on draft button. 2020-06-10 17:00:39 -07:00
dropdown_list_widget.js dropdown-list-widget: Properly handle disabled state. 2020-05-20 09:51:38 -07:00
echo.js stream_topic_history: Pluralize remove_message. 2020-06-15 10:52:04 -07:00
emoji.js emoji: Abstract all name_to_codepoint, codepoint_to_name accesses. 2020-05-26 23:33:40 -07:00
emoji_picker.js emoji_picker: Fix DOM race condition with offsets. 2020-06-15 10:34:07 -07:00
emojisets.js emoji: Resolve emoji sprite sheets and stylesheets through Webpack. 2020-02-25 14:43:46 -08:00
favicon.js js: Automatically convert var to let and const in most files. 2019-11-03 12:42:39 -08:00
feature_flags.js minor: Update comment in feature_flags. 2020-05-20 13:51:54 -07:00
feedback_widget.js js: Automatically convert var to let and const in most files. 2019-11-03 12:42:39 -08:00
fenced_code.js markdown: Disable tex and latex for math rendering. 2020-05-21 12:30:27 -07:00
fetch_status.js message list: Render new messages only after "newest" is found. 2020-06-16 10:47:52 -07:00
filter.js navbar: Fix navbar for unknown streams. 2020-06-15 16:48:24 -07:00
floating_recipient_bar.js js: Convert _.map(a, …) to a.map(…). 2020-02-10 14:08:12 -08:00
fold_dict.ts dict: Remove each method. 2020-02-04 12:22:03 -08:00
gear_menu.js dead code: Remove useless resize calls. 2020-05-27 17:57:50 -07:00
global.d.ts dead code: Remove integration_bot_widget code. 2020-06-13 15:35:39 -07:00
hash_util.js search/hash_util: Parse negated searches properly. 2020-03-22 11:29:02 -07:00
hashchange.js templates: Show Overlay of Recent Topics. 2020-06-09 22:08:31 -07:00
hbs.d.ts blueslip: Make stack trace more readable. 2019-10-31 13:47:54 -07:00
hotkey.js templates: Show Overlay of Recent Topics. 2020-06-09 22:08:31 -07:00
hotspots.js js: Convert _.pluck(a, "key") to item => item.key. 2020-02-27 17:20:34 -08:00
huddle_data.js right sidebar: Remove "GROUP PMs" section. 2020-05-27 17:57:50 -07:00
i18n.js i18n: Rename translations.js to i18n.js. 2020-02-29 12:19:51 -08:00
info_overlay.js info_overlay: Fix keyboard accessibility of keyboard shortcuts modal. 2020-03-24 20:41:24 -07:00
input_pill.js search pills: Update multiple pills creation event behaviour. 2020-06-05 17:16:20 -07:00
invite.js stream_data: Remove page_params.notifications_stream. 2020-04-22 17:57:16 -07:00
keydown_util.js js: Automatically convert var to let and const in most files. 2019-11-03 12:42:39 -08:00
lazy_set.js dict, lazy_set: Return an iterator from keys method. 2020-02-04 12:22:03 -08:00
lightbox.js lightbox: Remove inaccurate docstring on lightbox.open(). 2020-04-05 13:13:02 -07:00
lightbox_canvas.js lightbox_canvas: Clear canvas with less obfuscation. 2020-05-26 23:33:40 -07:00
list_cursor.js js: Automatically convert var to let and const in most files. 2019-11-03 12:42:39 -08:00
list_render.js list-render: Allow re-rendering individual list items. 2020-05-28 17:10:51 -04:00
list_util.js right sidebar: Remove "GROUP PMs" section. 2020-05-27 17:57:50 -07:00
loading.js js: Automatically convert var to let and const in most files. 2019-11-03 12:42:39 -08:00
local_message.js local_message: Convert already_used from object to Set. 2020-02-12 10:39:01 -08:00
localstorage.js localstorage: Don’t return a value from a setter. 2020-06-07 11:06:57 -07:00
markdown.js markdown: Move helper function to rendered_markdown.js. 2020-05-21 12:32:52 -07:00
markdown_config.js markdown: Add helper configuration for mobile. 2020-02-18 16:13:38 -08:00
message_edit.js code cleanup: Use exports for internal references. 2020-06-11 11:05:06 -07:00
message_edit_history.js edit_history: Respect time format setting (12h/24h). 2020-06-07 13:57:28 -07:00
message_events.js stream_topic_history: Pluralize remove_message. 2020-06-15 10:52:04 -07:00
message_fetch.js message list: Render new messages only after "newest" is found. 2020-06-16 10:47:52 -07:00
message_flags.js js: Convert _.filter(a, …) to a.filter(…). 2020-02-10 14:08:12 -08:00
message_list.js message_edit: Ensure message edit form is empty prior to appending. 2020-06-05 20:12:47 -07:00
message_list_data.js message list: Move the `FetchStatus` object to MessageListData class. 2020-06-02 15:45:39 -07:00
message_list_view.js markdown: Extract rendered_markdown.js to update dynamic elements. 2020-05-21 12:32:52 -07:00
message_live_update.js js: Automatically convert _.each to for…of. 2020-02-07 14:09:47 -08:00
message_scroll.js narrow: Move the top of narrow notices to `message_scroll.js`. 2020-06-16 00:21:21 -07:00
message_store.js topic_data: Rename `topic_data` module to `stream_topic_history`. 2020-04-16 20:11:04 -07:00
message_util.js message list: Render new messages only after "newest" is found. 2020-06-16 10:47:52 -07:00
message_viewport.js util.js: Remove util from window. 2020-02-15 12:20:20 -08:00
muting.js muting ui: Update the muted topics table in settings. 2020-04-22 15:07:15 -07:00
muting_ui.js recent_topics: Add filter button to show muted topics. 2020-06-09 22:08:31 -07:00
narrow.js narrow: Move the top of narrow notices to `message_scroll.js`. 2020-06-16 00:21:21 -07:00
narrow_state.js narrow: Show starred messages from muted topics in starred message view. 2020-03-27 00:17:26 -07:00
navigate.js text: Fix some typos (most of them found and fixed by codespell). 2020-03-27 17:25:56 -07:00
night_mode.js js: Purge useless IIFEs. 2019-10-25 13:51:21 -07:00
notifications.js narrow: Move the top of narrow notices to `message_scroll.js`. 2020-06-16 00:21:21 -07:00
overlays.js templates: Show Overlay of Recent Topics. 2020-06-09 22:08:31 -07:00
padded_widget.js js: Automatically convert var to let and const in most files. 2019-11-03 12:42:39 -08:00
page_params.js static: Serve webpack bundles from the root domain. 2020-04-10 00:48:02 -07:00
panels.js resize: Avoid hard-coding 10px for header padding. 2020-05-27 17:57:50 -07:00
people.js realm owner: Add frontend implementation of owner role. 2020-06-14 21:20:30 -07:00
pm_conversations.js js: Convert _.pluck(a, "key") to item => item.key. 2020-02-27 17:20:34 -08:00
pm_list.js narrow: bugfix: Update stream list height after rendering completes. 2020-04-28 12:32:40 -07:00
pm_list_dom.js js: Convert _.map(a, …) to a.map(…). 2020-02-10 14:08:12 -08:00
pointer.js pointer: Remove orig_initial_pointer hackery. 2020-06-08 22:36:35 -07:00
poll_widget.js js: Convert _.any(a, …), _.some(a, …) to a.some(…). 2020-02-10 14:08:12 -08:00
popovers.js js: Extract message_edit_history.js. 2020-06-07 13:57:28 -07:00
presence.js code cleanup: Use exports for internal references. 2020-06-11 11:05:06 -07:00
reactions.js emoji: Abstract all name_to_codepoint, codepoint_to_name accesses. 2020-05-26 23:33:40 -07:00
ready.js templates: Make the Loading… message more robust. 2019-09-20 10:34:44 -07:00
realm_icon.js settings org: Replace realm icon delete button with X icon. 2020-05-27 17:15:14 -07:00
realm_logo.js realm_logo: Fix incorrect display of realm logo delete button. 2020-05-12 11:59:06 -07:00
recent_senders.js recent_senders: Use better variable names and comments. 2020-05-12 00:15:26 -07:00
recent_topics.js recent_topics: Optimize filters_should_hide_topic. 2020-06-14 11:05:57 -07:00
reload.js pointer: Remove orig_initial_pointer hackery. 2020-06-08 22:36:35 -07:00
reload_state.js js: Automatically convert var to let and const in most files. 2019-11-03 12:42:39 -08:00
reminder.js util: Replace util.set_message_topic(). 2020-02-21 09:53:45 -05:00
rendered_markdown.js rendered_markdown: Add rendering functions for timestamps. 2020-05-21 12:37:37 -07:00
resize.js Revert "buddy list: Adjust sizing calc for narrow mode." 2020-05-29 15:36:42 -04:00
rows.js rows: Convert valid_table_names from object to Set. 2020-05-26 23:33:40 -07:00
rtl.js docs: Convert many http URLs to https. 2020-03-26 21:35:32 -07:00
schema.js js: Convert _.isString to typeof. 2020-02-10 15:57:20 -08:00
scroll_bar.js js: Automatically convert var to let and const in most files. 2019-11-03 12:42:39 -08:00
scroll_util.js list_render: Extract get_list_scrolling_container(). 2020-04-15 15:13:26 -07:00
search.js search: Open typeahead on initiating search. 2020-06-05 17:16:20 -07:00
search_pill.js js: Convert _.pluck(a, "key") to item => item.key. 2020-02-27 17:20:34 -08:00
search_pill_widget.js search: Don't create search pills on paste. 2020-05-26 22:04:36 -07:00
search_suggestion.js search suggestions: Refactor `get_default_suggestion`. 2020-06-15 20:16:40 -07:00
search_util.js js: Convert _.any(a, …), _.some(a, …) to a.some(…). 2020-02-10 14:08:12 -08:00
sent_messages.js sent_messages: Convert messages from object to Map. 2020-02-12 10:39:01 -08:00
server_events.js js: Convert _.extend to spread syntax or Object.assign. 2020-02-25 14:09:39 -08:00
server_events_dispatch.js stream_topic_history: Pluralize remove_message. 2020-06-15 10:52:04 -07:00
settings.js settings: Offer hiding presence info from other users. 2020-05-02 15:09:05 -07:00
settings_account.js settings: Change user avatar spinner implementation. 2020-06-08 22:48:04 -07:00
settings_bots.js people.js: Change functions to return a list of ids instead of objects. 2020-06-04 14:23:52 -04:00
settings_config.js realm owner: Add frontend implementation of owner role. 2020-06-14 21:20:30 -07:00
settings_data.js settings: Add EMAIL_ADDRESS_VISIBILITY_NOBODY. 2020-03-06 16:34:08 -08:00
settings_display.js modals: Use selectors for open_modal/close_modal. 2020-05-09 10:22:37 -07:00
settings_emoji.js api: Simplify format of realm_emoji author data. 2020-05-31 17:44:50 -07:00
settings_exports.js data exports: Keep deleted export in UI table. 2020-04-30 13:00:59 -07:00
settings_invites.js invitation: Make Member to see invitations sent by him/her. 2020-05-01 17:42:49 -07:00
settings_linkifiers.js list_render: Clean up create/update. 2020-04-15 15:13:26 -07:00
settings_muting.js muting: Fix real time sync of muted topics. 2020-04-22 15:07:15 -07:00
settings_notifications.js notifications: Add link for sending a test notification. 2020-04-26 23:02:05 -07:00
settings_org.js realm: Allow only owners to set message retention policy for a realm. 2020-06-14 21:23:53 -07:00
settings_panel_menu.js js: Automatically convert var to let and const in most files. 2019-11-03 12:42:39 -08:00
settings_profile_fields.js settings_profile_fields: Iterate over field_types with Object.values. 2020-02-10 14:08:12 -08:00
settings_sections.js bot settings: Load bots independently. 2020-05-11 16:16:58 -07:00
settings_streams.js default streams: Change add api to use stream_id. 2020-04-15 15:47:04 -07:00
settings_toggle.js js: Automatically convert _.each to for…of. 2020-02-07 14:09:47 -08:00
settings_ui.js js: Automatically convert var to let and const in most files. 2019-11-03 12:42:39 -08:00
settings_user_groups.js zjsunit: Use assert in strict mode. 2020-02-12 08:16:26 -05:00
settings_users.js settings_users: Only owner can deactivate other owners. 2020-06-14 21:20:30 -07:00
setup.js loading: Remove first_run_message. 2020-06-08 23:03:15 -07:00
starred_messages.js js: Automatically convert _.each to for…of. 2020-02-07 14:09:47 -08:00
stream_color.js stream_color.js: Fix color picker not saving custom color. 2020-06-05 17:58:09 -07:00
stream_create.js stream_edit: Use user_ids for subscribing/unsubscribing users to a stream. 2020-06-04 14:24:41 -07:00
stream_data.js api: Remove is_old_stream property from the stream objects. 2020-06-16 10:26:33 -07:00
stream_edit.js refactor: Avoid triggers in stream_edit. 2020-06-13 15:35:39 -07:00
stream_events.js stream edit: Fix real-time sync of stream notification setting. 2020-04-01 14:40:41 -07:00
stream_list.js left sidebar: Fix topic list disappearing during pins. 2020-04-06 16:19:43 -07:00
stream_muting.js js: Automatically convert var to let and const in most files. 2019-11-03 12:42:39 -08:00
stream_popover.js popovers: Improve label for choosing colors. 2020-06-10 09:55:51 -07:00
stream_sort.js util.js: Remove util from window. 2020-02-15 12:20:20 -08:00
stream_topic_history.js stream_topic_history: Pluralize remove_message. 2020-06-15 10:52:04 -07:00
stream_ui_updates.js stream settings: Add pills in add subscribers input. 2020-06-02 15:32:26 -07:00
submessage.js js: Convert _.find(a, …) to a.find(…). 2020-02-10 14:08:12 -08:00
subs.js subs: Call `filter.fix_stream_params` when updating stream name. 2020-06-10 14:25:18 -07:00
tab_bar.js navbar: Fix navbar for unknown streams. 2020-06-15 16:48:24 -07:00
templates.js CVE-2020-9444: Prevent reverse tabnabbing attacks. 2020-04-01 14:01:45 -07:00
tictactoe_widget.js tictactoe: Fix type confusion. 2020-02-21 20:01:21 -05:00
timerender.js rendered_markdown: Add rendering functions for timestamps. 2020-05-21 12:37:37 -07:00
todo_widget.js todo widget: Downgrade error to warning. 2020-05-06 09:35:04 -04:00
top_left_corner.js top_left_corner: Don't export `should_expand_pm_list()`. 2020-02-11 14:14:59 -08:00
topic_generator.js topic_data: Rename `topic_data` module to `stream_topic_history`. 2020-04-16 20:11:04 -07:00
topic_list.js topic_data: Rename `topic_data` module to `stream_topic_history`. 2020-04-16 20:11:04 -07:00
topic_list_data.js topic_data: Rename `topic_data` module to `stream_topic_history`. 2020-04-16 20:11:04 -07:00
topic_zoom.js js: Automatically convert var to let and const in most files. 2019-11-03 12:42:39 -08:00
transmit.js transmit: Inline send_message_ajax. 2020-04-09 16:11:57 -07:00
tslint.json typescript: Move TS files into JS directory. 2019-03-25 12:11:37 -07:00
tutorial.js js: Purge useless IIFEs. 2019-10-25 13:51:21 -07:00
typeahead_helper.js typeahead: Fix broken email address handling in typeahead. 2020-04-20 20:49:47 -07:00
typing.js js: Automatically convert var to let and const in most files. 2019-11-03 12:42:39 -08:00
typing_data.js dict: Replace with Map. 2020-02-25 15:37:37 -08:00
typing_events.js people: Rename method to get_by_user_id(). 2020-02-05 12:04:56 -08:00
ui.js ui: Upgrade remove_message to allow removing messages in bulk. 2020-06-15 10:41:12 -07:00
ui_init.js refactor: Call compose_fade without triggers. 2020-06-13 15:35:39 -07:00
ui_report.js ui_report: Fix HTML escaping of &. 2020-02-13 17:50:59 -08:00
ui_util.js message_edit: Show stream color bar alongside stream select. 2020-05-14 14:27:53 -07:00
unread.js unread: Handle message edits that affect mentions. 2020-04-11 12:00:46 -07:00
unread_ops.js recent_topics: Update unread count of topics inplace. 2020-06-09 22:08:31 -07:00
unread_ui.js unread: Remove suppress_unread_counts flag. 2020-03-31 15:30:52 -07:00
upload.js code cleanup: Use exports for internal references. 2020-06-11 11:05:06 -07:00
upload_widget.js settings_org: Combine upload_realm_logo and upload_realm_icon function. 2020-06-10 17:05:29 -07:00
user_events.js settings: Disable organization deactivation button for admins. 2020-06-14 21:20:30 -07:00
user_groups.js js: Use hasOwnProperty correctly or not at all. 2020-05-26 23:33:40 -07:00
user_pill.js stream settings: Add pills in add subscribers input. 2020-06-02 15:32:26 -07:00
user_search.js resize: Resize sidebars when toggling user search. 2020-05-27 17:57:50 -07:00
user_status.js ui_init: Handle page_params more cleanly. 2020-02-26 13:14:09 -08:00
user_status_ui.js user status: Save status on enter keypress. 2020-03-06 17:13:50 -08:00
util.js compose_fade: Change would_receive_message to use user_id. 2020-06-05 16:08:26 -07:00
vdom.js vdom: Use _.escape for correct HTML escaping. 2020-02-13 17:50:59 -08:00
widgetize.js widgetize: Convert widget_contents from object to Map. 2020-02-06 17:24:43 -08:00
zcommand.js zcommand: Add `/fluid-width` and `/fixed-width` slash commands. 2020-04-07 20:54:34 -07:00
zform.js js: Automatically convert _.each to for…of. 2020-02-07 14:09:47 -08:00
zulip.js js: Automatically convert var to let and const in most files. 2019-11-03 12:42:39 -08:00