diff --git a/src/HtmlUtils.js b/src/HtmlUtils.js
index d4a999a5ac..c0e814e49c 100644
--- a/src/HtmlUtils.js
+++ b/src/HtmlUtils.js
@@ -100,9 +100,9 @@ var sanitizeHtmlParams = {
if (m) {
var entity = m[1];
if (entity[0] === '@') {
- attribs.href = '#'; // TODO
+ attribs.href = '#/user/' + entity;
}
- else if (entity[0] === '#') {
+ else if (entity[0] === '#' || entity[0] === '!') {
attribs.href = '#/room/' + entity;
}
delete attribs.target;
diff --git a/src/components/structures/MatrixChat.js b/src/components/structures/MatrixChat.js
index 743f30aa15..839d59e2d9 100644
--- a/src/components/structures/MatrixChat.js
+++ b/src/components/structures/MatrixChat.js
@@ -176,12 +176,12 @@ module.exports = React.createClass({
// this can technically be done anywhere but doing this here keeps all
// the routing url path logic together.
- // if (this.onAliasClick) {
- // linkifyMatrix.onAliasClick = this.onAliasClick;
- // }
- // if (this.onUserClick) {
- // linkifyMatrix.onUserClick = this.onUserClick;
- // }
+ if (this.onAliasClick) {
+ linkifyMatrix.onAliasClick = this.onAliasClick;
+ }
+ if (this.onUserClick) {
+ linkifyMatrix.onUserClick = this.onUserClick;
+ }
window.addEventListener('resize', this.handleResize);
this.handleResize();
@@ -761,29 +761,29 @@ module.exports = React.createClass({
}
},
- // onAliasClick: function(event, alias) {
- // event.preventDefault();
- // dis.dispatch({action: 'view_room', room_alias: alias});
- // },
+ onAliasClick: function(event, alias) {
+ event.preventDefault();
+ dis.dispatch({action: 'view_room', room_alias: alias});
+ },
- // onUserClick: function(event, userId) {
- // event.preventDefault();
+ onUserClick: function(event, userId) {
+ event.preventDefault();
- // // var MemberInfo = sdk.getComponent('rooms.MemberInfo');
- // // var member = new Matrix.RoomMember(null, userId);
- // // ContextualMenu.createMenu(MemberInfo, {
- // // member: member,
- // // right: window.innerWidth - event.pageX,
- // // top: event.pageY
- // // });
+ // var MemberInfo = sdk.getComponent('rooms.MemberInfo');
+ // var member = new Matrix.RoomMember(null, userId);
+ // ContextualMenu.createMenu(MemberInfo, {
+ // member: member,
+ // right: window.innerWidth - event.pageX,
+ // top: event.pageY
+ // });
- // var member = new Matrix.RoomMember(null, userId);
- // if (!member) { return; }
- // dis.dispatch({
- // action: 'view_user',
- // member: member,
- // });
- // },
+ var member = new Matrix.RoomMember(null, userId);
+ if (!member) { return; }
+ dis.dispatch({
+ action: 'view_user',
+ member: member,
+ });
+ },
onLogoutClick: function(event) {
dis.dispatch({
diff --git a/src/linkify-matrix.js b/src/linkify-matrix.js
index eaddbffebc..594c0c6a22 100644
--- a/src/linkify-matrix.js
+++ b/src/linkify-matrix.js
@@ -96,8 +96,8 @@ function matrixLinkify(linkify) {
}
// stubs, overwritten in MatrixChat's componentDidMount
-// matrixLinkify.onUserClick = function(e, userId) { e.preventDefault(); };
-// matrixLinkify.onAliasClick = function(e, roomAlias) { e.preventDefault(); };
+matrixLinkify.onUserClick = function(e, userId) { e.preventDefault(); };
+matrixLinkify.onAliasClick = function(e, roomAlias) { e.preventDefault(); };
var escapeRegExp = function(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
@@ -113,7 +113,6 @@ matrixLinkify.VECTOR_URL_PATTERN = "^(?:https?:\/\/)?(?:"
matrixLinkify.MATRIXTO_URL_PATTERN = "^(?:https?:\/\/)?(?:www\\.)?matrix\\.to/#/((#|@).*)";
matrixLinkify.options = {
-/*
events: function (href, type) {
switch (type) {
case "userid":
@@ -130,7 +129,7 @@ matrixLinkify.options = {
};
}
},
-*/
+
formatHref: function (href, type) {
switch (type) {
case 'roomalias':
@@ -148,9 +147,9 @@ matrixLinkify.options = {
if (m) {
var entity = m[1];
if (entity[0] === '@') {
- return '#'; // TODO
+ return '#/user/' + entity;
}
- else if (entity[0] === '#') {
+ else if (entity[0] === '#' || entity[0] === '!') {
return '#/room/' + entity;
}
}