Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Make read receipts handle nullable roomMembers correctly #8410

Merged
merged 4 commits into from
Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/views/avatars/MemberAvatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import SettingsStore from "../../../settings/SettingsStore";
import { MatrixClientPeg } from "../../../MatrixClientPeg";

interface IProps extends Omit<React.ComponentProps<typeof BaseAvatar>, "name" | "idName" | "url"> {
member: RoomMember;
member: RoomMember | null;
fallbackUserId?: string;
width: number;
height: number;
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/rooms/EventTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export type GetRelationsForEvent = (eventId: string, relationType: string, event

export interface IReadReceiptProps {
userId: string;
roomMember: RoomMember;
roomMember: RoomMember | null;
ts: number;
}

Expand Down
7 changes: 4 additions & 3 deletions src/components/views/rooms/ReadReceiptGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ limitations under the License.
*/

import React, { PropsWithChildren, useRef } from "react";
import { User } from "matrix-js-sdk/src/matrix";

import ReadReceiptMarker, { IReadReceiptInfo } from "./ReadReceiptMarker";
import { IReadReceiptProps } from "./EventTile";
Expand Down Expand Up @@ -188,7 +189,7 @@ function ReadReceiptPerson({ userId, roomMember, ts, isTwelveHour, onAfterClick
label: (
<>
<div className="mx_Tooltip_title">
{ roomMember.rawDisplayName ?? userId }
{ roomMember?.rawDisplayName ?? userId }
</div>
<div className="mx_Tooltip_sub">
{ userId }
Expand All @@ -203,7 +204,7 @@ function ReadReceiptPerson({ userId, roomMember, ts, isTwelveHour, onAfterClick
onClick={() => {
dis.dispatch({
action: Action.ViewUser,
member: roomMember,
member: roomMember ?? { userId } as User,
justjanne marked this conversation as resolved.
Show resolved Hide resolved
push: false,
});
onAfterClick?.();
Expand All @@ -225,7 +226,7 @@ function ReadReceiptPerson({ userId, roomMember, ts, isTwelveHour, onAfterClick
hideTitle
/>
<div className="mx_ReadReceiptGroup_name">
<p>{ roomMember.name }</p>
<p>{ roomMember?.name ?? userId }</p>
<p className="mx_ReadReceiptGroup_secondary">
{ formatDate(new Date(ts), isTwelveHour) }
</p>
Expand Down
2 changes: 1 addition & 1 deletion src/components/views/rooms/ReadReceiptMarker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface IReadReceiptInfo {

interface IProps {
// the RoomMember to show the RR for
member?: RoomMember;
member?: RoomMember | null;
// userId to fallback the avatar to
// if the member hasn't been loaded yet
fallbackUserId: string;
Expand Down