Merge pull request #860 from vector-im/dbkr/lowercase_room_alias
Lowercase room alias before joining
This commit is contained in:
		
				commit
				
					
						c2883e52bb
					
				
			
		
					 2 changed files with 11 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -211,6 +211,12 @@ export function fullAliasFromRoomName(
 | 
			
		|||
  return `#${roomAliasLocalpartFromRoomName(roomName)}:${client.getDomain()}`;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * XXX: What is this trying to do? It looks like it's getting the localpart from
 | 
			
		||||
 * a room alias, but why is it splitting on hyphens and then putting spaces in??
 | 
			
		||||
 * @param roomId
 | 
			
		||||
 * @returns
 | 
			
		||||
 */
 | 
			
		||||
export function roomNameFromRoomId(roomId: string): string {
 | 
			
		||||
  return roomId
 | 
			
		||||
    .match(/([^:]+):.*$/)[1]
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -52,7 +52,11 @@ export const useLoadGroupCall = (
 | 
			
		|||
 | 
			
		||||
    const fetchOrCreateRoom = async (): Promise<Room> => {
 | 
			
		||||
      try {
 | 
			
		||||
        const room = await client.joinRoom(roomIdOrAlias, { viaServers });
 | 
			
		||||
        // We lowercase the localpart when we create the room, so we must lowercase
 | 
			
		||||
        // it here too (we just do the whole alias).
 | 
			
		||||
        const room = await client.joinRoom(roomIdOrAlias.toLowerCase(), {
 | 
			
		||||
          viaServers,
 | 
			
		||||
        });
 | 
			
		||||
        logger.info(
 | 
			
		||||
          `Joined ${roomIdOrAlias}, waiting room to be ready for group calls`
 | 
			
		||||
        );
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue