Allow UID 1 to re-index

This commit is contained in:
Manav Rathi 2024-05-06 20:11:27 +05:30
parent 94ec766bc6
commit e934cc8cb4
No known key found for this signature in database
3 changed files with 13 additions and 7 deletions

View file

@ -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"}

View file

@ -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,

View file

@ -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 === "kr.anand619@gmail.com"
);
return userEmail.endsWith("@ente.io");
};
export const isInternalUserForML = () => {
const userId = (getData(LS_KEYS.USER) as User)?.id;
if (userId == 1) return true;
return isInternalUser();
};