Merge pull request #37 from Bilb/userconfig_disappearingmessage

QA fixes
pull/2971/head
Will G 2 years 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%); transform: translateX(100%);
will-change: transform; will-change: transform;
width: 25vw; 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; z-index: 5;
background-color: var(--background-primary-color); background-color: var(--background-primary-color);

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

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

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

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

@ -524,7 +524,11 @@ export async function USER_callRecipient(recipient: string) {
expirationMode 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( expirationStartTimestamp = DisappearingMessages.setExpirationStartTimestamp(
expirationMode, expirationMode,
now, now,

@ -100,7 +100,10 @@ async function checkIsUserConfigFeatureReleased() {
} }
async function checkIsDisappearMessageV2FeatureReleased() { 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 { 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 // 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 { function isDisappearMessageV2FeatureReleasedCached(): boolean {
return !!isDisappearingMessageFeatureReleased; return (
!!isDisappearingMessageFeatureReleased ||
!!process.env.MULTI?.toLocaleLowerCase().includes('disappear_v2') // FIXME to remove after QA
);
} }
export const ReleasedFeatures = { export const ReleasedFeatures = {
@ -118,12 +124,3 @@ export const ReleasedFeatures = {
isUserConfigFeatureReleasedCached, isUserConfigFeatureReleasedCached,
isDisappearMessageV2FeatureReleasedCached, 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 { ConversationCollection } from './models/conversation';
import { PrimaryColorStateType, ThemeStateType } from './themes/constants/colors'; import { PrimaryColorStateType, ThemeStateType } from './themes/constants/colors';
import { FeatureNameTracked } from './util/releaseFeature';
export interface LibTextsecure { export interface LibTextsecure {
messaging: boolean; messaging: boolean;
@ -105,8 +104,6 @@ declare global {
setAutoUpdateEnabled: (enabled: boolean) => void; setAutoUpdateEnabled: (enabled: boolean) => void;
setZoomFactor: (newZoom: number) => void; setZoomFactor: (newZoom: number) => void;
updateZoomFactor: () => void; updateZoomFactor: () => void;
// TODO DO NOT MERGE Remove after QA
setIsFeatureReleased: (featureName: FeatureNameTracked, value: boolean) => Promise<void>;
Signal: any; Signal: any;
} }

Loading…
Cancel
Save