From 97d42d5e7b9dfb29961a837327cb2fd8a12824ce Mon Sep 17 00:00:00 2001 From: Evan Hahn <69474926+EvanHahn-Signal@users.noreply.github.com> Date: Tue, 14 Dec 2021 18:53:15 -0600 Subject: [PATCH] Enable media editor for everyone --- ts/components/CompositionArea.tsx | 9 +-------- .../conversation/AttachmentList.stories.tsx | 2 +- ts/components/conversation/AttachmentList.tsx | 4 +--- ts/util/canEditImages.ts | 17 ----------------- 4 files changed, 3 insertions(+), 29 deletions(-) delete mode 100644 ts/util/canEditImages.ts diff --git a/ts/components/CompositionArea.tsx b/ts/components/CompositionArea.tsx index 9b50d8c87dc..0f6e33b32b3 100644 --- a/ts/components/CompositionArea.tsx +++ b/ts/components/CompositionArea.tsx @@ -58,7 +58,6 @@ import { import { MediaEditor } from './MediaEditor'; import { IMAGE_PNG } from '../types/MIME'; import { isImageTypeSupported } from '../util/GoogleChrome'; -import { canEditImages } from '../util/canEditImages'; export type CompositionAPIType = | { @@ -293,13 +292,8 @@ export const CompositionArea = ({ } }, []); - const hasImageEditingEnabled = canEditImages(); - function maybeEditAttachment(attachment: AttachmentDraftType) { - if ( - !hasImageEditingEnabled || - !isImageTypeSupported(attachment.contentType) - ) { + if (!isImageTypeSupported(attachment.contentType)) { return; } @@ -647,7 +641,6 @@ export const CompositionArea = ({
{ }), ], }); - return ; + return ; }); story.add('Multiple Visual Attachments', () => { diff --git a/ts/components/conversation/AttachmentList.tsx b/ts/components/conversation/AttachmentList.tsx index a39d399e58e..512fc9b7d0c 100644 --- a/ts/components/conversation/AttachmentList.tsx +++ b/ts/components/conversation/AttachmentList.tsx @@ -20,7 +20,6 @@ import { export type Props = Readonly<{ attachments: ReadonlyArray; - canEditImages?: boolean; i18n: LocalizerType; onAddAttachment?: () => void; onClickAttachment?: (attachment: T) => void; @@ -51,7 +50,6 @@ function getUrl( export const AttachmentList = ({ attachments, - canEditImages, i18n, onAddAttachment, onClickAttachment, @@ -121,7 +119,7 @@ export const AttachmentList = ({ /> ); - if (isImage && canEditImages) { + if (isImage) { return (
{imgElement} diff --git a/ts/util/canEditImages.ts b/ts/util/canEditImages.ts deleted file mode 100644 index 142afa0478e..00000000000 --- a/ts/util/canEditImages.ts +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2021 Signal Messenger, LLC -// SPDX-License-Identifier: AGPL-3.0-only - -import { isEnabled } from '../RemoteConfig'; -import { getEnvironment, Environment } from '../environment'; -import { isBeta } from './version'; - -export function canEditImages(): boolean { - return ( - isEnabled('desktop.internalUser') || - getEnvironment() === Environment.Staging || - getEnvironment() === Environment.Development || - // eslint-disable-next-line @typescript-eslint/no-explicit-any - Boolean((window as any).STORYBOOK_ENV) || - isBeta(window.getVersion()) - ); -}