mirror of
https://github.com/block/goose.git
synced 2026-07-17 12:56:20 +02:00
fix: Matrix invitation user ID formatting
Fixed MatrixError: Expected UserID string to start with '@' The issue was that Matrix user IDs must always start with '@' but the inviteToRoom method was not ensuring proper formatting. Changes: - Added user ID formatting in MatrixService.inviteToRoom() - Ensures userId starts with '@' before sending to Matrix client - Added logging to show original vs formatted user ID - Handles cases where user IDs come without '@' prefix This fixes invitation failures when user IDs don't have proper Matrix format.
This commit is contained in:
@@ -870,7 +870,17 @@ export class MatrixService extends EventEmitter {
|
||||
throw new Error('Client not initialized');
|
||||
}
|
||||
|
||||
await this.client.invite(roomId, userId);
|
||||
// Ensure userId starts with '@' as required by Matrix
|
||||
const formattedUserId = userId.startsWith('@') ? userId : `@${userId}`;
|
||||
|
||||
console.log('🔗 Inviting user to room:', {
|
||||
roomId,
|
||||
originalUserId: userId,
|
||||
formattedUserId,
|
||||
needsFormatting: !userId.startsWith('@')
|
||||
});
|
||||
|
||||
await this.client.invite(roomId, formattedUserId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user