Enable media editor for everyone
This commit is contained in:
parent
71e9498961
commit
97d42d5e7b
4 changed files with 3 additions and 29 deletions
|
@ -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}
|
||||
|
|
|
@ -46,7 +46,7 @@ story.add('One File', () => {
|
|||
}),
|
||||
],
|
||||
});
|
||||
return <AttachmentList {...props} canEditImages />;
|
||||
return <AttachmentList {...props} />;
|
||||
});
|
||||
|
||||
story.add('Multiple Visual Attachments', () => {
|
||||
|
|
|
@ -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}
|
||||
|
|
|
@ -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())
|
||||
);
|
||||
}
|
Loading…
Reference in a new issue