Skip to content

armgit / ente

Public Imported from GitHub
0

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

Add workaround

Manav Rathi1a966fdedd56
diff --git a/web/packages/new/photos/services/ml/people.ts b/web/packages/new/photos/services/ml/people.ts
index cfa34d1c53..5f61c3104b 100644
--- a/web/packages/new/photos/services/ml/people.ts
+++ b/web/packages/new/photos/services/ml/people.ts
@@ -172,7 +172,7 @@ export const reconstructPeople = async (): Promise<Person[]> => {
const cgroups = await savedCGroups();
const cgroupPeople: Interim = cgroups.map((cgroup) => {
const { id, data } = cgroup;
- const { name, isHidden, assigned, avatarFaceID } = data;
+ const { name, isHidden, assigned } = data;
// Hidden cgroups are clusters specifically marked so as to not be shown
// in the UI.
@@ -196,6 +196,7 @@ export const reconstructPeople = async (): Promise<Person[]> => {
// Avatar face ID, or the highest scoring face.
let avatarFile: EnteFile | undefined;
+ const avatarFaceID = resolvedAvatarFaceID(data.avatarFaceID);
if (avatarFaceID) {
const avatarFileID = fileIDFromFaceID(avatarFaceID);
if (avatarFileID) avatarFile = fileByID.get(avatarFileID);
@@ -253,6 +254,14 @@ export const reconstructPeople = async (): Promise<Person[]> => {
.sort((a, b) => b.fileIDs.length - a.fileIDs.length);
};
+/**
+ * Older versions of the mobile app set the avatarFileID as the avatarFaceID.
+ * Use the format of the string to detect such cases, and as a workaround,
+ * ignore the avatarID in such cases.
+ */
+const resolvedAvatarFaceID = (avatarFaceID: string | undefined) =>
+ avatarFaceID?.split("_").length == 1 ? undefined : avatarFaceID;
+
/**
* Convert a cluster into a named cgroup, updating both remote and local state.
*