Prepare for internal users

This commit is contained in:
Manav Rathi
2024-07-29 14:19:17 +05:30
parent b61e4f4ac6
commit bae717dc69
3 changed files with 10 additions and 15 deletions

View File

@@ -1,4 +1,3 @@
import { isDevBuild } from "@/base/env";
import { authenticatedRequestHeaders, ensureOk } from "@/base/http";
import { localUser } from "@/base/local-user";
import log from "@/base/log";
@@ -104,16 +103,13 @@ const remoteFeatureFlagsFetchingIfNeeded = async () => {
/**
* Return `true` if the current user is marked as an "internal" user.
*
* 1. Everyone is considered as an internal user in dev builds.
* 2. Emails that end in `@ente.io` are always considered as internal users.
* 3. If the "internalUser" remote feature flag is set, the user is internal.
* 4. Otherwise false.
* 1. Emails that end in `@ente.io` are considered as internal users.
* 2. If the "internalUser" remote feature flag is set, the user is internal.
* 3. Otherwise false.
*
* See also: [Note: Feature Flags].
*/
export const isInternalUser = async () => {
if (isDevBuild) return true;
const user = localUser();
if (user?.email.endsWith("@ente.io")) return true;

View File

@@ -11,7 +11,7 @@ import { FileType } from "@/media/file-type";
import type { EnteFile } from "@/new/photos/types/file";
import { throttled } from "@/utils/promise";
import { proxy } from "comlink";
import { isBetaUser, isInternalUser } from "../feature-flags";
import { isInternalUser } from "../feature-flags";
import { getRemoteFlag, updateRemoteFlag } from "../remote-store";
import type { UploadItem } from "../upload/types";
import { regenerateFaceCrops } from "./crop";
@@ -97,17 +97,17 @@ export const terminateMLWorker = () => {
*
* ML currently only works when we're running in our desktop app.
*/
// TODO-ML:
export const isMLSupported =
isDesktop && process.env.NEXT_PUBLIC_ENTE_ENABLE_WIP_ML_DONT_USE;
export const isMLSupported = isDesktop;
/**
* TODO-ML: This will not be needed when we move to a public beta.
* Was this someone who might've enabled the beta ML? If so, show them the
* coming back soon banner while we finalize it.
* TODO-ML:
*/
export const canEnableML = async () =>
(await isInternalUser()) || (await isBetaUser());
// TODO-ML: The interim condition should be
// isDevBuild || (await isInternalUser()) || (await isBetaUser());
await isInternalUser();
/**
* Initialize the ML subsystem if the user has enabled it in preferences.

View File

@@ -5,8 +5,7 @@ export interface Person {
displayFaceId: string;
}
// TODO-ML(MR): Forced disable clustering. It doesn't currently work,
// need to finalize it before we move out of beta.
// Forced disable clustering. It doesn't currently work.
//
// > Error: Failed to execute 'transferToImageBitmap' on
// > 'OffscreenCanvas': ImageBitmap construction failed