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

Use RoomStateEvent.Update for knocks #11516

Merged
Show file tree
Hide file tree
Changes from all 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/rooms/RoomKnocksBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export const PeopleRoomSettingsTab: VFC<{ room: Room }> = ({ room }) => {

const knockMembers = useTypedEventEmitterState(
room,
RoomStateEvent.Members,
RoomStateEvent.Update,
useCallback(() => room.getMembersWithMembership("knock"), [room]),
);

Expand Down
4 changes: 2 additions & 2 deletions test/components/views/rooms/RoomKnocksBar-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand All @@ -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");
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
});
Expand Down Expand Up @@ -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");
});
Expand Down