Compare commits
1 Commits
dev
...
fix-back-b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a2a41df96e |
@@ -51,8 +51,12 @@ export function BackRouteHandler({ children }: BackRouteHandlerProps) {
|
|||||||
},
|
},
|
||||||
location.pathname
|
location.pathname
|
||||||
);
|
);
|
||||||
if (spaceMatch?.params.spaceIdOrAlias) {
|
const encodedSpaceIdOrAlias = spaceMatch?.params.spaceIdOrAlias;
|
||||||
navigate(getSpacePath(spaceMatch.params.spaceIdOrAlias));
|
const decodedSpaceIdOrAlias =
|
||||||
|
encodedSpaceIdOrAlias && decodeURIComponent(encodedSpaceIdOrAlias);
|
||||||
|
|
||||||
|
if (decodedSpaceIdOrAlias) {
|
||||||
|
navigate(getSpacePath(decodedSpaceIdOrAlias));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { MatrixClient, ReceiptType } from 'matrix-js-sdk';
|
import { MatrixClient, ReceiptType } from 'matrix-js-sdk';
|
||||||
|
|
||||||
export async function markAsRead(mx: MatrixClient, roomId: string, privateReceipt: boolean) {
|
export async function markAsRead(mx: MatrixClient, roomId: string, privateReceipt?: boolean) {
|
||||||
const room = mx.getRoom(roomId);
|
const room = mx.getRoom(roomId);
|
||||||
if (!room) return;
|
if (!room) return;
|
||||||
|
|
||||||
@@ -19,8 +19,15 @@ export async function markAsRead(mx: MatrixClient, roomId: string, privateReceip
|
|||||||
const latestEvent = getLatestValidEvent();
|
const latestEvent = getLatestValidEvent();
|
||||||
if (latestEvent === null) return;
|
if (latestEvent === null) return;
|
||||||
|
|
||||||
await mx.sendReadReceipt(
|
const latestEventId = latestEvent.getId();
|
||||||
latestEvent,
|
if (!latestEventId) return;
|
||||||
privateReceipt ? ReceiptType.ReadPrivate : ReceiptType.Read
|
|
||||||
|
// Set both the read receipt AND the fully_read marker
|
||||||
|
// The fully_read marker is what persists your read position across sessions
|
||||||
|
await mx.setRoomReadMarkers(
|
||||||
|
roomId,
|
||||||
|
latestEventId, // m.fully_read marker
|
||||||
|
latestEvent, // m.read receipt event
|
||||||
|
privateReceipt ? { receiptType: ReceiptType.ReadPrivate } : undefined
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user