You've already forked matrix-react-sdk
mirror of
https://github.com/matrix-org/matrix-react-sdk.git
synced 2025-07-30 02:21:17 +03:00
Show knock rooms in the list (#11573)
* Show knock rooms in the list Signed-off-by: Mikhail Aheichyk <mikhail.aheichyk@nordeck.net> * Pass userId to IndexedDBStore Signed-off-by: Mikhail Aheichyk <mikhail.aheichyk@nordeck.net> * Revert "Pass userId to IndexedDBStore" Signed-off-by: Mikhail Aheichyk <mikhail.aheichyk@nordeck.net> * Code review changes Signed-off-by: Mikhail Aheichyk <mikhail.aheichyk@nordeck.net> --------- Signed-off-by: Mikhail Aheichyk <mikhail.aheichyk@nordeck.net> Co-authored-by: Mikhail Aheichyk <mikhail.aheichyk@nordeck.net>
This commit is contained in:
@ -27,7 +27,7 @@ import {
|
||||
} from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import type { MatrixClient } from "matrix-js-sdk/src/matrix";
|
||||
import { mkEvent, mkRoom, muteRoom, stubClient, upsertRoomStateEvents } from "./test-utils";
|
||||
import { mkEvent, mkRoom, mkRoomMember, muteRoom, stubClient, upsertRoomStateEvents } from "./test-utils";
|
||||
import {
|
||||
getRoomNotifsState,
|
||||
RoomNotifState,
|
||||
@ -36,6 +36,7 @@ import {
|
||||
} from "../src/RoomNotifs";
|
||||
import { NotificationColor } from "../src/stores/notifications/NotificationColor";
|
||||
import SettingsStore from "../src/settings/SettingsStore";
|
||||
import { MatrixClientPeg } from "../src/MatrixClientPeg";
|
||||
|
||||
describe("RoomNotifs test", () => {
|
||||
let client: jest.Mocked<MatrixClient>;
|
||||
@ -285,6 +286,21 @@ describe("RoomNotifs test", () => {
|
||||
expect(count).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it("indicates the user knock has been denied", async () => {
|
||||
jest.spyOn(SettingsStore, "getValue").mockImplementation((name) => {
|
||||
return name === "feature_ask_to_join";
|
||||
});
|
||||
const roomMember = mkRoomMember(room.roomId, MatrixClientPeg.get()!.getSafeUserId(), "leave", true, {
|
||||
membership: "knock",
|
||||
});
|
||||
jest.spyOn(room, "getMember").mockReturnValue(roomMember);
|
||||
const { color, symbol, count } = determineUnreadState(room);
|
||||
|
||||
expect(symbol).toBe("!");
|
||||
expect(color).toBe(NotificationColor.Red);
|
||||
expect(count).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
it("shows nothing for muted channels", async () => {
|
||||
room.setUnreadNotificationCount(NotificationCountType.Highlight, 99);
|
||||
room.setUnreadNotificationCount(NotificationCountType.Total, 99);
|
||||
|
Reference in New Issue
Block a user