mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-17 05:55:00 +08:00
Merge pull request #4245 from matrix-org/t3chguy/user_id_matrix_to
Handle matrix.to user permalink in-room rather than solo
This commit is contained in:
commit
a5806d93aa
@ -16,7 +16,11 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {baseUrl} from "./utils/permalinks/SpecPermalinkConstructor";
|
import {baseUrl} from "./utils/permalinks/SpecPermalinkConstructor";
|
||||||
import {tryTransformEntityToPermalink, tryTransformPermalinkToLocalHref} from "./utils/permalinks/Permalinks";
|
import {
|
||||||
|
parsePermalink,
|
||||||
|
tryTransformEntityToPermalink,
|
||||||
|
tryTransformPermalinkToLocalHref,
|
||||||
|
} from "./utils/permalinks/Permalinks";
|
||||||
|
|
||||||
function matrixLinkify(linkify) {
|
function matrixLinkify(linkify) {
|
||||||
// Text tokens
|
// Text tokens
|
||||||
@ -194,6 +198,18 @@ matrixLinkify.MATRIXTO_BASE_URL= baseUrl;
|
|||||||
matrixLinkify.options = {
|
matrixLinkify.options = {
|
||||||
events: function(href, type) {
|
events: function(href, type) {
|
||||||
switch (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":
|
case "userid":
|
||||||
return {
|
return {
|
||||||
click: function(e) {
|
click: function(e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user