Skip to content

Support sending replies to a specific message #83

Closed
@kevinaboos

Description

@kevinaboos

This feature will enable the user to reply to a particular message. Currently Robrix only supports sending a standalone message that is not in-reply-to anything.

Implementation Approach

This requires modifying the UI in two places:

  1. adding a reply button to each message
  2. adding a "Replying-to" preview above the message input box

Reply button

For the Makepad DSL components, we can add a Reply IconButton to all of the Message-like views. Most likely, the best place to add this is as part of the MessageMenu, which itself needs to be redesigned entirely.

By default, this view would be marked as visible: false, and would only be set to visible upon hover, or by showing a context menu when right-clicking / long-pressing on a message. I think the best option is to show this on the upper-right corner of the message, which is what both Element and Discord do (see the Examples section below).

Note that we should only show the reply button if the message can be replied to, which can be determined via this function.

Makepad doesn't yet have built-in support for context menus, so it is probably best to initially make the buttons (and the MessageMenu) visible at all times (instead of just upon hover).

Makepad also doesn't yet support gestures, but eventually when it does, we'll want to add a swipe gesture to reply to a message too.

Replying-to message preview

Once the reply button has been pressed, we should add a view right above the message_input text input box (at the bottom of the RoomScreen) that shows a preview of the message that the user is about to reply to. We could likely re-use the ReplyPreview suggested in issue #82 for this.

In addition, we need a cancel (X) button that sits at the far right side of the reply preview, which allows the user to cancel the reply action, which will make the current message being composed in the message_input text box act as a regular standalone message.

Here's an example of how Element displays this "Replying to" preview:

image

Actually sending the message

Currently, messages are sent in the code here:

submit_async_request(MatrixRequest::SendMessage {

It should be straightforward to augment this to support sending a reply message. Currently, the actual message is sent here:

timeline.send(message.into()).await;
, but we should be able to easily add another case where we use send_reply() function provided by the Matrix SDK.

Examples

Here's how Element on desktop shows a message menu upon hovering over it, with the reply button in the middle:

image

Here's how Discord shows the reply button:

image

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthelp wantedLooking for help from anyone!

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions