Commit Graph

7 Commits

Author SHA1 Message Date
roanster007 81efecf463 stream_topic_history: Update history to only store acked message ids.
Previously, the "stream_topic_history" used to store unacked float
message ids as well in its "max_message_id" of stream and
"message_id" of topic histories.

This commit updates it to rather store only the acked message ids
here, and rather use the "echo_state" module so as to look up
for unacked messages in case of looking for recent topics, or
max message id in functions.
2024-10-02 18:31:32 -07:00
roanster007 da75fed5be echo: Start tracking local messages before updating sidebars.
Previously, when `insert_local_message` was called, the
data structures in the `echo_state` are updated with the new
local messages after calling `insert_new_message`. This would
update the stream sidebar before even updating the `echo_state`
with the new local messages.

This commit introduces `track_local_message`, which basically
updates the `echo_state` data structures with the local
message before actually updating the stream sidebar.

This is a preparatory commit to update stream_topic_history
to only contain acked message ids.
2024-10-02 18:31:32 -07:00
Sayam Samal b8d4bddacf echo: Fix handling of `locally_echoed` flag after successful msg resend.
The `on_success` function within `echo.resend_message` is executed when
the server successfully acknowledges a resent message. In this scenario,
the `locally_echoed` flag should be set to false, as the message has
been confirmed by the server.

This behavior is already correctly handled within the
`echo.reify_message_id()` function, which is triggered through the
`compose.send_message_success()` flow.

However, the on_success function incorrectly sets the `locally_echoed`
flag to true, which is unnecessary and likely a mistake. This led to
the bug where message controls would disappear from the resent messages
on slow networks.

This commit removes the erroneous line to ensure proper flag handling
during message resend.
2024-09-16 13:06:30 -07:00
Sayam Samal 5583ddd3bf echo: Update message controls dynamically for failed messages.
Previously, the message controls for failed messages was present for
all messages, regardless of their status, and was being rendered
unconditionally; only being hidden for successfully sent messages.

This commit adds dynamic rendering for the failed message controls,
only rendering them via the handlebars template when a message is
confirmed to be failed.

Fixes #31132.
2024-09-16 13:06:30 -07:00
Aman Agrawal 5b9a2584c5 message_list_data_cache: Cache MessageListData objects.
We start caching MessageListData objects for the narrows which
user has visited. We restore the cached objects if the filters
match. Also, the cached objects are updated based on events. One
major piece is update path the is pending implementation is the
message move code path.
2024-09-10 15:58:15 -07:00
roanster007 e104fed6ef echo: Extract the waiting for id and ack into separate module.
This commit extracts the "waiting_for_id" and "waiting_for_ack"
data structures of "echo.js" into a separate module in "echo_state".

This is a preparatory commit so as to be able to use them for
"stream_topic_history" module, without causing import cycles.
2024-08-14 18:24:56 -07:00
Varun Singh d8dd682944 echo: Convert module to TypeScript. 2024-08-13 09:37:35 -07:00