diff --git a/ts/receiver/dataMessage.ts b/ts/receiver/dataMessage.ts index 12e12419b..7651951f4 100644 --- a/ts/receiver/dataMessage.ts +++ b/ts/receiver/dataMessage.ts @@ -252,9 +252,7 @@ function isMessageEmpty(message: SignalService.DataMessage) { return ( !flags && // FIXME remove this hack to drop auto friend requests messages in a few weeks 15/07/2020 - (_.isEmpty(body) || - body === - 'Please accept to enable messages to be synced across devices') && + isBodyEmpty(body) && _.isEmpty(attachments) && _.isEmpty(group) && _.isEmpty(quote) && @@ -265,6 +263,16 @@ function isMessageEmpty(message: SignalService.DataMessage) { ); } +function isBodyEmpty(body: string) { + return _.isEmpty(body) || isBodyAutoFRContent(body); +} + +export function isBodyAutoFRContent(body: string) { + return ( + body === 'Please accept to enable messages to be synced across devices' + ); +} + export async function handleDataMessage( envelope: EnvelopePlus, dataMessage: SignalService.IDataMessage diff --git a/ts/receiver/syncMessages.ts b/ts/receiver/syncMessages.ts index d4d574bc7..61bb16c41 100644 --- a/ts/receiver/syncMessages.ts +++ b/ts/receiver/syncMessages.ts @@ -7,7 +7,11 @@ import ByteBuffer from 'bytebuffer'; import { handleEndSession } from './sessionHandling'; import { handleMediumGroupUpdate } from './mediumGroups'; -import { handleMessageEvent, processDecrypted } from './dataMessage'; +import { + handleMessageEvent, + isBodyAutoFRContent, + processDecrypted, +} from './dataMessage'; import { updateProfile } from './receiver'; import { handleContacts } from './multidevice'; import { onGroupReceived } from './groups'; @@ -84,6 +88,11 @@ async function handleSentMessage( if (!msg) { window.log('Inner message is missing in a sync message'); + return; + } + + if (msg.body && isBodyAutoFRContent(msg.body)) { + window.console.log('dropping autoFR message synced'); await removeFromCache(envelope); return; }