Skip to content

local echo (7/7): Support simplified version of local echo #1453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

PIG208
Copy link
Member

@PIG208 PIG208 commented Apr 1, 2025

screenshots
message sent got message event
sending-success-before sending-success-after
message failed to send message content tapped recipient headers
send-failed sent-failed-interacted recipient-headers

(This branch can be used to preview the full implementation)

Fixes #1441

@PIG208 PIG208 changed the title Support simplified version a local echo (n/n) Support simplified version of local echo (n/n) Apr 1, 2025
@PIG208 PIG208 changed the title Support simplified version of local echo (n/n) locale echo (n/n): Support simplified version of local echo Apr 1, 2025
@PIG208 PIG208 changed the title locale echo (n/n): Support simplified version of local echo local echo (n/n): Support simplified version of local echo Apr 2, 2025
@PIG208 PIG208 force-pushed the pr-echo branch 16 times, most recently from 988c615 to f297a65 Compare April 15, 2025 01:45
@PIG208 PIG208 marked this pull request as ready for review April 15, 2025 01:49
@PIG208 PIG208 force-pushed the pr-echo branch 2 times, most recently from 828e05c to 19cfaa9 Compare April 15, 2025 23:42
The point of this helper is to replicate what a topic sent from the
client will become, after being processed by the server.

This important when trying to create a local copy of a stream message,
whose topic can get translated when it's delivered by the server.
@PIG208 PIG208 force-pushed the pr-echo branch 2 times, most recently from 1066105 to aa81e2f Compare April 16, 2025 01:44
@PIG208 PIG208 changed the title local echo (n/n): Support simplified version of local echo local echo (6/6): Support simplified version of local echo Apr 17, 2025
@PIG208 PIG208 changed the title local echo (6/6): Support simplified version of local echo local echo (7/7): Support simplified version of local echo Apr 17, 2025
PIG208 added 9 commits April 17, 2025 18:56
While we do create outbox messages, there are in no way user-visible
changes since the outbox messages don't end up in message list views.
We create skeletons for helpers needed from message list view, but don't
implement them yet, to make the diff smaller.

For testing, similar to TypingNotifier.debugEnable, we add
MessageStoreImpl.debugOutboxEnable for tests that do not intend to
cover outbox messages.

Some of the delays to fake responses added in tests are not necessary
because the future of sendMessage is not completed immediately, but we
still add them to keep the tests realistic.
Also removed a stale comment that refers to resolved issues
(zulip#173 and zulip#175).

We will reuse this helper when handling outbox messages.
This is an NFC because MessageListMessageItem is still the only
subclass of it.
This will make MessageItem compatible with other future subclasses of
MessageBase, in particular OutboxMessage, which do not need unread
markers.
This adds some overhead in magnitude of O(1) (where the constant is
the number of outbox messages in a view, expected to be small) on
message event handling.

We add outboxMessages as a list independent from messages on
_MessageSequence.  Because outbox messages are not rendered
(the raw content is shown as plain text), we leave the 1-1
relationship between `messages` and `contents` unchanged.

When computing `items`, we now start to look at `outboxMessages` as
well, with the guarantee that the items related to outbox messages
always come after those for other messages.  Look for places that call
`_processOutboxMessage(int index)` for references, and the changes to
`checkInvariants` on how this affects the message list invariants.

`addOutboxMessage`, similar to `handleMessage`, also look at
`fetched` before adding the outbox message.  However, there is no data
race to prevent — we can totally not clear `outboxMessages` in `_reset`,
and do the initial fetch from `MessageListView.init`, so that outbox
messages do not rely on the fetched state at all.  I decided against it
since it is easy to check `fetched`, and making `fetchInitial` reprocess
`outboxMessages` from a clean state (which is inexpensive) helps
ensuring message list invariants.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplified local echo, with retry
1 participant