Send room display name as part of invite link (if needed)

This commit is contained in:
N-Pex 2023-05-23 16:29:17 +02:00
parent f551f96f50
commit b097fd51d8
5 changed files with 25 additions and 5 deletions

View file

@ -140,8 +140,13 @@ router.beforeEach((to, from, next) => {
}
});
router.getRoomLink = function (roomId) {
return window.location.origin + window.location.pathname + "#/room/" + encodeURIComponent(util.sanitizeRoomId(roomId));
router.getRoomLink = function (alias, roomId, roomName) {
if ((!alias || roomName.replace(/\s/g, "").toLowerCase() !== util.getRoomNameFromAlias(alias)) && roomName) {
// There is no longer a correlation between alias and room name, probably because room name has
// changed. Include the "?roomName" part
return window.location.origin + window.location.pathname + "?roomName=" + encodeURIComponent(roomName) + "#/room/" + encodeURIComponent(util.sanitizeRoomId(alias || roomId));
}
return window.location.origin + window.location.pathname + "#/room/" + encodeURIComponent(util.sanitizeRoomId(alias || roomId));
}
export default router