diff --git a/src/qml/LinkPreviewDelegate.qml b/src/qml/LinkPreviewDelegate.qml
index 69c61c08f..f52695fcb 100644
--- a/src/qml/LinkPreviewDelegate.qml
+++ b/src/qml/LinkPreviewDelegate.qml
@@ -82,7 +82,7 @@ Loader {
}
" + (maximizeButton.checked ? root.linkPreviewer.title : titleTextMetrics.elidedText).replace("–", "—") + ""
- onLinkActivated: RoomManager.openResource(link)
+ onLinkActivated: RoomManager.openResource(link, "join")
TextMetrics {
id: titleTextMetrics
diff --git a/src/qml/MessageDelegateContextMenu.qml b/src/qml/MessageDelegateContextMenu.qml
index a346ae99a..80e102406 100644
--- a/src/qml/MessageDelegateContextMenu.qml
+++ b/src/qml/MessageDelegateContextMenu.qml
@@ -315,7 +315,7 @@ Loader {
Layout.fillWidth: true
wrapMode: Text.WordWrap
- onLinkActivated: RoomManager.openResource(link);
+ onLinkActivated: RoomManager.openResource(link, "join");
}
}
}
diff --git a/src/qml/RichLabel.qml b/src/qml/RichLabel.qml
index 097f84b11..ad1abe6bd 100644
--- a/src/qml/RichLabel.qml
+++ b/src/qml/RichLabel.qml
@@ -112,7 +112,7 @@ a{
onLinkActivated: link => {
spoilerRevealed = true
- RoomManager.openResource(link)
+ RoomManager.openResource(link, "join")
}
onHoveredLinkChanged: if (hoveredLink.length > 0 && hoveredLink !== "1") {
applicationWindow().hoverLinkIndicator.text = hoveredLink;
diff --git a/src/roommanager.cpp b/src/roommanager.cpp
index a875f820e..6d74caf78 100644
--- a/src/roommanager.cpp
+++ b/src/roommanager.cpp
@@ -95,6 +95,12 @@ void RoomManager::openResource(const QString &idOrUri, const QString &action)
Q_EMIT warning(i18n("Room not found"), i18n("There's no room %1 in the room list. Check the spelling and the account.", idOrUri));
} else { // Invalid cases should have been eliminated earlier
Q_ASSERT(result == Quotient::UriResolved);
+
+ if (uri.type() == Uri::RoomAlias || uri.type() == Uri::RoomId) {
+ connectSingleShot(m_connection, &Connection::newRoom, this, [this, uri](Room *room) {
+ enterRoom(dynamic_cast(room));
+ });
+ }
}
}