forked from Mirrors/gomuks
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) {
|
function onClickMatrixURI(href: string) {
|
||||||
const url = new URL(href)
|
const url = new URL(href)
|
||||||
const pathParts = url.pathname.split("/")
|
const pathParts = url.pathname.split("/")
|
||||||
|
const decodedPart = decodeURIComponent(pathParts[1])
|
||||||
switch (pathParts[0]) {
|
switch (pathParts[0]) {
|
||||||
case "u":
|
case "u":
|
||||||
return window.mainScreenContext.setRightPanel({
|
return window.mainScreenContext.setRightPanel({
|
||||||
type: "user",
|
type: "user",
|
||||||
userID: pathParts[1],
|
userID: `@${decodedPart}`,
|
||||||
})
|
})
|
||||||
case "roomid":
|
case "roomid":
|
||||||
return window.mainScreenContext.setActiveRoom(pathParts[1])
|
return window.mainScreenContext.setActiveRoom(`!${decodedPart}`)
|
||||||
case "r":
|
case "r":
|
||||||
return window.client.rpc.resolveAlias(`#${pathParts[1]}`).then(
|
return window.client.rpc.resolveAlias(`#${decodedPart}`).then(
|
||||||
res => window.mainScreenContext.setActiveRoom(res.room_id),
|
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