Join rooms when visiting them

BUG: 477261
This commit is contained in:
Tobias Fella
2023-11-24 16:33:40 +01:00
parent 6baf2e4888
commit 410258c478
4 changed files with 9 additions and 3 deletions

View File

@@ -82,7 +82,7 @@ Loader {
} }
</style> </style>
<a href=\"" + root.linkPreviewer.url + "\">" + (maximizeButton.checked ? root.linkPreviewer.title : titleTextMetrics.elidedText).replace("&ndash;", "—") + "</a>" <a href=\"" + root.linkPreviewer.url + "\">" + (maximizeButton.checked ? root.linkPreviewer.title : titleTextMetrics.elidedText).replace("&ndash;", "—") + "</a>"
onLinkActivated: RoomManager.openResource(link) onLinkActivated: RoomManager.openResource(link, "join")
TextMetrics { TextMetrics {
id: titleTextMetrics id: titleTextMetrics

View File

@@ -315,7 +315,7 @@ Loader {
Layout.fillWidth: true Layout.fillWidth: true
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
onLinkActivated: RoomManager.openResource(link); onLinkActivated: RoomManager.openResource(link, "join");
} }
} }
} }

View File

@@ -112,7 +112,7 @@ a{
onLinkActivated: link => { onLinkActivated: link => {
spoilerRevealed = true spoilerRevealed = true
RoomManager.openResource(link) RoomManager.openResource(link, "join")
} }
onHoveredLinkChanged: if (hoveredLink.length > 0 && hoveredLink !== "1") { onHoveredLinkChanged: if (hoveredLink.length > 0 && hoveredLink !== "1") {
applicationWindow().hoverLinkIndicator.text = hoveredLink; applicationWindow().hoverLinkIndicator.text = hoveredLink;

View File

@@ -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)); 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 } else { // Invalid cases should have been eliminated earlier
Q_ASSERT(result == Quotient::UriResolved); 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<NeoChatRoom *>(room));
});
}
} }
} }