Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Prune on positive suggestion accept

Manav Rathi5abd6468c71f
diff --git a/web/packages/new/photos/services/ml/people.ts b/web/packages/new/photos/services/ml/people.ts
index a531f9d09a..6e7275564e 100644
--- a/web/packages/new/photos/services/ml/people.ts
+++ b/web/packages/new/photos/services/ml/people.ts
@@ -650,6 +650,7 @@ export const _applyPersonSuggestionUpdates = async (
const localClusters = await savedFaceClusters();
let assignedClusters = [...cgroup.data.assigned];
+ const newlyAssignedFaceIDs = new Set();
let rejectedClusterIDs = await savedRejectedClustersForCGroup(cgroup.id);
let assignUpdateCount = 0;
@@ -657,8 +658,9 @@ export const _applyPersonSuggestionUpdates = async (
// Add cluster with `clusterID` to the list of assigned clusters.
const assign = (clusterID: string) => {
- const cluster = localClusters.find((c) => c.id == clusterID);
- assignedClusters.push(ensure(cluster));
+ const cluster = ensure(localClusters.find((c) => c.id == clusterID));
+ assignedClusters.push(cluster);
+ cluster.faces.forEach((id) => newlyAssignedFaceIDs.add(id));
assignUpdateCount += 1;
};
@@ -724,9 +726,17 @@ export const _applyPersonSuggestionUpdates = async (
if (assignUpdateCount > 0) {
const assigned = assignedClusters;
+ const rejectedFaceIDs = cgroup.data.rejectedFaceIDs.filter(
+ (id) => !newlyAssignedFaceIDs.has(id),
+ );
await updateOrCreateUserEntities(
"cgroup",
- [{ ...cgroup, data: { ...cgroup.data, assigned } }],
+ [
+ {
+ ...cgroup,
+ data: { ...cgroup.data, assigned, rejectedFaceIDs },
+ },
+ ],
masterKey,
);
await saveFaceClusters(localClusters);