Handle matrix.to user permalink in-room rather than solo

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
Michael Telatynski 2020-03-20 00:42:44 +00:00
parent 20d0e8a888
commit 2fcca5d4e4

View file

@ -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) {