Skip to content

Commit

Permalink
Use RoomStateEvent.Update for knocks (matrix-org#11516)
Browse files Browse the repository at this point in the history
Signed-off-by: Charly Nguyen <charly.nguyen@nordeck.net>
  • Loading branch information
charlynguyen authored and nurjinjafar committed Sep 6, 2023
1 parent 93e2f9d commit 2e4fd67
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
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

0 comments on commit 2e4fd67

Please sign in to comment.