mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-20 10:33:41 -05:00
web/timeline: decode matrix uris when clicking
This commit is contained in:
parent
b552b07c74
commit
fe6156302d
1 changed files with 5 additions and 4 deletions
|
@ -27,18 +27,19 @@ function isAnchorElement(elem: EventTarget): elem is HTMLAnchorElement {
|
|||
function onClickMatrixURI(href: string) {
|
||||
const url = new URL(href)
|
||||
const pathParts = url.pathname.split("/")
|
||||
const decodedPart = decodeURIComponent(pathParts[1])
|
||||
switch (pathParts[0]) {
|
||||
case "u":
|
||||
return window.mainScreenContext.setRightPanel({
|
||||
type: "user",
|
||||
userID: pathParts[1],
|
||||
userID: `@${decodedPart}`,
|
||||
})
|
||||
case "roomid":
|
||||
return window.mainScreenContext.setActiveRoom(pathParts[1])
|
||||
return window.mainScreenContext.setActiveRoom(`!${decodedPart}`)
|
||||
case "r":
|
||||
return window.client.rpc.resolveAlias(`#${pathParts[1]}`).then(
|
||||
return window.client.rpc.resolveAlias(`#${decodedPart}`).then(
|
||||
res => window.mainScreenContext.setActiveRoom(res.room_id),
|
||||
err => window.alert(`Failed to resolve room alias #${pathParts[1]}: ${err}`),
|
||||
err => window.alert(`Failed to resolve room alias #${decodedPart}: ${err}`),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue