fix: make sure we drop empty messages from the main sogs pipeline

pull/2437/head
Audric Ackermann 3 years ago
parent 218456f7fd
commit 4a3d970a35

@ -93,8 +93,7 @@ export function isMessageEmpty(message: SignalService.DataMessage) {
return (
!flags &&
// FIXME remove this hack to drop auto friend requests messages in a few weeks 15/07/2020
isBodyEmpty(body) &&
isEmpty(body) &&
isEmpty(attachments) &&
isEmpty(group) &&
isEmpty(quote) &&
@ -104,8 +103,21 @@ export function isMessageEmpty(message: SignalService.DataMessage) {
);
}
function isBodyEmpty(body: string) {
return isEmpty(body);
/**
* Incoming sogs messages without reaction must be dropped when they are empty, so we had to separate this function and `isMessageEmpty`
*/
export function isMessageEmptyNoReaction(message: SignalService.DataMessage) {
const { flags, body, attachments, group, quote, preview, openGroupInvitation } = message;
return (
!flags &&
isEmpty(body) &&
isEmpty(attachments) &&
isEmpty(group) &&
isEmpty(quote) &&
isEmpty(preview) &&
isEmpty(openGroupInvitation)
);
}
export function cleanIncomingDataMessage(

@ -12,7 +12,7 @@ import { removeMessagePadding } from '../session/crypto/BufferPadding';
import { UserUtils } from '../session/utils';
import { perfEnd, perfStart } from '../session/utils/Performance';
import { fromBase64ToArray } from '../session/utils/String';
import { cleanIncomingDataMessage, isMessageEmpty } from './dataMessage';
import { cleanIncomingDataMessage, isMessageEmptyNoReaction } from './dataMessage';
import { handleMessageJob, toRegularMessage } from './queuedJob';
export const handleOpenGroupV4Message = async (
@ -63,7 +63,7 @@ const handleOpenGroupMessage = async (
return;
}
if (isMessageEmpty(idataMessage as SignalService.DataMessage)) {
if (isMessageEmptyNoReaction(idataMessage as SignalService.DataMessage)) {
// empty message, drop it
window.log.info('received an empty message for sogs');
return;

Loading…
Cancel
Save