From 2fcca5d4e4eb6873b20ad536c04c62a863d72359 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 20 Mar 2020 00:42:44 +0000 Subject: [PATCH 1/2] Handle matrix.to user permalink in-room rather than solo Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/linkify-matrix.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/linkify-matrix.js b/src/linkify-matrix.js index 2d2b9c62a5..def1e80736 100644 --- a/src/linkify-matrix.js +++ b/src/linkify-matrix.js @@ -16,7 +16,11 @@ limitations under the License. */ import {baseUrl} from "./utils/permalinks/SpecPermalinkConstructor"; -import {tryTransformEntityToPermalink, tryTransformPermalinkToLocalHref} from "./utils/permalinks/Permalinks"; +import { + parsePermalink, + tryTransformEntityToPermalink, + tryTransformPermalinkToLocalHref +} from "./utils/permalinks/Permalinks"; function matrixLinkify(linkify) { // Text tokens @@ -194,6 +198,18 @@ matrixLinkify.MATRIXTO_BASE_URL= baseUrl; matrixLinkify.options = { events: function(href, type) { switch (type) { + case "url": { + // intercept local permalinks to users and show them like userids (in userinfo of current room) + const permalink = parsePermalink(href); + if (permalink && permalink.userId) { + return { + click: function(e) { + matrixLinkify.onUserClick(e, permalink.userId); + }, + }; + } + break; + } case "userid": return { click: function(e) { From 61a9dd0ee3805575ccb631b1f9a9741c6df87579 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Fri, 20 Mar 2020 00:56:41 +0000 Subject: [PATCH 2/2] delint Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/linkify-matrix.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/linkify-matrix.js b/src/linkify-matrix.js index def1e80736..cff7a93d08 100644 --- a/src/linkify-matrix.js +++ b/src/linkify-matrix.js @@ -19,7 +19,7 @@ import {baseUrl} from "./utils/permalinks/SpecPermalinkConstructor"; import { parsePermalink, tryTransformEntityToPermalink, - tryTransformPermalinkToLocalHref + tryTransformPermalinkToLocalHref, } from "./utils/permalinks/Permalinks"; function matrixLinkify(linkify) {