summaryrefslogtreecommitdiff
path: root/includes/external/matrix/node_modules/matrix-js-sdk/lib/models/read-receipt.d.ts
blob: 1c228c255a390ee47959680e4e9e2bb32a6c441f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import { CachedReceipt, Receipt, ReceiptType, WrappedReceipt } from "../@types/read_receipts";
import { ListenerMap, TypedEventEmitter } from "./typed-event-emitter";
import { MatrixEvent } from "./event";
import { EventTimelineSet } from "./event-timeline-set";
import { NotificationCountType } from "./room";
export declare function synthesizeReceipt(userId: string, event: MatrixEvent, receiptType: ReceiptType): MatrixEvent;
export declare abstract class ReadReceipt<Events extends string, Arguments extends ListenerMap<Events>, SuperclassArguments extends ListenerMap<any> = Arguments> extends TypedEventEmitter<Events, Arguments, SuperclassArguments> {
    private receipts;
    private receiptCacheByEventId;
    abstract getUnfilteredTimelineSet(): EventTimelineSet;
    abstract timeline: MatrixEvent[];
    /**
     * Gets the latest receipt for a given user in the room
     * @param userId - The id of the user for which we want the receipt
     * @param ignoreSynthesized - Whether to ignore synthesized receipts or not
     * @param receiptType - Optional. The type of the receipt we want to get
     * @returns the latest receipts of the chosen type for the chosen user
     */
    getReadReceiptForUserId(userId: string, ignoreSynthesized?: boolean, receiptType?: ReceiptType): WrappedReceipt | null;
    /**
     * Get the ID of the event that a given user has read up to, or null if we
     * have received no read receipts from them.
     * @param userId - The user ID to get read receipt event ID for
     * @param ignoreSynthesized - If true, return only receipts that have been
     *                                    sent by the server, not implicit ones generated
     *                                    by the JS SDK.
     * @returns ID of the latest event that the given user has read, or null.
     */
    getEventReadUpTo(userId: string, ignoreSynthesized?: boolean): string | null;
    addReceiptToStructure(eventId: string, receiptType: ReceiptType, userId: string, receipt: Receipt, synthetic: boolean): void;
    /**
     * Get a list of receipts for the given event.
     * @param event - the event to get receipts for
     * @returns A list of receipts with a userId, type and data keys or
     * an empty list.
     */
    getReceiptsForEvent(event: MatrixEvent): CachedReceipt[];
    abstract addReceipt(event: MatrixEvent, synthetic: boolean): void;
    abstract setUnread(type: NotificationCountType, count: number): void;
    /**
     * This issue should also be addressed on synapse's side and is tracked as part
     * of https://github.com/matrix-org/synapse/issues/14837
     *
     * Retrieves the read receipt for the logged in user and checks if it matches
     * the last event in the room and whether that event originated from the logged
     * in user.
     * Under those conditions we can consider the context as read. This is useful
     * because we never send read receipts against our own events
     * @param userId - the logged in user
     */
    fixupNotifications(userId: string): void;
    /**
     * Add a temporary local-echo receipt to the room to reflect in the
     * client the fact that we've sent one.
     * @param userId - The user ID if the receipt sender
     * @param e - The event that is to be acknowledged
     * @param receiptType - The type of receipt
     */
    addLocalEchoReceipt(userId: string, e: MatrixEvent, receiptType: ReceiptType): void;
    /**
     * Get a list of user IDs who have <b>read up to</b> the given event.
     * @param event - the event to get read receipts for.
     * @returns A list of user IDs.
     */
    getUsersReadUpTo(event: MatrixEvent): string[];
    /**
     * Determines if the given user has read a particular event ID with the known
     * history of the room. This is not a definitive check as it relies only on
     * what is available to the room at the time of execution.
     * @param userId - The user ID to check the read state of.
     * @param eventId - The event ID to check if the user read.
     * @returns True if the user has read the event, false otherwise.
     */
    hasUserReadEvent(userId: string, eventId: string): boolean;
}
//# sourceMappingURL=read-receipt.d.ts.map