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

Commit fca9f0e

Browse files
authored
Use RoomStateEvent.Update for knocks (#11516)
Signed-off-by: Charly Nguyen <[email protected]>
1 parent 93ccccc commit fca9f0e

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/components/views/rooms/RoomKnocksBar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export const RoomKnocksBar: VFC<{ room: Room }> = ({ room }) => {
3333
const [disabled, setDisabled] = useState(false);
3434
const knockMembers = useTypedEventEmitterState(
3535
room,
36-
RoomStateEvent.Members,
36+
RoomStateEvent.Update,
3737
useCallback(() => room.getMembersWithMembership("knock"), [room]),
3838
);
3939
const knockMembersCount = knockMembers.length;

src/components/views/settings/tabs/room/PeopleRoomSettingsTab.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ export const PeopleRoomSettingsTab: VFC<{ room: Room }> = ({ room }) => {
144144

145145
const knockMembers = useTypedEventEmitterState(
146146
room,
147-
RoomStateEvent.Members,
147+
RoomStateEvent.Update,
148148
useCallback(() => room.getMembersWithMembership("knock"), [room]),
149149
);
150150

test/components/views/rooms/RoomKnocksBar-test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ describe("RoomKnocksBar", () => {
141141
expect(container.firstChild).toBeNull();
142142
jest.spyOn(room, "getMembersWithMembership").mockReturnValue([bob]);
143143
act(() => {
144-
room.emit(RoomStateEvent.Members, new MatrixEvent(), state, bob);
144+
room.emit(RoomStateEvent.Update, state);
145145
});
146146
expect(container.firstChild).not.toBeNull();
147147
});
@@ -151,7 +151,7 @@ describe("RoomKnocksBar", () => {
151151
expect(screen.getByRole("heading")).toHaveTextContent("Asking to join");
152152
jest.spyOn(room, "getMembersWithMembership").mockReturnValue([bob, jane]);
153153
act(() => {
154-
room.emit(RoomStateEvent.Members, new MatrixEvent(), state, jane);
154+
room.emit(RoomStateEvent.Update, state);
155155
});
156156
expect(screen.getByRole("heading")).toHaveTextContent("2 people asking to join");
157157
});

test/components/views/settings/tabs/room/PeopleRoomSettingsTab-test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ describe("PeopleRoomSettingsTab", () => {
176176
jest.spyOn(room, "getMembersWithMembership").mockReturnValue([]);
177177
getComponent(room);
178178
act(() => {
179-
room.emit(RoomStateEvent.Members, new MatrixEvent(), state, knockMember);
179+
room.emit(RoomStateEvent.Update, state);
180180
});
181181
expect(getParagraph()).toHaveTextContent("No requests");
182182
});
@@ -209,7 +209,7 @@ describe("PeopleRoomSettingsTab", () => {
209209
jest.spyOn(room, "getMembersWithMembership").mockReturnValue([]);
210210
getComponent(room);
211211
act(() => {
212-
room.emit(RoomStateEvent.Members, new MatrixEvent(), state, knockMember);
212+
room.emit(RoomStateEvent.Update, state);
213213
});
214214
expect(getParagraph()).toHaveTextContent("No requests");
215215
});

0 commit comments

Comments
 (0)