Ensure room is actually in space hierarchy when resolving its latest version
Relates to: vector-im/element-web#24329pull/28788/head^2
							parent
							
								
									a69b805156
								
							
						
					
					
						commit
						e0e149be3d
					
				|  | @ -413,9 +413,18 @@ interface IHierarchyLevelProps { | |||
|     onToggleClick?(parentId: string, childId: string): void; | ||||
| } | ||||
| 
 | ||||
| const toLocalRoom = (cli: MatrixClient, room: IHierarchyRoom): IHierarchyRoom => { | ||||
| const toLocalRoom = (cli: MatrixClient, room: IHierarchyRoom, hierarchy: RoomHierarchy): IHierarchyRoom => { | ||||
|     const history = cli.getRoomUpgradeHistory(room.room_id, true); | ||||
|     const cliRoom = history[history.length - 1]; | ||||
| 
 | ||||
|     // Pick latest room that is actually part of the hierarchy
 | ||||
|     let cliRoom = null; | ||||
|     for (let idx = history.length - 1; idx >= 0; --idx) { | ||||
|         if (hierarchy.roomMap[history[idx].roomId]) { | ||||
|             cliRoom = history[idx]; | ||||
|             break; | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     if (cliRoom) { | ||||
|         return { | ||||
|             ...room, | ||||
|  | @ -461,7 +470,7 @@ export const HierarchyLevel: React.FC<IHierarchyLevelProps> = ({ | |||
|         (result, ev: IHierarchyRelation) => { | ||||
|             const room = hierarchy.roomMap.get(ev.state_key); | ||||
|             if (room && roomSet.has(room)) { | ||||
|                 result[room.room_type === RoomType.Space ? 0 : 1].push(toLocalRoom(cli, room)); | ||||
|                 result[room.room_type === RoomType.Space ? 0 : 1].push(toLocalRoom(cli, room, hierarchy)); | ||||
|             } | ||||
|             return result; | ||||
|         }, | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Johannes Marbach
						Johannes Marbach