Fix clicking MXID in timeline going to matrix.to (#11263)
* Fix clicking MXID in timeline going to matrix.to * Add tests * Increase coverage
This commit is contained in:
parent
3a784c71e8
commit
cb592dc709
2 changed files with 50 additions and 7 deletions
|
@ -139,7 +139,6 @@ export const options: Opts = {
|
|||
const permalink = parsePermalink(href);
|
||||
if (permalink?.userId) {
|
||||
return {
|
||||
// @ts-ignore see https://linkify.js.org/docs/options.html
|
||||
click: function (e: MouseEvent) {
|
||||
onUserClick(e, permalink.userId!);
|
||||
},
|
||||
|
@ -150,7 +149,6 @@ export const options: Opts = {
|
|||
if (localHref !== href) {
|
||||
// it could be converted to a localHref -> therefore handle locally
|
||||
return {
|
||||
// @ts-ignore see https://linkify.js.org/docs/options.html
|
||||
click: function (e: MouseEvent) {
|
||||
e.preventDefault();
|
||||
window.location.hash = localHref;
|
||||
|
@ -165,17 +163,15 @@ export const options: Opts = {
|
|||
}
|
||||
case Type.UserId:
|
||||
return {
|
||||
// @ts-ignore see https://linkify.js.org/docs/options.html
|
||||
click: function (e: MouseEvent) {
|
||||
const userId = parsePermalink(href)?.userId;
|
||||
const userId = parsePermalink(href)?.userId ?? href;
|
||||
if (userId) onUserClick(e, userId);
|
||||
},
|
||||
};
|
||||
case Type.RoomAlias:
|
||||
return {
|
||||
// @ts-ignore see https://linkify.js.org/docs/options.html
|
||||
click: function (e: MouseEvent) {
|
||||
const alias = parsePermalink(href)?.roomIdOrAlias;
|
||||
const alias = parsePermalink(href)?.roomIdOrAlias ?? href;
|
||||
if (alias) onAliasClick(e, alias);
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue