Skip to content

armgit / ente

Public Imported from GitHub
0

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

Impl

Manav Rathic297a60c8523
diff --git a/web/packages/new/photos/services/ml/index.ts b/web/packages/new/photos/services/ml/index.ts
index b2b33a26e2..0e6a226f71 100644
--- a/web/packages/new/photos/services/ml/index.ts
+++ b/web/packages/new/photos/services/ml/index.ts
@@ -734,6 +734,28 @@ export const addPerson = async (name: string, cluster: FaceCluster) => {
return mlSync();
};
+/**
+ * Add a new cluster to an existing named person.
+ *
+ * @param cgroup The existing cgroup underlying the person. This is the (remote)
+ * user entity that will get updated.
+ *
+ * @param cluster The new cluster of faces to associate with this person.
+ */
+export const addClusterToPerson = async (
+ cluster: FaceCluster,
+ cgroup: CGroup,
+) => {
+ const masterKey = await masterKeyFromSession();
+ const assigned = cgroup.data.assigned.concat([cluster]);
+ await updateOrCreateUserEntities(
+ "cgroup",
+ [{ ...cgroup, data: { ...cgroup.data, assigned } }],
+ masterKey,
+ );
+ return mlSync();
+};
+
/**
* Rename an existing named person.
*