zulip-mobile icon indicating copy to clipboard operation
zulip-mobile copied to clipboard

Can't edit message in "All messages" screen

Open PoignardAzur opened this issue 2 years ago • 6 comments

When long-pressing a message in the "All messages" screen, a list of options appears, same as elsewhere in the app.

Unlike elsewhere in the app, that list of option doesn't include the "Edit message" option even when you're long-clicking your own messages.

I know this isn't a matter of the edit timer having expired or something, because in the case where I discovered this, I was unable to edit a message from the "All messages" screen, but I was subsequently able to edit it from another screen, showing the option should still have been available.

PoignardAzur avatar Dec 17 '22 11:12 PoignardAzur

I would like to work on this issue. It seems to be possible by allowing the editMessage option on the action sheet for the HomeNarrow screen. Then, similar to when you click reply, you're taken directly to that particular chat screen with that message.

anshuman-8 avatar Jan 09 '23 16:01 anshuman-8

Thanks! Assigning this to you, @anshuman-8 . Just to check, were you able to replicate the issue?

alya avatar Jan 10 '23 17:01 alya

@alya Yes, I was able to understand and replicate it. Working on it!

anshuman-8 avatar Jan 10 '23 17:01 anshuman-8

Hey @alya,

Just had a doubt. I was trying to get the ComposeBox (message input component) in the "All messages" screen only when someone selects a message to edit. The issue is in ComposeBox file; it checks and works only for narrow which are conversations, but "All messages" is not a conversation.

// src/compose/ComposeBox.js
  const destinationNarrow = useMemo(() => {

  //...

    invariant(isConversationNarrow(narrow), 'destination narrow must be conversation');
    return narrow;
  }, [isEditing, narrow, topicInputState.value]);

So, should I make an exception for the "All messages" screen everywhere, or think of a different approach?

anshuman-8 avatar Jan 14 '23 17:01 anshuman-8

Hi @anshuman-8, thanks for volunteering to work on this! Yeah, unfortunately more work is needed before we can really support editing messages in the "All messages" screen, and for a beginner I would recommend choosing a different issue to work on.

chrisbobbe avatar Jan 17 '23 21:01 chrisbobbe

To expand on @chrisbobbe's last comment above: the root of this issue is that our current UI for editing a message is tightly bound up with the one for composing a new message. Quoting a summary I wrote elsewhere:

In general the edit-message UI in the mobile app is somewhat unloved; as you noted, the UX for it is borrowed from composing a message (and rather awkwardly so), and the code to implement editing a message is likewise rather jammed into the code for composing. One consequence is that it's easy to accidentally pick up behaviors that compose has even when they aren't intended.

We don't have a UI for composing a new message on the "All messages" screen, because that'd require a significantly more complex compose box that would be tough to make a good experience on mobile. (The complexity of options there for choosing where the message goes would be similar to the compose box on web/desktop — which was a recurring focus of user confusion for a very long time, and for that reason has had probably more complete overhauls than any other component in the web app.) Ergo, because our UI for editing a message is closely tied to that for composing one, the "All messages" screen doesn't support editing a message either.

The path to fixing this therefore runs through disentangling editing from composing — at the code level, at a minimum. Because this codebase is now in maintenance mode as we're focused on building a new Zulip mobile app in Flutter, we won't end up doing that work here. But we'll certainly work to avoid that level of entanglement when we go to implement editing in the Flutter app:

  • https://github.com/zulip/zulip-flutter/issues/126

And then it should be straightforward to support editing in the "All messages" screen just like on the other message-list screens.

(Thanks @PoignardAzur for the very clear report!)

gnprice avatar Mar 05 '24 00:03 gnprice