Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions ee/packages/federation-matrix/src/api/_matrix/invite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,13 +238,6 @@ async function joinRoom({
const internalMappedRoomId = await MatrixBridgedRoom.getLocalRoomId(inviteEvent.roomId);

if (!internalMappedRoomId) {
let roomName: string;
try {
roomName = matrixRoom.name || '';
} catch (error) {
roomName = inviteEvent.roomId.split(':')[0].replace('!', '') || 'Unnamed Room';
}

let roomType: 'c' | 'p' | 'd';

if (isDM) {
Expand Down Expand Up @@ -272,6 +265,10 @@ async function joinRoom({
throw new Error('inviteeUser user not found');
}

// TODO: Rethink room name on DMs
// get the other user than ourself
const roomName = matrixRoom.name === senderUser.username ? inviteeUser.username : senderUser.username;

ourRoom = await Room.create(senderUserId, {
type: roomType,
name: roomName,
Expand All @@ -285,6 +282,9 @@ async function joinRoom({
},
});
} else {
const roomFname = `${matrixRoom.name}:${matrixRoom.origin}`;
const roomName = inviteEvent.roomId.replace('!', '').replace(':', '_');

ourRoom = await Room.create(senderUserId, {
type: roomType,
name: roomName,
Expand All @@ -294,6 +294,7 @@ async function joinRoom({
},
extraData: {
federated: true,
fname: roomFname,
},
});
}
Expand Down
Loading