π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Checkpoint
Manav Rathi1d04eb30a0b6
diff --git a/web/packages/new/photos/components/gallery/PeopleHeader.tsx b/web/packages/new/photos/components/gallery/PeopleHeader.tsxindex 1ad04aa848..ee6db1f686 100644--- a/web/packages/new/photos/components/gallery/PeopleHeader.tsx+++ b/web/packages/new/photos/components/gallery/PeopleHeader.tsx@@ -17,6 +17,7 @@ import {deleteCGroup,renameCGroup,suggestionsAndChoicesForPerson,+ updateAssignedClustersForCGroup,} from "@/new/photos/services/ml";import {type CGroupPerson,@@ -52,7 +53,10 @@ import {import { t } from "i18next";import React, { useEffect, useReducer, useState } from "react";import { isInternalUser } from "../../services/feature-flags";-import { savedRejectedClustersForCGroup } from "../../services/ml/kvdb";+import {+ savedRejectedClustersForCGroup,+ saveRejectedClustersForCGroup,+} from "../../services/ml/kvdb";import { useAppContext } from "../../types/context";import { AddPersonDialog } from "../AddPersonDialog";import { SpaceBetweenFlex } from "../mui";@@ -690,20 +694,16 @@ const saveSuggestionsAndChoices = async (}if (didUpdateAssigned) {- addClusterToCGroup(+ await updateAssignedClustersForCGroup(ensure(person.cgroup),- cluster,- ),-+ assignedClusters,+ );}- const newlyAddedClusterIDs = new Set<string>();- const newlyRemovedClusterIDs = new Set<string>();- for (const [clusterID, assigned] of state.marks.entries()) {- (assigned ? newlyAddedClusterIDs : newlyRemovedClusterIDs).add(- clusterID,+ if (didUpdateRejected) {+ await saveRejectedClustersForCGroup(+ person.cgroup.id,+ rejectedClusterIDs,);}-- const updatedAssignedClusters = assignedClusters.filter();};diff --git a/web/packages/new/photos/services/ml/kvdb.ts b/web/packages/new/photos/services/ml/kvdb.tsindex 438b6020e2..f1ae00e5a2 100644--- a/web/packages/new/photos/services/ml/kvdb.ts+++ b/web/packages/new/photos/services/ml/kvdb.ts@@ -15,8 +15,8 @@ const ClusterIDsByCGroupID = z.record(z.string(), z.array(z.string()));export type ClusterIDsByCGroupID = z.infer<typeof ClusterIDsByCGroupID>;/**- * Return the locally persisted record of clusters per person that the user has- * rejected as not belonging to that person.+ * Return the locally persisted record of clusters per cgroup that the user has+ * rejected as not belonging to that cgroup.** [Note: Persistent KV pairs related to ML]*@@ -39,10 +39,22 @@ export const saveRejectedClusters = (entries: ClusterIDsByCGroupID) =>/*** Return the list of locally persisted clusters that the user has rejected as- * not belonging to a particular person (as identified by the person's- * {@link cgroupID}).+ * not belonging to a particular cgroup (as identified by its {@link cgroupID}).*/export const savedRejectedClustersForCGroup = async (cgroupID: string,): Promise<string[]> =>savedRejectedClusters().then((cs) => cs[cgroupID] ?? []);++/**+ * Update the locally persisted record of rejected clusters for the given cgroup+ * (as identified by its {@link cgroupID}).+ */+export const saveRejectedClustersForCGroup = async (+ cgroupID: string,+ clusterIDs: string[],+) => {+ const rejectedClusters = await savedRejectedClusters();+ rejectedClusters[cgroupID] = clusterIDs;+ return saveRejectedClusters(rejectedClusters);+};