Add analytics for mark all threads unread (#12384)

* Add analytics for mark all threads unread

* Upgrade matrix-analytics events for new event
This commit is contained in:
David Baker 2024-04-04 13:12:30 +01:00 committed by GitHub
parent 0ad769f009
commit 307d737555
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 26 additions and 47 deletions

View file

@ -116,20 +116,24 @@ export const ThreadPanelHeader: React.FC<{
</ContextMenu>
) : null;
const onMarkAllThreadsReadClick = React.useCallback(() => {
if (!roomContext.room) {
logger.error("No room in context to mark all threads read");
return;
}
// This actually clears all room notifications by sending an unthreaded read receipt.
// We'd have to loop over all unread threads (pagninating back to find any we don't
// know about yet) and send threaded receipts for all of them... or implement a
// specific API for it. In practice, the user will have to be viewing the room to
// see this button, so will have marked the room itself read anyway.
clearRoomNotification(roomContext.room, mxClient).catch((e) => {
logger.error("Failed to mark all threads read", e);
});
}, [roomContext.room, mxClient]);
const onMarkAllThreadsReadClick = React.useCallback(
(e) => {
PosthogTrackers.trackInteraction("WebThreadsMarkAllReadButton", e);
if (!roomContext.room) {
logger.error("No room in context to mark all threads read");
return;
}
// This actually clears all room notifications by sending an unthreaded read receipt.
// We'd have to loop over all unread threads (pagninating back to find any we don't
// know about yet) and send threaded receipts for all of them... or implement a
// specific API for it. In practice, the user will have to be viewing the room to
// see this button, so will have marked the room itself read anyway.
clearRoomNotification(roomContext.room, mxClient).catch((e) => {
logger.error("Failed to mark all threads read", e);
});
},
[roomContext.room, mxClient],
);
return (
<div className="mx_BaseCard_header_title">