Skip to content

armgit / ente

Public Imported from GitHub
0

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

Match remote nomenclature

Manav Rathib33e155b105b
diff --git a/web/packages/new/photos/components/gallery/PeopleHeader.tsx b/web/packages/new/photos/components/gallery/PeopleHeader.tsx
index e665664d80..576a3d1890 100644
--- a/web/packages/new/photos/components/gallery/PeopleHeader.tsx
+++ b/web/packages/new/photos/components/gallery/PeopleHeader.tsx
@@ -287,12 +287,12 @@ interface SuggestionsDialogState {
/**
* An entry corresponding to each
* - saved choice for which the user has changed their mind.
- * - suggestion that the user has either explicitly accepted or rejected.
+ * - suggestion that the user has either explicitly assigned or rejected.
*/
marks: Map<string, boolean | undefined>;
}
-type SCItem = PreviewableCluster & { fixed?: boolean; accepted?: boolean };
+type SCItem = PreviewableCluster & { fixed?: boolean; assigned?: boolean };
type SuggestionsDialogAction =
| { type: "fetch"; personID: string }
@@ -345,13 +345,13 @@ const suggestionsDialogReducer = (
case "mark": {
const marks = new Map(state.marks);
const { item, value } = action;
- if (item.accepted === undefined && value === undefined) {
+ if (item.assigned === undefined && value === undefined) {
// If this was a suggestion, prune marks created as a result of
// the user toggling the item back to its original unset state.
marks.delete(item.id);
- } else if (item.accepted && value === item.accepted) {
+ } else if (item.assigned && value === item.assigned) {
// If this is a choice, prune marks which match the choice's
- // accepted state.
+ // assigned state.
marks.delete(item.id);
} else {
marks.set(item.id, value);
@@ -447,7 +447,7 @@ const SuggestionsDialog: React.FC<SuggestionsDialogProps> = ({
// This state will not include the effects of the `dispatch({ type:
// "save"})` above, but that's fine, that only toggles the activity
// which is not going to affect the state that is saved.
- await saveSuggestionsAndChoices(state);
+ await saveSuggestionsAndChoices(person, state);
resetPersonAndClose();
} catch (e) {
log.error("Failed to save suggestion review", e);
@@ -618,7 +618,7 @@ const fromItemValue = (
) => {
// Use the in-memory state if available. For choices, fallback to their
// original state.
- const resolved = marks.has(item.id) ? marks.get(item.id) : item.accepted;
+ const resolved = marks.has(item.id) ? marks.get(item.id) : item.assigned;
return resolved ? "yes" : resolved === false ? "no" : undefined;
};
@@ -629,4 +629,11 @@ const toItemValue = (v: unknown) =>
/**
* Implementation for the "save" action on the SuggestionsDialog.
*/
-const saveSuggestionsAndChoices = async (state: SuggestionsDialogState) => {};
+const saveSuggestionsAndChoices = async (
+ person: CGroupPerson,
+ state: SuggestionsDialogState,
+) => {
+ // const assigned = person.cgroup.data.assigned
+ // for (const [clusterID, assigned] of state.marks) {
+ // }
+};
diff --git a/web/packages/new/photos/services/ml/people.ts b/web/packages/new/photos/services/ml/people.ts
index f6fca83fd8..a4261aab78 100644
--- a/web/packages/new/photos/services/ml/people.ts
+++ b/web/packages/new/photos/services/ml/people.ts
@@ -337,21 +337,21 @@ export interface PersonSuggestionsAndChoices {
/**
* Previously saved choices.
*
- * These are clusters (sorted by size) that the user had previously merged
- * or explicitly ignored from the person under consideration.
+ * These are clusters (sorted by size) that the user had previously assigned
+ * to or explicitly rejected from the person under consideration.
*
- * The {@link accepted} flag will true for the entries that correspond to
- * accepted clusters, and false for those that the user had ignored.
+ * The {@link assigned} flag will true for the entries that correspond to
+ * assigned clusters, and false for those that the user had rejected.
*
* This array is guaranteed to be non-empty, and it is guaranteed that the
- * first item is a merged cluster (i.e. a cluster for which accepted is
+ * first item is a merged cluster (i.e. a cluster for which assigned is
* true), even if there exists an ignored cluster with a larger size. The
* rest of the entries are intermixed and sorted by size normally.
*
- * For convenience of the UI, teh first entry will have also have the
+ * For convenience of the UI, the first entry will have also have the
* {@link fixed} flag set.
*/
- choices: (PreviewableCluster & { fixed?: boolean; accepted: boolean })[];
+ choices: (PreviewableCluster & { fixed?: boolean; assigned: boolean })[];
/**
* New suggestions to offer to the user.
*/
@@ -474,23 +474,23 @@ export const _suggestionsAndChoicesForPerson = async (
const sortBySize = (entries: { faces: unknown[] }[]) =>
entries.sort((a, b) => b.faces.length - a.faces.length);
- const acceptedChoices = toPreviewableList(personClusters).map((p) => ({
+ const assignedChoices = toPreviewableList(personClusters).map((p) => ({
...p,
- accepted: true,
+ assigned: true,
}));
- sortBySize(acceptedChoices);
+ sortBySize(assignedChoices);
- const ignoredChoices = toPreviewableList(rejectedClusters).map((p) => ({
+ const rejectedChoices = toPreviewableList(rejectedClusters).map((p) => ({
...p,
- accepted: false,
+ assigned: false,
}));
// Ensure that the first item in the choices is not an ignored one, even if
// that is what we'd have ended up with if we sorted by size.
- const firstChoice = { ...ensure(acceptedChoices[0]), fixed: true };
- const restChoices = acceptedChoices.slice(1).concat(ignoredChoices);
+ const firstChoice = { ...ensure(assignedChoices[0]), fixed: true };
+ const restChoices = assignedChoices.slice(1).concat(rejectedChoices);
sortBySize(restChoices);
const choices = [firstChoice, ...restChoices];