Consolidate public room search experience (#9605)

This commit is contained in:
Germain 2022-11-22 15:05:09 +00:00 committed by GitHub
parent 041bb46284
commit 40cbee60db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 388 additions and 1348 deletions

View file

@ -19,7 +19,7 @@ import { IPublicRoomsChunkRoom } from "matrix-js-sdk/src/matrix";
import { linkifyAndSanitizeHtml } from "../../../../HtmlUtils";
import { _t } from "../../../../languageHandler";
import { getDisplayAliasForRoom } from "../../../structures/RoomDirectory";
import { getDisplayAliasForAliasSet } from "../../../../Rooms";
const MAX_NAME_LENGTH = 80;
const MAX_TOPIC_LENGTH = 800;
@ -32,7 +32,9 @@ interface Props {
}
export function PublicRoomResultDetails({ room, labelId, descriptionId, detailsId }: Props): JSX.Element {
let name = room.name || getDisplayAliasForRoom(room) || _t('Unnamed room');
let name = room.name
|| getDisplayAliasForAliasSet(room.canonical_alias ?? "", room.aliases ?? [])
|| _t('Unnamed room');
if (name.length > MAX_NAME_LENGTH) {
name = `${name.substring(0, MAX_NAME_LENGTH)}...`;
}