Use RoomStateEvent.Update for knocks (#11516)
Signed-off-by: Charly Nguyen <charly.nguyen@nordeck.net>
This commit is contained in:
parent
93ccccc03d
commit
fca9f0e91d
4 changed files with 6 additions and 6 deletions
|
@ -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;
|
||||
|
|
|
@ -144,7 +144,7 @@ export const PeopleRoomSettingsTab: VFC<{ room: Room }> = ({ room }) => {
|
|||
|
||||
const knockMembers = useTypedEventEmitterState(
|
||||
room,
|
||||
RoomStateEvent.Members,
|
||||
RoomStateEvent.Update,
|
||||
useCallback(() => room.getMembersWithMembership("knock"), [room]),
|
||||
);
|
||||
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
|
|
|
@ -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");
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue