Skip to content

armgit / ente

Public Imported from GitHub
0

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

[web][photos] Remove server feature flag for comments

Anand Baburajanb79f5a8fa77c
diff --git a/web/apps/photos/src/components/Collections/CollectionShare.tsx b/web/apps/photos/src/components/Collections/CollectionShare.tsx
index e6ca60803c..93750b4de8 100644
--- a/web/apps/photos/src/components/Collections/CollectionShare.tsx
+++ b/web/apps/photos/src/components/Collections/CollectionShare.tsx
@@ -1903,8 +1903,6 @@ const ManagePublicCollect: React.FC<ManagePublicLinkSettingProps> = ({
publicURL,
onUpdate,
}) => {
- const { isCommentsEnabled } = useSettingsSnapshot();
-
const handleCollectSetting = () => {
void onUpdate({ enableCollect: !publicURL.enableCollect });
};
@@ -1921,16 +1919,12 @@ const ManagePublicCollect: React.FC<ManagePublicLinkSettingProps> = ({
checked={publicURL.enableCollect}
onClick={handleCollectSetting}
/>
- {isCommentsEnabled && (
- <>
- <RowButtonDivider />
- <RowSwitch
- label={t("enable_comments")}
- checked={publicURL.enableComment}
- onClick={handleCommentSetting}
- />
- </>
- )}
+ <RowButtonDivider />
+ <RowSwitch
+ label={t("enable_comments")}
+ checked={publicURL.enableComment}
+ onClick={handleCommentSetting}
+ />
</RowButtonGroup>
</Stack>
);
diff --git a/web/apps/photos/src/components/FileListWithViewer.tsx b/web/apps/photos/src/components/FileListWithViewer.tsx
index 7faaeb076e..f2432e9773 100644
--- a/web/apps/photos/src/components/FileListWithViewer.tsx
+++ b/web/apps/photos/src/components/FileListWithViewer.tsx
@@ -206,7 +206,7 @@ export const FileListWithViewer: React.FC<FileListWithViewerProps> = ({
const { show: showMapDialog, props: mapDialogVisibilityProps } =
useModalVisibility();
const { onGenericError } = useBaseContext();
- const { mapEnabled, isCommentsEnabled } = useSettingsSnapshot();
+ const { mapEnabled } = useSettingsSnapshot();
const { mode: colorSchemeMode, systemMode } = useColorScheme();
const theme = useTheme();
const resolvedMode =
@@ -401,7 +401,7 @@ export const FileListWithViewer: React.FC<FileListWithViewerProps> = ({
enableComment,
enableJoin,
}}
- isCommentsFeatureEnabled={isCommentsEnabled}
+ isCommentsFeatureEnabled
onTriggerRemotePull={handleTriggerRemotePull}
onDownload={handleDownload}
onDelete={handleDelete}
diff --git a/web/packages/gallery/components/viewer/FileViewer.tsx b/web/packages/gallery/components/viewer/FileViewer.tsx
index 896c0f516b..6bf34e666d 100644
--- a/web/packages/gallery/components/viewer/FileViewer.tsx
+++ b/web/packages/gallery/components/viewer/FileViewer.tsx
@@ -356,9 +356,8 @@ export type FileViewerProps = ModalVisibilityProps & {
/**
* `true` if the comments and reactions feature is enabled for the user.
*
- * This is controlled by a server-side feature flag. When `false`, the
- * like and comment buttons will be hidden for logged-in users.
- * Defaults to `false`.
+ * When `false`, the like and comment buttons will be hidden for logged-in
+ * users. Defaults to `true`.
*/
isCommentsFeatureEnabled?: boolean;
/**
@@ -412,7 +411,7 @@ export const FileViewer: React.FC<FileViewerProps> = ({
collectionKey,
onJoinAlbum,
enableComment = true,
- isCommentsFeatureEnabled = false,
+ isCommentsFeatureEnabled = true,
enableJoin = true,
}) => {
const { onGenericError } = useBaseContext();
diff --git a/web/packages/new/photos/services/collection.ts b/web/packages/new/photos/services/collection.ts
index 4383df7f64..7552a3be26 100644
--- a/web/packages/new/photos/services/collection.ts
+++ b/web/packages/new/photos/services/collection.ts
@@ -49,7 +49,6 @@ import {
savedCollections,
savedCollectionsUpdationTime,
} from "./photos-fdb";
-import { settingsSnapshot } from "./settings";
import { ensureUserKeyPair, getPublicKey } from "./user";
const uncategorizedCollectionName = "Uncategorized";
@@ -1464,8 +1463,7 @@ export const createPublicURL = async (
collectionID: number,
attributes?: CreatePublicURLAttributes,
): Promise<PublicURL> => {
- // Only enable comments by default if the feature flag is enabled.
- const enableComment = settingsSnapshot().isCommentsEnabled;
+ const enableComment = true;
const res = await fetch(await apiURL("/collections/share-url"), {
method: "POST",
headers: await authenticatedRequestHeaders(),
diff --git a/web/packages/new/photos/services/settings.ts b/web/packages/new/photos/services/settings.ts
index d9c11b0a50..1601cac11d 100644
--- a/web/packages/new/photos/services/settings.ts
+++ b/web/packages/new/photos/services/settings.ts
@@ -47,10 +47,6 @@ export interface Settings {
* `true` if the current user is an internal user.
*/
isInternalUser: boolean;
- /**
- * `true` if the comments and reactions feature is enabled.
- */
- isCommentsEnabled: boolean;
/**
* `true` if maps are enabled.
@@ -110,7 +106,6 @@ export interface Settings {
const createDefaultSettings = (): Settings => ({
isInternalUser: false,
- isCommentsEnabled: false,
mapEnabled: false,
cfUploadProxyDisabled: false,
castURL: "https://cast.ente.io",
@@ -197,23 +192,12 @@ const FeatureFlags = z.object({
customDomainCNAME: z.string().nullish().transform(nullToUndefined),
});
-/**
- * Bit flags for server API features.
- * These correspond to the constants in server/ente/remotestore.go.
- */
-const ServerApiFlag = {
- /** Comments feature is enabled. */
- Comments: 1 << 1,
-};
-
type FeatureFlags = z.infer<typeof FeatureFlags>;
const syncSettingsSnapshotWithLocalStorage = () => {
const flags = savedRemoteFeatureFlags();
const settings = createDefaultSettings();
settings.isInternalUser = flags?.internalUser || false;
- settings.isCommentsEnabled =
- ((flags?.serverApiFlag ?? 0) & ServerApiFlag.Comments) !== 0;
settings.mapEnabled = flags?.mapEnabled || false;
settings.cfUploadProxyDisabled = savedCFProxyDisabled();
if (flags?.castUrl) settings.castURL = flags.castUrl;