Send how many favorited rooms a user has to Posthog (#7772)
This commit is contained in:
parent
871032e1bc
commit
f6565bfbc8
13 changed files with 47 additions and 15 deletions
|
@ -26,6 +26,7 @@ import { RoomNotificationState } from "./RoomNotificationState";
|
|||
import { SummarizedNotificationState } from "./SummarizedNotificationState";
|
||||
import { ThreadsRoomNotificationState } from "./ThreadsRoomNotificationState";
|
||||
import { VisibilityProvider } from "../room-list/filters/VisibilityProvider";
|
||||
import { PosthogAnalytics } from "../../PosthogAnalytics";
|
||||
|
||||
interface IState {}
|
||||
|
||||
|
@ -105,12 +106,19 @@ export class RoomNotificationStateStore extends AsyncStoreWithClient<IState> {
|
|||
// Only count visible rooms to not torment the user with notification counts in rooms they can't see.
|
||||
// This will include highlights from the previous version of the room internally
|
||||
const globalState = new SummarizedNotificationState();
|
||||
for (const room of this.matrixClient.getVisibleRooms()) {
|
||||
const visibleRooms = this.matrixClient.getVisibleRooms();
|
||||
|
||||
let numFavourites = 0;
|
||||
for (const room of visibleRooms) {
|
||||
if (VisibilityProvider.instance.isRoomVisible(room)) {
|
||||
globalState.add(this.getRoomState(room));
|
||||
|
||||
if (room.tags[DefaultTagID.Favourite] && !room.getType()) numFavourites++;
|
||||
}
|
||||
}
|
||||
|
||||
PosthogAnalytics.instance.setProperty("numFavouriteRooms", numFavourites);
|
||||
|
||||
if (this.globalState.symbol !== globalState.symbol ||
|
||||
this.globalState.count !== globalState.count ||
|
||||
this.globalState.color !== globalState.color ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue