Enable formatting for all users
This commit is contained in:
parent
d2b06413f3
commit
23b058fe10
5 changed files with 22 additions and 14 deletions
|
@ -870,6 +870,17 @@ export async function startApp(): Promise<void> {
|
|||
await window.storage.remove('remoteBuildExpiration');
|
||||
}
|
||||
|
||||
if (window.isBeforeVersion(lastVersion, '6.22.0-alpha')) {
|
||||
const formattingWarningShown = window.storage.get(
|
||||
'formattingWarningShown',
|
||||
false
|
||||
);
|
||||
log.info(
|
||||
`Clearing formattingWarningShown. Previous value was ${formattingWarningShown}`
|
||||
);
|
||||
await window.storage.put('formattingWarningShown', false);
|
||||
}
|
||||
|
||||
if (window.isBeforeVersion(lastVersion, 'v1.29.2-beta.1')) {
|
||||
// Stickers flags
|
||||
await Promise.all([
|
||||
|
|
|
@ -18,6 +18,7 @@ import type {
|
|||
} from '../../types/Attachment';
|
||||
import type { BoundActionCreatorsMapObject } from '../../hooks/useBoundActions';
|
||||
import type { DraftBodyRanges } from '../../types/BodyRange';
|
||||
import { BodyRange } from '../../types/BodyRange';
|
||||
import type { LinkPreviewType } from '../../types/message/LinkPreviews';
|
||||
import type { MessageAttributesType } from '../../model-types.d';
|
||||
import type { NoopActionType } from './noop';
|
||||
|
@ -431,8 +432,9 @@ async function withPreSendChecks(
|
|||
}
|
||||
|
||||
try {
|
||||
if (bodyRanges?.length && !window.storage.get('formattingWarningShown')) {
|
||||
const sendAnyway = await maybeBlockSendForFormattingModal(bodyRanges);
|
||||
const hasFormatting = bodyRanges?.some(BodyRange.isFormatting);
|
||||
if (hasFormatting && !window.storage.get('formattingWarningShown')) {
|
||||
const sendAnyway = await maybeBlockSendForFormattingModal();
|
||||
if (!sendAnyway) {
|
||||
dispatch(setComposerDisabledState(conversationId, false));
|
||||
return;
|
||||
|
|
|
@ -27,13 +27,16 @@ export const getQuotedMessageSelector = createSelector(
|
|||
export const getIsFormattingFlagEnabled = createSelector(
|
||||
getRemoteConfig,
|
||||
remoteConfig => {
|
||||
return isRemoteConfigFlagEnabled(remoteConfig, 'desktop.internalUser');
|
||||
return isRemoteConfigFlagEnabled(remoteConfig, 'desktop.textFormatting');
|
||||
}
|
||||
);
|
||||
|
||||
export const getIsFormattingSpoilersFlagEnabled = createSelector(
|
||||
getRemoteConfig,
|
||||
remoteConfig => {
|
||||
return isRemoteConfigFlagEnabled(remoteConfig, 'desktop.internalUser');
|
||||
return isRemoteConfigFlagEnabled(
|
||||
remoteConfig,
|
||||
'desktop.textFormatting.spoilerSend'
|
||||
);
|
||||
}
|
||||
);
|
||||
|
|
|
@ -414,7 +414,7 @@ export function createIPCEvents(
|
|||
return window.IPC.setAutoLaunch(value);
|
||||
},
|
||||
|
||||
isFormattingFlagEnabled: () => isEnabled('desktop.internalUser'),
|
||||
isFormattingFlagEnabled: () => isEnabled('desktop.textFormatting'),
|
||||
isPhoneNumberSharingEnabled: () => isPhoneNumberSharingEnabled(),
|
||||
isPrimary: () => window.textsecure.storage.user.getDeviceId() === 1,
|
||||
shouldShowStoriesSettings: () => getStoriesAvailable(),
|
||||
|
|
|
@ -1,17 +1,9 @@
|
|||
// Copyright 2022 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { DraftBodyRanges } from '../types/BodyRange';
|
||||
import { BodyRange } from '../types/BodyRange';
|
||||
import { explodePromise } from './explodePromise';
|
||||
|
||||
export async function maybeBlockSendForFormattingModal(
|
||||
bodyRanges: DraftBodyRanges
|
||||
): Promise<boolean> {
|
||||
if (!bodyRanges.some(BodyRange.isFormatting)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
export async function maybeBlockSendForFormattingModal(): Promise<boolean> {
|
||||
const explodedPromise = explodePromise<boolean>();
|
||||
window.reduxActions.globalModals.showFormattingWarningModal(explodedPromise);
|
||||
return explodedPromise.promise;
|
||||
|
|
Loading…
Add table
Reference in a new issue