Skip to content

Commit 72a2773

Browse files
authored
Start sending stable m.marked_unread events (#28478)
* Start sending stable `m.marked_unread` events * Update tests
1 parent abf6d58 commit 72a2773

File tree

5 files changed

+7
-10
lines changed

5 files changed

+7
-10
lines changed

src/utils/notifications.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,7 @@ export async function setMarkedUnreadState(room: Room, client: MatrixClient, unr
151151
const currentState = getMarkedUnreadState(room);
152152

153153
if (Boolean(currentState) !== unread) {
154-
// Assuming MSC2867 passes FCP with no changes, we should update to start writing
155-
// the flag to the stable prefix (or both) and then ultimately use only the
156-
// stable prefix.
157-
await client.setRoomAccountData(room.roomId, MARKED_UNREAD_TYPE_UNSTABLE, { unread });
154+
await client.setRoomAccountData(room.roomId, MARKED_UNREAD_TYPE_STABLE, { unread });
158155
}
159156
}
160157

test/unit-tests/components/views/context_menus/RoomGeneralContextMenu-test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ describe("RoomGeneralContextMenu", () => {
150150

151151
await sleep(0);
152152

153-
expect(mockClient.setRoomAccountData).toHaveBeenCalledWith(ROOM_ID, "com.famedly.marked_unread", {
153+
expect(mockClient.setRoomAccountData).toHaveBeenCalledWith(ROOM_ID, "m.marked_unread", {
154154
unread: true,
155155
});
156156
expect(onFinished).toHaveBeenCalled();

test/unit-tests/stores/RoomViewStore-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ describe("RoomViewStore", function () {
338338
});
339339
dis.dispatch({ action: Action.ViewRoom, room_id: roomId });
340340
await untilDispatch(Action.ActiveRoomChanged, dis);
341-
expect(mockClient.setRoomAccountData).toHaveBeenCalledWith(roomId, "com.famedly.marked_unread", {
341+
expect(mockClient.setRoomAccountData).toHaveBeenCalledWith(roomId, "m.marked_unread", {
342342
unread: false,
343343
});
344344
});

test/unit-tests/stores/notifications/RoomNotificationState-test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ describe("RoomNotificationState", () => {
9191
const listener = jest.fn();
9292
roomNotifState.addListener(NotificationStateEvents.Update, listener);
9393
const accountDataEvent = {
94-
getType: () => "com.famedly.marked_unread",
94+
getType: () => "m.marked_unread",
9595
getContent: () => {
9696
return { unread: true };
9797
},

test/unit-tests/utils/notifications-test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ describe("notifications", () => {
270270
// set true, no existing event
271271
it("sets unread flag if event doesn't exist", async () => {
272272
await setMarkedUnreadState(room, client, true);
273-
expect(client.setRoomAccountData).toHaveBeenCalledWith(ROOM_ID, "com.famedly.marked_unread", {
273+
expect(client.setRoomAccountData).toHaveBeenCalledWith(ROOM_ID, "m.marked_unread", {
274274
unread: true,
275275
});
276276
});
@@ -287,7 +287,7 @@ describe("notifications", () => {
287287
.fn()
288288
.mockReturnValue({ getContent: jest.fn().mockReturnValue({ unread: false }) });
289289
await setMarkedUnreadState(room, client, true);
290-
expect(client.setRoomAccountData).toHaveBeenCalledWith(ROOM_ID, "com.famedly.marked_unread", {
290+
expect(client.setRoomAccountData).toHaveBeenCalledWith(ROOM_ID, "m.marked_unread", {
291291
unread: true,
292292
});
293293
});
@@ -316,7 +316,7 @@ describe("notifications", () => {
316316
.fn()
317317
.mockReturnValue({ getContent: jest.fn().mockReturnValue({ unread: true }) });
318318
await setMarkedUnreadState(room, client, false);
319-
expect(client.setRoomAccountData).toHaveBeenCalledWith(ROOM_ID, "com.famedly.marked_unread", {
319+
expect(client.setRoomAccountData).toHaveBeenCalledWith(ROOM_ID, "m.marked_unread", {
320320
unread: false,
321321
});
322322
});

0 commit comments

Comments
 (0)