Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 307d737

Browse files
authored
Add analytics for mark all threads unread (#12384)
* Add analytics for mark all threads unread * Upgrade matrix-analytics events for new event
1 parent 0ad769f commit 307d737

File tree

3 files changed

+26
-47
lines changed

3 files changed

+26
-47
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
},
6868
"dependencies": {
6969
"@babel/runtime": "^7.12.5",
70-
"@matrix-org/analytics-events": "^0.12.0",
70+
"@matrix-org/analytics-events": "^0.19.0",
7171
"@matrix-org/emojibase-bindings": "^1.1.2",
7272
"@matrix-org/matrix-wysiwyg": "2.17.0",
7373
"@matrix-org/olm": "3.2.15",

src/components/structures/ThreadPanel.tsx

+18-14
Original file line numberDiff line numberDiff line change
@@ -116,20 +116,24 @@ export const ThreadPanelHeader: React.FC<{
116116
</ContextMenu>
117117
) : null;
118118

119-
const onMarkAllThreadsReadClick = React.useCallback(() => {
120-
if (!roomContext.room) {
121-
logger.error("No room in context to mark all threads read");
122-
return;
123-
}
124-
// This actually clears all room notifications by sending an unthreaded read receipt.
125-
// We'd have to loop over all unread threads (pagninating back to find any we don't
126-
// know about yet) and send threaded receipts for all of them... or implement a
127-
// specific API for it. In practice, the user will have to be viewing the room to
128-
// see this button, so will have marked the room itself read anyway.
129-
clearRoomNotification(roomContext.room, mxClient).catch((e) => {
130-
logger.error("Failed to mark all threads read", e);
131-
});
132-
}, [roomContext.room, mxClient]);
119+
const onMarkAllThreadsReadClick = React.useCallback(
120+
(e) => {
121+
PosthogTrackers.trackInteraction("WebThreadsMarkAllReadButton", e);
122+
if (!roomContext.room) {
123+
logger.error("No room in context to mark all threads read");
124+
return;
125+
}
126+
// This actually clears all room notifications by sending an unthreaded read receipt.
127+
// We'd have to loop over all unread threads (pagninating back to find any we don't
128+
// know about yet) and send threaded receipts for all of them... or implement a
129+
// specific API for it. In practice, the user will have to be viewing the room to
130+
// see this button, so will have marked the room itself read anyway.
131+
clearRoomNotification(roomContext.room, mxClient).catch((e) => {
132+
logger.error("Failed to mark all threads read", e);
133+
});
134+
},
135+
[roomContext.room, mxClient],
136+
);
133137

134138
return (
135139
<div className="mx_BaseCard_header_title">

yarn.lock

+7-32
Original file line numberDiff line numberDiff line change
@@ -1840,10 +1840,10 @@
18401840
resolved "https://registry.yarnpkg.com/@mapbox/whoots-js/-/whoots-js-3.1.0.tgz#497c67a1cef50d1a2459ba60f315e448d2ad87fe"
18411841
integrity sha512-Es6WcD0nO5l+2BOQS4uLfNPYQaNDfbot3X1XUoloz+x0mPDS3eeORZJl06HXjwBG1fOGwCRnzK88LMdxKRrd6Q==
18421842

1843-
"@matrix-org/analytics-events@^0.12.0":
1844-
version "0.12.0"
1845-
resolved "https://registry.yarnpkg.com/@matrix-org/analytics-events/-/analytics-events-0.12.0.tgz#2e48c75eb39c38cbb52f0cd479eed4c835064e9f"
1846-
integrity sha512-J/rP11P2Q9PbH7iUzHIthnAQlJL1HEorUjtdd/yCrXDSk0Gw4dNe1FM2P75E6m2lUl2yJQhzGuahMmqe9xOWaw==
1843+
"@matrix-org/analytics-events@^0.19.0":
1844+
version "0.19.0"
1845+
resolved "https://registry.yarnpkg.com/@matrix-org/analytics-events/-/analytics-events-0.19.0.tgz#e20e4df54530ed1c755ab728e9c22891e376f9e2"
1846+
integrity sha512-wN/hbpTpOxz2u3zHbsJgVMi88oKmK1yqeSZuif3yNW68XQnV2cc0XGUEpl0fgLOl6fj1bZOtxbDg5rCLbqf4CQ==
18471847

18481848
"@matrix-org/emojibase-bindings@^1.1.2":
18491849
version "1.1.3"
@@ -8642,16 +8642,7 @@ string-length@^4.0.1:
86428642
char-regex "^1.0.2"
86438643
strip-ansi "^6.0.0"
86448644

8645-
"string-width-cjs@npm:string-width@^4.2.0":
8646-
version "4.2.3"
8647-
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
8648-
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
8649-
dependencies:
8650-
emoji-regex "^8.0.0"
8651-
is-fullwidth-code-point "^3.0.0"
8652-
strip-ansi "^6.0.1"
8653-
8654-
string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
8645+
"string-width-cjs@npm:string-width@^4.2.0", string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.3:
86558646
version "4.2.3"
86568647
resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010"
86578648
integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==
@@ -8745,14 +8736,7 @@ string_decoder@~1.1.1:
87458736
dependencies:
87468737
safe-buffer "~5.1.0"
87478738

8748-
"strip-ansi-cjs@npm:strip-ansi@^6.0.1":
8749-
version "6.0.1"
8750-
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
8751-
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
8752-
dependencies:
8753-
ansi-regex "^5.0.1"
8754-
8755-
strip-ansi@^6.0.0, strip-ansi@^6.0.1:
8739+
"strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1:
87568740
version "6.0.1"
87578741
resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9"
87588742
integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
@@ -9545,7 +9529,7 @@ which@^2.0.1:
95459529
dependencies:
95469530
isexe "^2.0.0"
95479531

9548-
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0":
9532+
"wrap-ansi-cjs@npm:wrap-ansi@^7.0.0", wrap-ansi@^7.0.0:
95499533
version "7.0.0"
95509534
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
95519535
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
@@ -9563,15 +9547,6 @@ wrap-ansi@^6.2.0:
95639547
string-width "^4.1.0"
95649548
strip-ansi "^6.0.0"
95659549

9566-
wrap-ansi@^7.0.0:
9567-
version "7.0.0"
9568-
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43"
9569-
integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==
9570-
dependencies:
9571-
ansi-styles "^4.0.0"
9572-
string-width "^4.1.0"
9573-
strip-ansi "^6.0.0"
9574-
95759550
wrap-ansi@^8.1.0:
95769551
version "8.1.0"
95779552
resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-8.1.0.tgz#56dc22368ee570face1b49819975d9b9a5ead214"

0 commit comments

Comments
 (0)