mirror of
https://github.com/tulir/gomuks.git
synced 2025-04-19 18:13:41 -05:00
web/statestore: fix dm_user_id field in room list entries
This commit is contained in:
parent
0b424e59bf
commit
a0bc1b0d17
5 changed files with 8 additions and 8 deletions
|
@ -103,8 +103,8 @@ export const getRoomAvatarURL = (room: RoomForAvatarURL, avatarOverride?: Conten
|
||||||
if ("dm_user_id" in room) {
|
if ("dm_user_id" in room) {
|
||||||
dmUserID = room.dm_user_id
|
dmUserID = room.dm_user_id
|
||||||
} else if ("lazy_load_summary" in room) {
|
} else if ("lazy_load_summary" in room) {
|
||||||
dmUserID = room.lazy_load_summary?.heroes?.length === 1
|
dmUserID = room.lazy_load_summary?.["m.heroes"]?.length === 1
|
||||||
? room.lazy_load_summary.heroes[0] : undefined
|
? room.lazy_load_summary["m.heroes"][0] : undefined
|
||||||
}
|
}
|
||||||
return getAvatarURL(dmUserID ?? room.room_id, {
|
return getAvatarURL(dmUserID ?? room.room_id, {
|
||||||
displayname: room.name,
|
displayname: room.name,
|
||||||
|
|
|
@ -143,8 +143,8 @@ export class StateStore {
|
||||||
const name = entry.meta.name ?? "Unnamed room"
|
const name = entry.meta.name ?? "Unnamed room"
|
||||||
return {
|
return {
|
||||||
room_id: entry.meta.room_id,
|
room_id: entry.meta.room_id,
|
||||||
dm_user_id: entry.meta.lazy_load_summary?.heroes?.length === 1
|
dm_user_id: entry.meta.lazy_load_summary?.["m.heroes"]?.length === 1
|
||||||
? entry.meta.lazy_load_summary.heroes[0] : undefined,
|
? entry.meta.lazy_load_summary["m.heroes"][0] : undefined,
|
||||||
sorting_timestamp: entry.meta.sorting_timestamp,
|
sorting_timestamp: entry.meta.sorting_timestamp,
|
||||||
preview_event,
|
preview_event,
|
||||||
preview_sender,
|
preview_sender,
|
||||||
|
|
|
@ -62,7 +62,7 @@ function arraysAreEqual<T>(arr1?: T[], arr2?: T[]): boolean {
|
||||||
function llSummaryIsEqual(ll1?: LazyLoadSummary, ll2?: LazyLoadSummary): boolean {
|
function llSummaryIsEqual(ll1?: LazyLoadSummary, ll2?: LazyLoadSummary): boolean {
|
||||||
return ll1?.["m.joined_member_count"] === ll2?.["m.joined_member_count"] &&
|
return ll1?.["m.joined_member_count"] === ll2?.["m.joined_member_count"] &&
|
||||||
ll1?.["m.invited_member_count"] === ll2?.["m.invited_member_count"] &&
|
ll1?.["m.invited_member_count"] === ll2?.["m.invited_member_count"] &&
|
||||||
arraysAreEqual(ll1?.heroes, ll2?.heroes)
|
arraysAreEqual(ll1?.["m.heroes"], ll2?.["m.heroes"])
|
||||||
}
|
}
|
||||||
|
|
||||||
function visibleMetaIsEqual(meta1: DBRoom, meta2: DBRoom): boolean {
|
function visibleMetaIsEqual(meta1: DBRoom, meta2: DBRoom): boolean {
|
||||||
|
|
|
@ -43,7 +43,7 @@ export interface TombstoneEventContent {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface LazyLoadSummary {
|
export interface LazyLoadSummary {
|
||||||
heroes?: UserID[]
|
"m.heroes"?: UserID[]
|
||||||
"m.joined_member_count"?: number
|
"m.joined_member_count"?: number
|
||||||
"m.invited_member_count"?: number
|
"m.invited_member_count"?: number
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,8 @@ const MutualRooms = ({ client, userID }: MutualRoomsProps) => {
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
room_id: roomID,
|
room_id: roomID,
|
||||||
dm_user_id: roomData.meta.current.lazy_load_summary?.heroes?.length === 1
|
dm_user_id: roomData.meta.current.lazy_load_summary?.["m.heroes"]?.length === 1
|
||||||
? roomData.meta.current.lazy_load_summary.heroes[0] : undefined,
|
? roomData.meta.current.lazy_load_summary["m.heroes"][0] : undefined,
|
||||||
name: roomData.meta.current.name ?? "Unnamed room",
|
name: roomData.meta.current.name ?? "Unnamed room",
|
||||||
avatar: roomData.meta.current.avatar,
|
avatar: roomData.meta.current.avatar,
|
||||||
search_name: "",
|
search_name: "",
|
||||||
|
|
Loading…
Add table
Reference in a new issue