Use RoomStateEvent.Update for knocks (#11516)

Signed-off-by: Charly Nguyen <charly.nguyen@nordeck.net>
This commit is contained in:
Charly Nguyen 2023-09-05 12:26:37 +02:00 committed by GitHub
parent 93ccccc03d
commit fca9f0e91d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 6 deletions

View file

@ -33,7 +33,7 @@ export const RoomKnocksBar: VFC<{ room: Room }> = ({ room }) => {
const [disabled, setDisabled] = useState(false);
const knockMembers = useTypedEventEmitterState(
room,
RoomStateEvent.Members,
RoomStateEvent.Update,
useCallback(() => room.getMembersWithMembership("knock"), [room]),
);
const knockMembersCount = knockMembers.length;

View file

@ -144,7 +144,7 @@ export const PeopleRoomSettingsTab: VFC<{ room: Room }> = ({ room }) => {
const knockMembers = useTypedEventEmitterState(
room,
RoomStateEvent.Members,
RoomStateEvent.Update,
useCallback(() => room.getMembersWithMembership("knock"), [room]),
);

View file

@ -141,7 +141,7 @@ describe("RoomKnocksBar", () => {
expect(container.firstChild).toBeNull();
jest.spyOn(room, "getMembersWithMembership").mockReturnValue([bob]);
act(() => {
room.emit(RoomStateEvent.Members, new MatrixEvent(), state, bob);
room.emit(RoomStateEvent.Update, state);
});
expect(container.firstChild).not.toBeNull();
});
@ -151,7 +151,7 @@ describe("RoomKnocksBar", () => {
expect(screen.getByRole("heading")).toHaveTextContent("Asking to join");
jest.spyOn(room, "getMembersWithMembership").mockReturnValue([bob, jane]);
act(() => {
room.emit(RoomStateEvent.Members, new MatrixEvent(), state, jane);
room.emit(RoomStateEvent.Update, state);
});
expect(screen.getByRole("heading")).toHaveTextContent("2 people asking to join");
});

View file

@ -176,7 +176,7 @@ describe("PeopleRoomSettingsTab", () => {
jest.spyOn(room, "getMembersWithMembership").mockReturnValue([]);
getComponent(room);
act(() => {
room.emit(RoomStateEvent.Members, new MatrixEvent(), state, knockMember);
room.emit(RoomStateEvent.Update, state);
});
expect(getParagraph()).toHaveTextContent("No requests");
});
@ -209,7 +209,7 @@ describe("PeopleRoomSettingsTab", () => {
jest.spyOn(room, "getMembersWithMembership").mockReturnValue([]);
getComponent(room);
act(() => {
room.emit(RoomStateEvent.Members, new MatrixEvent(), state, knockMember);
room.emit(RoomStateEvent.Update, state);
});
expect(getParagraph()).toHaveTextContent("No requests");
});