Improved BaseURL and DM link handling
This commit is contained in:
parent
b14749c28f
commit
dd70e4a576
9 changed files with 373 additions and 322 deletions
|
|
@ -130,9 +130,9 @@ router.beforeEach((to, from, next) => {
|
|||
if (roomId && !roomId.startsWith("@")) {
|
||||
// Not a full username. Assume local name on this server.
|
||||
return router.app.$config.promise.then((config) => {
|
||||
const user = new User(config.defaultServer, roomId, "");
|
||||
user.normalize();
|
||||
roomId = "@" + roomId + ":" + User.serverDomain(user.home_server);
|
||||
const domain = config.homeServer;
|
||||
if (!domain) throw new Error("No domain part for user invite!");
|
||||
roomId = "@" + roomId + ":" + domain;
|
||||
router.app.$matrix.setCurrentRoomId(roomId);
|
||||
}).catch(err => console.error(err)).finally(() => next());
|
||||
} else {
|
||||
|
|
@ -186,7 +186,7 @@ router.getRoomLink = function (alias, roomId, roomName, mode) {
|
|||
|
||||
router.getDMLink = function (user, config) {
|
||||
let userId = user.user_id;
|
||||
if (user.home_server === config.defaultServer) {
|
||||
if (User.domainPart(userId) === config.homeServer && !config.useFullyQualifiedDMLinks) {
|
||||
// Using default server, don't include it in the link
|
||||
userId = User.localPart(user.user_id);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue