Skip to content

Properly handle matrix.to links for Rooms #87

@kevinaboos

Description

@kevinaboos

These links are special and should be handled via in-app actions rather than by opening them as a regular URL in the system browser.

There is a separate issue #222 for handling matrix.to links to a specific Event, which is much more complicated.

Implementation

Currently, Robrix just ignores matrix.to links that are clicked on, as seen in the code here:

// Handle a link being clicked.
if let HtmlLinkAction::Clicked { url, .. } = action.as_widget_action().cast() {
if url.starts_with("https://matrix.to/#/") {
log!("TODO: handle Matrix link internally: {url:?}");
// TODO: show a pop-up pane with the user's profile, or a room preview pane.
//
// There are four kinds of matrix.to schemes:
// See here: <https://github.com/matrix-org/matrix.to?tab=readme-ov-file#url-scheme>
// 1. Rooms: https://matrix.to/#/#matrix:matrix.org
// 2. Rooms by ID: https://matrix.to/#/!cURbafjkfsMDVwdRDQ:matrix.org
// 3. Users: https://matrix.to/#/@matthew:matrix.org
// 4. Messages: https://matrix.to/#/#matrix:matrix.org/$1448831580433WbpiJ:jki.re

Note that issue #84 already covers one specific case of this: links to Users, which should be displayed as a special UserTag widget.

This issue covers one other type of matrix.to links:

  • Rooms via alias (e.g., https://matrix.to/#/#matrix:matrix.org), and rooms by ID (e.g., https://matrix.to/#/!cURbafjkfsMDVwdRDQ:matrix.org)

Links to a room

We should create a RoomTag widget similar to the UserTag widget mentioned above, which looks like this in Element:
image

Upon click, if the current user has already joined the room, we simply open that room's timeline view.

However, if the user has not yet joined that room, Robrix should open a preview view of the room that shows the last few messages

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthelp wantedLooking for help from anyone!

Projects

Status

Ready

Relationships

None yet

Development

No branches or pull requests

Issue actions