Merge pull request #37 from Bilb/userconfig_disappearingmessage

QA fixes
pull/2971/head
Will G 1 year ago committed by GitHub
commit d6fb639213
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -27,6 +27,7 @@
transform: translateX(100%);
will-change: transform;
width: 25vw;
min-width: 350px; // because the disappear messages don't render well with less than this, and 25vw can be less than that
z-index: 5;
background-color: var(--background-primary-color);

@ -89,7 +89,7 @@ export type PanelButtonProps = {
disabled?: boolean;
children: ReactNode;
onClick: (...args: Array<any>) => void;
dataTestId?: string;
dataTestId: string;
style?: CSSProperties;
};

@ -302,6 +302,7 @@ export const OverlayRightPanelSettings = () => {
<SpacerLG />
</>
)}
{showUpdateGroupNameButton && (
<StyledGroupSettingsItem
className="right-panel-item"
@ -347,6 +348,8 @@ export const OverlayRightPanelSettings = () => {
{window.i18n('groupMembers')}
</StyledGroupSettingsItem>
)}
<SpacerLG />
<SpacerLG />
{hasDisappearingMessages && (
/* TODO Move ButtonGroup around all settings items */
@ -354,6 +357,7 @@ export const OverlayRightPanelSettings = () => {
<PanelIconButton
iconType={'timer50'}
text={window.i18n('disappearingMessages')}
dataTestId="disappearing-messages"
onClick={() => {
dispatch(setRightOverlayMode('disappearing-messages'));
}}

@ -34,7 +34,7 @@ export const TimeOptions = (props: TimerOptionsProps) => {
setSelected(option.value);
}}
disabled={disabled}
dataTestId={`disappear-time-${option.value}-option`}
dataTestId={option.name.replace(' ', '-')} // we want just "1-minute", etc as accessibility id
/>
);
})}

@ -1,4 +1,5 @@
import AbortController from 'abort-controller';
import { getConversationController } from '../../../conversations';
import { OpenGroupRequestCommonType } from '../opengroupV2/ApiUtil';
import { getOpenGroupV2ConversationId } from '../utils/OpenGroupUtils';
import {
@ -7,7 +8,6 @@ import {
OpenGroupBatchRow,
sogsBatchSend,
} from './sogsV3BatchPoll';
import { getConversationController } from '../../../conversations';
type OpenGroupClearInboxResponse = {
deleted: number;
@ -21,42 +21,40 @@ export const clearInbox = async (roomInfos: OpenGroupRequestCommonType): Promise
if (!conversation) {
throw new Error(`clearInbox Matching conversation not found in db ${conversationId}`);
} else {
const options: Array<OpenGroupBatchRow> = [
{
type: 'inbox',
inbox: {
type: 'delete',
},
}
const options: Array<OpenGroupBatchRow> = [
{
type: 'inbox',
inbox: {
type: 'delete',
},
];
},
];
const result = await sogsBatchSend(
roomInfos.serverUrl,
new Set([roomInfos.roomId]),
new AbortController().signal,
options,
'batch'
);
const result = await sogsBatchSend(
roomInfos.serverUrl,
new Set([roomInfos.roomId]),
new AbortController().signal,
options,
'batch'
);
if (!result) {
throw new Error(`Could not clearInbox, res is invalid for ${conversationId}`);
}
if (!result) {
throw new Error(`Could not clearInbox, res is invalid for ${conversationId}`);
}
const rawMessage =
(result.body && (result.body[0].body as OpenGroupClearInboxResponse)) || null;
if (!rawMessage) {
throw new Error(`clearInbox parsing failed for ${conversationId}`);
}
const rawMessage = (result.body && (result.body[0].body as OpenGroupClearInboxResponse)) || null;
if (!rawMessage) {
throw new Error(`clearInbox parsing failed for ${conversationId}`);
}
try {
if (batchGlobalIsSuccess(result) && batchFirstSubIsSuccess(result)) {
success = true;
window.log.info(`clearInbox ${rawMessage.deleted} messages deleted for ${conversationId} `);
}
} catch (e) {
window?.log?.error(`clearInbox Can't decode JSON body for ${conversationId}`);
try {
if (batchGlobalIsSuccess(result) && batchFirstSubIsSuccess(result)) {
success = true;
window.log.info(`clearInbox ${rawMessage.deleted} messages deleted for ${conversationId} `);
}
} catch (e) {
window?.log?.error(`clearInbox Can't decode JSON body for ${conversationId}`);
}
if (!success) {

@ -1,15 +1,13 @@
import { v4 as uuid } from 'uuid';
import { SignalService } from '../../../../protobuf';
import { MessageParams } from '../Message';
import { ContentMessage } from '..';
import { PubKey } from '../../../types';
import { getMessageQueue } from '../../..';
import { SignalService } from '../../../../protobuf';
import { SnodeNamespaces } from '../../../apis/snode_api/namespaces';
import { getConversationController } from '../../../conversations';
import { PubKey } from '../../../types';
import { UserUtils } from '../../../utils';
import { SettingsKey } from '../../../../data/settings-key';
import { Storage } from '../../../../util/storage';
import { SnodeNamespaces } from '../../../apis/snode_api/namespaces';
import { MessageParams } from '../Message';
interface DataExtractionNotificationMessageParams extends MessageParams {
referencedAttachmentTimestamp: number;
@ -54,13 +52,7 @@ export const sendDataExtractionNotification = async (
referencedAttachmentTimestamp: number
) => {
const convo = getConversationController().get(conversationId);
if (
!convo ||
!convo.isPrivate() ||
convo.isMe() ||
UserUtils.isUsFromCache(attachmentSender) ||
!Storage.get(SettingsKey.settingsReadReceipt)
) {
if (!convo || !convo.isPrivate() || convo.isMe() || UserUtils.isUsFromCache(attachmentSender)) {
window.log.warn('Not sending saving attachment notification for', attachmentSender);
return;
}

@ -524,7 +524,11 @@ export async function USER_callRecipient(recipient: string) {
expirationMode
);
if (expirationMode === 'legacy' || expirationMode === 'deleteAfterSend') {
if (
expirationMode === 'legacy' ||
expirationMode === 'deleteAfterSend' ||
expirationMode === 'deleteAfterRead' // we are the one iniating the call, so that message is already read
) {
expirationStartTimestamp = DisappearingMessages.setExpirationStartTimestamp(
expirationMode,
now,

@ -100,7 +100,10 @@ async function checkIsUserConfigFeatureReleased() {
}
async function checkIsDisappearMessageV2FeatureReleased() {
return checkIsFeatureReleased('disappearing_messages');
return (
(await checkIsFeatureReleased('disappearing_messages')) ||
!!process.env.MULTI?.toLocaleLowerCase().includes('disappear_v2') // FIXME to remove after QA
);
}
function isUserConfigFeatureReleasedCached(): boolean {
@ -109,7 +112,10 @@ function isUserConfigFeatureReleasedCached(): boolean {
// NOTE Make sure to call checkIsDisappearMessageV2FeatureReleased at least once and then use this. It's mostly used in components that are rendered where we don't want to do async calls
function isDisappearMessageV2FeatureReleasedCached(): boolean {
return !!isDisappearingMessageFeatureReleased;
return (
!!isDisappearingMessageFeatureReleased ||
!!process.env.MULTI?.toLocaleLowerCase().includes('disappear_v2') // FIXME to remove after QA
);
}
export const ReleasedFeatures = {
@ -118,12 +124,3 @@ export const ReleasedFeatures = {
isUserConfigFeatureReleasedCached,
isDisappearMessageV2FeatureReleasedCached,
};
// TODO DO NOT MERGE Remove after QA
async function setIsFeatureReleased(featureName: FeatureNameTracked, value: boolean) {
await Storage.put(featureStorageItemId(featureName), value);
setIsFeatureReleasedCached(featureName, value);
window.log.debug(`WIP: [releaseFeature]: ${featureName} ${value}`);
}
window.setIsFeatureReleased = setIsFeatureReleased;

3
ts/window.d.ts vendored

@ -5,7 +5,6 @@ import { LocalizerType } from './types/Util';
import { ConversationCollection } from './models/conversation';
import { PrimaryColorStateType, ThemeStateType } from './themes/constants/colors';
import { FeatureNameTracked } from './util/releaseFeature';
export interface LibTextsecure {
messaging: boolean;
@ -105,8 +104,6 @@ declare global {
setAutoUpdateEnabled: (enabled: boolean) => void;
setZoomFactor: (newZoom: number) => void;
updateZoomFactor: () => void;
// TODO DO NOT MERGE Remove after QA
setIsFeatureReleased: (featureName: FeatureNameTracked, value: boolean) => Promise<void>;
Signal: any;
}

Loading…
Cancel
Save