Skip to content
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

Properly handle matrix.to links for Rooms #87

Open
kevinaboos opened this issue Jul 15, 2024 · 3 comments
Open

Properly handle matrix.to links for Rooms #87

kevinaboos opened this issue Jul 15, 2024 · 3 comments
Assignees
Labels
enhancement New feature or request help wanted Looking for help from anyone!

Comments

@kevinaboos
Copy link
Member

kevinaboos commented Jul 15, 2024

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

@kevinaboos kevinaboos added enhancement New feature or request help wanted Looking for help from anyone! labels Jul 15, 2024
@kevinaboos kevinaboos moved this to Ready in Robrix Aug 19, 2024
@kevinaboos kevinaboos changed the title Properly handle matrix.to links for Rooms and Messages Properly handle matrix.to links for links Rooms and Messages (events) Aug 20, 2024
@kevinaboos kevinaboos moved this from Ready to Blocked in Robrix Sep 9, 2024
@kevinaboos
Copy link
Member Author

kevinaboos commented Sep 9, 2024

This is blocked; it needs support from the new Robrix UI for navigating between different rooms programmatically (in order to jump to an event in a different room).

@kevinaboos kevinaboos changed the title Properly handle matrix.to links for links Rooms and Messages (events) Properly handle matrix.to links for Rooms Oct 31, 2024
@kevinaboos kevinaboos moved this from Blocked to Ready in Robrix Oct 31, 2024
@kevinaboos
Copy link
Member Author

This is now unblocked, as the dock-tab UI and the mobile stack navigation both support jumping to or opening another room.

@aaravlu
Copy link
Contributor

aaravlu commented Nov 7, 2024

I am looking at this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Looking for help from anyone!
Projects
Status: Ready
Development

No branches or pull requests

3 participants