Introduce Membership type

This commit is contained in:
Stanislav Demydiuk 2024-03-11 17:16:53 +00:00 committed by Andy Balaam
parent 3c6fd58628
commit da99bad7b9
115 changed files with 582 additions and 526 deletions

View file

@ -33,7 +33,7 @@ interface IProps {
const RoomInfoLine: FC<IProps> = ({ room }) => {
// summary will begin as undefined whilst loading and go null if it fails to load or we are not invited.
const summary = useAsyncMemo(async (): Promise<Awaited<ReturnType<MatrixClient["getRoomSummary"]>> | null> => {
if (room.getMyMembership() !== "invite") return null;
if (room.getMyMembership() !== Membership.Invite) return null;
try {
return await room.client.getRoomSummary(room.roomId);
} catch (e) {
@ -61,7 +61,7 @@ const RoomInfoLine: FC<IProps> = ({ room }) => {
}
let members: JSX.Element | undefined;
if (membership === "invite" && summary) {
if (membership === Membership.Invite && summary) {
// Don't trust local state and instead use the summary API
members = (
<span className="mx_RoomInfoLine_members">