Skip to content

armgit / ente

Public Imported from GitHub
0

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

[web] Match mobile's internal user spec

Manav Rathi4b5618e1f2a5
diff --git a/web/apps/photos/src/components/Sidebar.tsx b/web/apps/photos/src/components/Sidebar.tsx
index fba039ffb2..647a8719d6 100644
--- a/web/apps/photos/src/components/Sidebar.tsx
+++ b/web/apps/photos/src/components/Sidebar.tsx
@@ -25,7 +25,6 @@ import {
type ModalVisibilityProps,
} from "@/base/components/utils/modal";
import { useBaseContext } from "@/base/context";
-import { isDevBuild } from "@/base/env";
import {
getLocaleInUse,
setLocaleInUse,
@@ -58,7 +57,7 @@ import {
import type { CollectionSummaries } from "@/new/photos/services/collection/ui";
import { isMLSupported } from "@/new/photos/services/ml";
import {
- isInternalUser,
+ isDevBuildAndUser,
syncSettings,
updateCFProxyDisabledPreference,
updateMapEnabled,
@@ -1148,7 +1147,7 @@ const Help: React.FC<NestedSidebarDrawerVisibilityProps> = ({
}
onClick={confirmViewLogs}
/>
- {isInternalUser() && isDevBuild && (
+ {isDevBuildAndUser() && (
<RowButton
variant="secondary"
label={
diff --git a/web/packages/new/photos/services/settings.ts b/web/packages/new/photos/services/settings.ts
index 9a91ad2d49..06aa63c3d2 100644
--- a/web/packages/new/photos/services/settings.ts
+++ b/web/packages/new/photos/services/settings.ts
@@ -8,6 +8,7 @@
//
/* eslint-disable @typescript-eslint/prefer-nullish-coalescing */
+import { isDevBuild } from "@/base/env";
import { localUser } from "@/base/local-user";
import log from "@/base/log";
import { updateShouldDisableCFUploadProxy } from "@/gallery/services/upload";
@@ -152,7 +153,7 @@ type FeatureFlags = z.infer<typeof FeatureFlags>;
const syncSettingsSnapshotWithLocalStorage = () => {
const flags = savedRemoteFeatureFlags();
const settings = createDefaultSettings();
- settings.isInternalUser = flags?.internalUser || isInternalUserViaEmail();
+ settings.isInternalUser = flags?.internalUser || false;
settings.mapEnabled = flags?.mapEnabled || false;
settings.cfUploadProxyDisabled = savedCFProxyDisabled();
if (flags?.castUrl) settings.castURL = flags.castUrl;
@@ -185,19 +186,18 @@ const setSettingsSnapshot = (snapshot: Settings) => {
_state.settingsListeners.forEach((l) => l());
};
-const isInternalUserViaEmail = () => {
- const user = localUser();
- return !!user?.email.endsWith("@ente.io");
-};
-
/**
- * Return `true` if the current user is marked as an "internal" user.
+ * Return `true` if this is a development build, and the current user is marked
+ * as an "development" user.
*
- * 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.
+ * Emails that end in "@ente.io" are considered as dev users.
*/
-export const isInternalUser = () => settingsSnapshot().isInternalUser;
+export const isDevBuildAndUser = () => isDevBuild && isDevUserViaEmail();
+
+const isDevUserViaEmail = () => {
+ const user = localUser();
+ return !!user?.email.endsWith("@ente.io");
+};
/**
* Persist the user's map enabled preference both locally and on remote.