Enable media editor for everyone

Co-authored-by: Evan Hahn <69474926+EvanHahn-Signal@users.noreply.github.com>
This commit is contained in:
automated-signal 2021-12-14 17:19:31 -08:00 committed by GitHub
parent 3ec96bde78
commit ffbedc2955
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 3 additions and 29 deletions

View File

@ -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 = ({
<div className="CompositionArea__attachment-list">
<AttachmentList
attachments={draftAttachments}
canEditImages={hasImageEditingEnabled}
i18n={i18n}
onAddAttachment={launchAttachmentPicker}
onClickAttachment={maybeEditAttachment}

View File

@ -46,7 +46,7 @@ story.add('One File', () => {
}),
],
});
return <AttachmentList {...props} canEditImages />;
return <AttachmentList {...props} />;
});
story.add('Multiple Visual Attachments', () => {

View File

@ -20,7 +20,6 @@ import {
export type Props<T extends AttachmentType | AttachmentDraftType> = Readonly<{
attachments: ReadonlyArray<T>;
canEditImages?: boolean;
i18n: LocalizerType;
onAddAttachment?: () => void;
onClickAttachment?: (attachment: T) => void;
@ -51,7 +50,6 @@ function getUrl(
export const AttachmentList = <T extends AttachmentType | AttachmentDraftType>({
attachments,
canEditImages,
i18n,
onAddAttachment,
onClickAttachment,
@ -121,7 +119,7 @@ export const AttachmentList = <T extends AttachmentType | AttachmentDraftType>({
/>
);
if (isImage && canEditImages) {
if (isImage) {
return (
<div className="module-attachments--editable">
{imgElement}

View File

@ -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())
);
}