Skip to content

edit-message: Show error dialog on edit-message request error #1792

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 5 commits into
base: main
Choose a base branch
from

Conversation

chrisbobbe
Copy link
Collaborator

With #188, the message-list UI for an unsubscribed channel will become more prominent, which calls for fixing at least the following glitch:

Since we don't get events when the self-user sends or edits a message in an unsubscribed channel, we'd like to refetch messages on success of those actions. Discussion: #mobile > Message sending in unsubscribed channels @ 💬 So, on the path to that, make store.editMessage similar to store.sendMessage in returning Future<void> instead of void, where the returned Future resolves or rejects with the API request, irrespective of the event.

While we're at it, show an error dialog when the edit fails, as we've been meaning to do, again for consistency with the send-message UX.


Compare error feedback on sending an invalid message (in main and unchanged here) vs. trying to save an invalid message edit (new here; in main we show no dialog):

Send Edit
image image

The outbox logic is unchanged. As in main, we show "MESSAGE NOT SENT" and "EDIT NOT SAVED" in the message list, and these are tappable to restore the composing session and try again.

I'm fairly certain this is NFC. The two calls do operate on shared
state, in the controller, but it should suffice to just capture
`messageId` and `newContent` from the ComposeBoxController before
endMessageEdit disposes it.

Soon we'd like `store.editMessage` to return a Future, which we'd
like to await and add some error feedback, just like we have in the
send-message UX.
See added dartdoc for motivation.

I don't think there's a behavior change here; we don't use the
passed BuildContext after an async gap. We'd like to do that soon,
though: to show an error dialog on API errors from the edit-message
request; such errors will arrive after the banner has disappeared.
I'm not finding the discussion where we said we wanted this (for
consistency with the send-message UX), but I think we did.

Error-feedback logic copied from the tap-"Send" button
(_SendButtonState._send) modulo the error dialog's title, "Message
not saved" vs. "Message not sent".
@chrisbobbe chrisbobbe requested a review from gnprice August 6, 2025 04:08
@chrisbobbe chrisbobbe added the integration review Added by maintainers when PR may be ready for integration label Aug 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integration review Added by maintainers when PR may be ready for integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants