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');
|
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')) {
|
if (window.isBeforeVersion(lastVersion, 'v1.29.2-beta.1')) {
|
||||||
// Stickers flags
|
// Stickers flags
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
|
|
@ -18,6 +18,7 @@ import type {
|
||||||
} from '../../types/Attachment';
|
} from '../../types/Attachment';
|
||||||
import type { BoundActionCreatorsMapObject } from '../../hooks/useBoundActions';
|
import type { BoundActionCreatorsMapObject } from '../../hooks/useBoundActions';
|
||||||
import type { DraftBodyRanges } from '../../types/BodyRange';
|
import type { DraftBodyRanges } from '../../types/BodyRange';
|
||||||
|
import { BodyRange } from '../../types/BodyRange';
|
||||||
import type { LinkPreviewType } from '../../types/message/LinkPreviews';
|
import type { LinkPreviewType } from '../../types/message/LinkPreviews';
|
||||||
import type { MessageAttributesType } from '../../model-types.d';
|
import type { MessageAttributesType } from '../../model-types.d';
|
||||||
import type { NoopActionType } from './noop';
|
import type { NoopActionType } from './noop';
|
||||||
|
@ -431,8 +432,9 @@ async function withPreSendChecks(
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (bodyRanges?.length && !window.storage.get('formattingWarningShown')) {
|
const hasFormatting = bodyRanges?.some(BodyRange.isFormatting);
|
||||||
const sendAnyway = await maybeBlockSendForFormattingModal(bodyRanges);
|
if (hasFormatting && !window.storage.get('formattingWarningShown')) {
|
||||||
|
const sendAnyway = await maybeBlockSendForFormattingModal();
|
||||||
if (!sendAnyway) {
|
if (!sendAnyway) {
|
||||||
dispatch(setComposerDisabledState(conversationId, false));
|
dispatch(setComposerDisabledState(conversationId, false));
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -27,13 +27,16 @@ export const getQuotedMessageSelector = createSelector(
|
||||||
export const getIsFormattingFlagEnabled = createSelector(
|
export const getIsFormattingFlagEnabled = createSelector(
|
||||||
getRemoteConfig,
|
getRemoteConfig,
|
||||||
remoteConfig => {
|
remoteConfig => {
|
||||||
return isRemoteConfigFlagEnabled(remoteConfig, 'desktop.internalUser');
|
return isRemoteConfigFlagEnabled(remoteConfig, 'desktop.textFormatting');
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
export const getIsFormattingSpoilersFlagEnabled = createSelector(
|
export const getIsFormattingSpoilersFlagEnabled = createSelector(
|
||||||
getRemoteConfig,
|
getRemoteConfig,
|
||||||
remoteConfig => {
|
remoteConfig => {
|
||||||
return isRemoteConfigFlagEnabled(remoteConfig, 'desktop.internalUser');
|
return isRemoteConfigFlagEnabled(
|
||||||
|
remoteConfig,
|
||||||
|
'desktop.textFormatting.spoilerSend'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -414,7 +414,7 @@ export function createIPCEvents(
|
||||||
return window.IPC.setAutoLaunch(value);
|
return window.IPC.setAutoLaunch(value);
|
||||||
},
|
},
|
||||||
|
|
||||||
isFormattingFlagEnabled: () => isEnabled('desktop.internalUser'),
|
isFormattingFlagEnabled: () => isEnabled('desktop.textFormatting'),
|
||||||
isPhoneNumberSharingEnabled: () => isPhoneNumberSharingEnabled(),
|
isPhoneNumberSharingEnabled: () => isPhoneNumberSharingEnabled(),
|
||||||
isPrimary: () => window.textsecure.storage.user.getDeviceId() === 1,
|
isPrimary: () => window.textsecure.storage.user.getDeviceId() === 1,
|
||||||
shouldShowStoriesSettings: () => getStoriesAvailable(),
|
shouldShowStoriesSettings: () => getStoriesAvailable(),
|
||||||
|
|
|
@ -1,17 +1,9 @@
|
||||||
// Copyright 2022 Signal Messenger, LLC
|
// Copyright 2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { DraftBodyRanges } from '../types/BodyRange';
|
|
||||||
import { BodyRange } from '../types/BodyRange';
|
|
||||||
import { explodePromise } from './explodePromise';
|
import { explodePromise } from './explodePromise';
|
||||||
|
|
||||||
export async function maybeBlockSendForFormattingModal(
|
export async function maybeBlockSendForFormattingModal(): Promise<boolean> {
|
||||||
bodyRanges: DraftBodyRanges
|
|
||||||
): Promise<boolean> {
|
|
||||||
if (!bodyRanges.some(BodyRange.isFormatting)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
const explodedPromise = explodePromise<boolean>();
|
const explodedPromise = explodePromise<boolean>();
|
||||||
window.reduxActions.globalModals.showFormattingWarningModal(explodedPromise);
|
window.reduxActions.globalModals.showFormattingWarningModal(explodedPromise);
|
||||||
return explodedPromise.promise;
|
return explodedPromise.promise;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue