Remove global "auto_join_rooms" flag and use optional "/join" segments in invite links
Generated for channels, not for "normal" rooms.
This commit is contained in:
parent
ff7851cb53
commit
59f551de75
7 changed files with 14 additions and 34 deletions
|
|
@ -20,13 +20,13 @@ const routes = [
|
|||
component: Home
|
||||
},
|
||||
{
|
||||
path: '/room/:roomId?',
|
||||
path: '/room/:join(join/)?:roomId?',
|
||||
name: 'Chat',
|
||||
component: Chat,
|
||||
meta: {
|
||||
includeRoom: true,
|
||||
includeFavicon: true
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
path: '/info',
|
||||
|
|
@ -73,7 +73,7 @@ const routes = [
|
|||
props: true
|
||||
},
|
||||
{
|
||||
path: '/join/:roomId?',
|
||||
path: '/join/:join(join/)?:roomId?',
|
||||
name: 'Join',
|
||||
component: Join
|
||||
},
|
||||
|
|
@ -170,7 +170,7 @@ router.beforeEach((to, from, next) => {
|
|||
}
|
||||
});
|
||||
|
||||
router.getRoomLink = function (alias, roomId, roomName, mode) {
|
||||
router.getRoomLink = function (alias, roomId, roomName, mode, autojoin) {
|
||||
let params = {};
|
||||
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
|
||||
|
|
@ -181,13 +181,14 @@ router.getRoomLink = function (alias, roomId, roomName, mode) {
|
|||
// Optional mode given, append as "m" query param
|
||||
params["m"] = mode;
|
||||
}
|
||||
const autoJoinSegment = autojoin ? "join/" : "";
|
||||
if (Object.entries(params).length > 0) {
|
||||
const queryString = Object.entries(params)
|
||||
.map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
|
||||
.join('&')
|
||||
return window.location.origin + window.location.pathname + "?" + queryString + "#/room/" + encodeURIComponent(util.sanitizeRoomId(alias || roomId));
|
||||
return window.location.origin + window.location.pathname + "?" + queryString + "#/room/" + autoJoinSegment + encodeURIComponent(util.sanitizeRoomId(alias || roomId));
|
||||
}
|
||||
return window.location.origin + window.location.pathname + "#/room/" + encodeURIComponent(util.sanitizeRoomId(alias || roomId));
|
||||
return window.location.origin + window.location.pathname + "#/room/" + autoJoinSegment + encodeURIComponent(util.sanitizeRoomId(alias || roomId));
|
||||
}
|
||||
|
||||
router.getDMLink = function (user, config) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue