Skip to content

armgit / ente

Public Imported from GitHub
0

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

Allow UID 1 to re-index

Manav Rathie934cc8cb4c3
diff --git a/web/apps/photos/src/components/ml/MLSearchSettings.tsx b/web/apps/photos/src/components/ml/MLSearchSettings.tsx
index 9b50c2d6ae..409df4fc6f 100644
--- a/web/apps/photos/src/components/ml/MLSearchSettings.tsx
+++ b/web/apps/photos/src/components/ml/MLSearchSettings.tsx
@@ -22,7 +22,7 @@ import {
getFaceSearchEnabledStatus,
updateFaceSearchEnabledStatus,
} from "services/userService";
-import { isInternalUser } from "utils/user";
+import { isInternalUserForML } from "utils/user";
export const MLSearchSettings = ({ open, onClose, onRootClose }) => {
const {
@@ -280,7 +280,7 @@ function EnableMLSearch({ onClose, enableMlSearch, onRootClose }) {
</p>
</Typography>
</Box>
- {isInternalUser() && (
+ {isInternalUserForML() && (
<Stack px={"8px"} spacing={"8px"}>
<Button
color={"accent"}
diff --git a/web/apps/photos/src/utils/machineLearning/config.ts b/web/apps/photos/src/utils/machineLearning/config.ts
index 30a65b8f1d..0c25356aba 100644
--- a/web/apps/photos/src/utils/machineLearning/config.ts
+++ b/web/apps/photos/src/utils/machineLearning/config.ts
@@ -10,7 +10,7 @@ import mlIDbStorage, {
ML_SYNC_CONFIG_NAME,
ML_SYNC_JOB_CONFIG_NAME,
} from "utils/storage/mlIDbStorage";
-import { isInternalUser } from "utils/user";
+import { isInternalUserForML } from "utils/user";
export async function getMLSyncJobConfig() {
return mlIDbStorage.getConfig(
@@ -24,7 +24,7 @@ export async function getMLSyncConfig() {
}
export async function getMLSearchConfig() {
- if (isInternalUser()) {
+ if (isInternalUserForML()) {
return mlIDbStorage.getConfig(
ML_SEARCH_CONFIG_NAME,
DEFAULT_ML_SEARCH_CONFIG,
diff --git a/web/apps/photos/src/utils/user/index.ts b/web/apps/photos/src/utils/user/index.ts
index 17551014d0..68ffc9bbd7 100644
--- a/web/apps/photos/src/utils/user/index.ts
+++ b/web/apps/photos/src/utils/user/index.ts
@@ -1,4 +1,5 @@
import { getData, LS_KEYS } from "@ente/shared/storage/localStorage";
+import type { User } from "@ente/shared/user/types";
import { UserDetails } from "types/user";
export function getLocalUserDetails(): UserDetails {
@@ -9,7 +10,12 @@ export const isInternalUser = () => {
const userEmail = getData(LS_KEYS.USER)?.email;
if (!userEmail) return false;
- return (
- userEmail.endsWith("@ente.io") || userEmail === "[email protected]"
- );
+ return userEmail.endsWith("@ente.io");
+};
+
+export const isInternalUserForML = () => {
+ const userId = (getData(LS_KEYS.USER) as User)?.id;
+ if (userId == 1) return true;
+
+ return isInternalUser();
};