Parse display name from user ID.

Clicking "In Reply To" now switches to the event if possible.
This commit is contained in:
Black Hat
2018-11-26 09:15:43 +08:00
parent d1186ea810
commit 1c499ddb90
2 changed files with 23 additions and 5 deletions

View File

@@ -98,7 +98,7 @@ ColumnLayout {
id: contentLabel
text: "<style>a{color: white;} .user-pill{color: white}</style>" + display
text: "<style>a{color: white;} .user-pill{}</style>" + display
color: "white"
@@ -111,7 +111,17 @@ ColumnLayout {
selectionColor: "white"
textFormat: Text.RichText
onLinkActivated: Qt.openUrlExternally(link)
onLinkActivated: {
if (link.startsWith("https://matrix.to/")) {
var result = link.replace(/\?.*/, "").match("https://matrix.to/#/(!.*:.*)/(\\$.*:.*)")
if (result.length < 3) return
if (result[1] != currentRoom.id) return
if (!result[2]) return
goToEvent(result[2])
} else {
Qt.openUrlExternally(link)
}
}
MouseArea {
anchors.fill: parent