1 Commits
Author SHA1 Message Date
litruv a4e96dd01f Remove the Paarrot delivery receipt.
Trigger cinny-mobile / dispatch (push) Successful in 2s
Delivery markers (com.paarrot.received) are no longer sent or rendered; the activity bar shows only read receipts. Markers already sent to servers remain there.
2026-10-13 19:04:54 +11:00
4 changed files with 6 additions and 114 deletions
+6 -17
View File
@@ -11,7 +11,6 @@ import * as css from './RoomViewFollowing.css';
import { useMatrixClient } from '../../hooks/useMatrixClient';
import { useRoomLatestRenderedEvent } from '../../hooks/useRoomLatestRenderedEvent';
import { useRoomEventReaders } from '../../hooks/useRoomEventReaders';
import { useRoomEventDelivery } from '../../hooks/useRoomEventDelivery';
import { EventReaders } from '../../components/event-readers';
import { stopPropagation } from '../../utils/keyboard';
@@ -32,18 +31,12 @@ export const RoomViewFollowing = as<'div', RoomViewFollowingProps>(
const latestEvent = useRoomLatestRenderedEvent(room);
const shownEventId = eventId ?? latestEvent?.getId();
const latestEventReaders = useRoomEventReaders(room, shownEventId);
const received = useRoomEventDelivery(room, shownEventId, myUserId);
// Received but not read shows a single tick, read shows the double tick.
const receivedOnly = received && !latestEventReaders.includes(myUserId);
const getName = (userId: string) =>
getMemberDisplayName(room, userId) ?? getMxIdLocalPart(userId) ?? userId;
const names = [
...(receivedOnly && myUserId ? [myUserId] : []),
...latestEventReaders.filter((readerId) => readerId !== myUserId),
].map(getName);
const names = latestEventReaders
.filter((readerId) => readerId !== myUserId)
.map(
(readerId) => getMemberDisplayName(room, readerId) ?? getMxIdLocalPart(readerId) ?? readerId
);
if (names.length === 0) {
return null;
@@ -79,11 +72,7 @@ export const RoomViewFollowing = as<'div', RoomViewFollowingProps>(
{...props}
ref={ref}
>
<Icon
style={{ opacity: config.opacity.P300 }}
size="100"
src={receivedOnly ? Icons.Check : Icons.CheckTwice}
/>
<Icon style={{ opacity: config.opacity.P300 }} size="100" src={Icons.CheckTwice} />
<Text size="T300" truncate>
{names.length === 1 && <b>{names[0]}</b>}
{names.length === 2 && (
-35
View File
@@ -1,35 +0,0 @@
import { useEffect, useState } from 'react';
import { MatrixEvent, Room, RoomEvent } from 'matrix-js-sdk';
import { PAARROT_RECEIVED_EVENT, hasReceivedMarker } from '../utils/paarrotDelivery';
/**
* Whether `userId` has recorded a delivery marker for `eventId` - received, but
* not necessarily read. Read state still comes from the read receipt.
*/
export const useRoomEventDelivery = (room: Room, eventId?: string, userId?: string): boolean => {
const [received, setReceived] = useState(() =>
eventId && userId ? hasReceivedMarker(room, eventId, userId) : false,
);
useEffect(() => {
setReceived(eventId && userId ? hasReceivedMarker(room, eventId, userId) : false);
if (!eventId || !userId) return;
const update = () => setReceived(hasReceivedMarker(room, eventId, userId));
const handleTimeline = (event: MatrixEvent, r: Room) => {
if (r.roomId !== room.roomId) return;
if (event.getRelation()?.event_id !== eventId) return;
if (event.getType() !== PAARROT_RECEIVED_EVENT && !event.isRedaction()) return;
update();
};
room.on(RoomEvent.Timeline, handleTimeline);
return () => {
room.removeListener(RoomEvent.Timeline, handleTimeline);
};
}, [room, eventId, userId]);
return received;
};
@@ -22,7 +22,6 @@ import {
getOrphanParents,
guessPerfectParent,
} from '../../utils/room';
import { sendReceivedMarker } from '../../utils/paarrotDelivery';
import { NotificationType, UnreadInfo } from '../../../types/matrix/room';
import { getMxIdLocalPart, mxcUrlToHttp, getCanonicalAliasOrRoomId } from '../../utils/matrix';
import { mDirectAtom } from '../../state/mDirectList';
@@ -388,14 +387,6 @@ function MessageNotifications() {
(notificationType === NotificationType.Default && !isDm);
if (mentionsOnly && unreadInfo.highlight === 0) return;
// Record that Paarrot received this message. This is the single tick; the
// read receipt below is what turns it into the double tick.
if (showNotifications) {
sendReceivedMarker(mx, room, eventId).catch((error) => {
console.error('[PaarrotDelivery] Failed to send delivery marker:', error);
});
}
if (
showNotifications &&
((isTauri() && !isElectron()) || isCapacitorNative() || notificationPermission('granted'))
-53
View File
@@ -1,53 +0,0 @@
import { MatrixClient, RelationType, Room } from 'matrix-js-sdk';
/**
* Client-defined event marking that Paarrot has received a message.
*
* The spec has no delivery receipt type - Synapse only accepts `m.read`,
* `m.read.private` and `m.fully_read` on the receipts endpoint - so delivery is
* recorded as a custom event related to the target message with `m.reference`.
*
* It never shows in the cinny timeline (events with a relation are skipped
* unless "show hidden events" is on), and other clients only see an unknown
* event. Delivery is always self-reported: in E2EE, only the receiving client
* can know it actually got the event.
*/
export const PAARROT_RECEIVED_EVENT = 'com.paarrot.received';
export const getReceivedContent = (eventId: string) => ({
'm.relates_to': {
event_id: eventId,
rel_type: RelationType.Reference,
},
});
export const getEventDeliveryRelations = (room: Room, eventId: string) =>
room
.getUnfilteredTimelineSet()
.relations.getChildEventsForEvent(eventId, RelationType.Reference, PAARROT_RECEIVED_EVENT);
export const hasReceivedMarker = (room: Room, eventId: string, userId: string): boolean => {
const relations = getEventDeliveryRelations(room, eventId);
if (!relations) return false;
return relations
.getRelations()
.some(
(rel) =>
!rel.isRedacted() && rel.getSender() === userId && rel.getRelation()?.event_id === eventId,
);
};
/**
* Sends the delivery marker for `eventId`. Skips events that are still local
* echoes (no `$` id yet) and events this user already marked, so a room that
* re-syncs does not spam markers.
*/
export async function sendReceivedMarker(mx: MatrixClient, room: Room, eventId: string) {
const userId = mx.getUserId();
if (!userId || !eventId.startsWith('$')) return false;
if (hasReceivedMarker(room, eventId, userId)) return false;
await mx.sendEvent(room.roomId, PAARROT_RECEIVED_EVENT, getReceivedContent(eventId));
return true;
}