Make room alias & user ID links matrix.to links

This commit is contained in:
David Baker 2016-11-04 11:38:28 +00:00
parent 3a0b63dbda
commit 04c27205a3

View file

@ -126,6 +126,7 @@ matrixLinkify.VECTOR_URL_PATTERN = "^(?:https?:\/\/)?(?:"
+ ")(#.*)"; + ")(#.*)";
matrixLinkify.MATRIXTO_URL_PATTERN = "^(?:https?:\/\/)?(?:www\\.)?matrix\\.to/#/((#|@|!).*)"; matrixLinkify.MATRIXTO_URL_PATTERN = "^(?:https?:\/\/)?(?:www\\.)?matrix\\.to/#/((#|@|!).*)";
matrixLinkify.MATRIXTO_BASE_URL= "https://matrix.to";
matrixLinkify.options = { matrixLinkify.options = {
events: function (href, type) { events: function (href, type) {
@ -148,9 +149,8 @@ matrixLinkify.options = {
formatHref: function (href, type) { formatHref: function (href, type) {
switch (type) { switch (type) {
case 'roomalias': case 'roomalias':
return '#/room/' + href;
case 'userid': case 'userid':
return '#/user/' + href; return matrixLinkify.MATRIXTO_BASE_URL + '/#/' + href;
default: default:
var m; var m;
// FIXME: horrible duplication with HtmlUtils' transform tags // FIXME: horrible duplication with HtmlUtils' transform tags