MessageReceiver: handle sender key distro message included in any proto
This commit is contained in:
parent
78a33f28c8
commit
257f5e1231
1 changed files with 47 additions and 49 deletions
|
@ -1413,59 +1413,57 @@ export default class MessageReceiver
|
||||||
envelope,
|
envelope,
|
||||||
content.senderKeyDistributionMessage
|
content.senderKeyDistributionMessage
|
||||||
);
|
);
|
||||||
} else {
|
}
|
||||||
// Note: `story = true` can be set for sender key distribution messages
|
|
||||||
|
|
||||||
const isStoryReply = Boolean(content.dataMessage?.storyContext);
|
const isStoryReply = Boolean(content.dataMessage?.storyContext);
|
||||||
const isGroupStoryReply = Boolean(
|
const isGroupStoryReply = Boolean(
|
||||||
isStoryReply && content.dataMessage?.groupV2
|
isStoryReply && content.dataMessage?.groupV2
|
||||||
|
);
|
||||||
|
const isStory = Boolean(content.storyMessage);
|
||||||
|
const isDeleteForEveryone = Boolean(content.dataMessage?.delete);
|
||||||
|
|
||||||
|
if (
|
||||||
|
envelope.story &&
|
||||||
|
!(isGroupStoryReply || isStory) &&
|
||||||
|
!isDeleteForEveryone
|
||||||
|
) {
|
||||||
|
log.warn(
|
||||||
|
`${logId}: Dropping story message - story=true on envelope, but message was not a group story send or delete`
|
||||||
);
|
);
|
||||||
const isStory = Boolean(content.storyMessage);
|
this.removeFromCache(envelope);
|
||||||
const isDeleteForEveryone = Boolean(content.dataMessage?.delete);
|
return { plaintext: undefined, envelope };
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (!envelope.story && (isGroupStoryReply || isStory)) {
|
||||||
envelope.story &&
|
log.warn(
|
||||||
!(isGroupStoryReply || isStory) &&
|
`${logId}: Malformed story - story=false on envelope, but was a group story send`
|
||||||
!isDeleteForEveryone
|
|
||||||
) {
|
|
||||||
log.warn(
|
|
||||||
`${logId}: Dropping story message - story=true on envelope, but message was not a group story send or delete`
|
|
||||||
);
|
|
||||||
this.removeFromCache(envelope);
|
|
||||||
return { plaintext: undefined, envelope };
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!envelope.story && (isGroupStoryReply || isStory)) {
|
|
||||||
log.warn(
|
|
||||||
`${logId}: Malformed story - story=false on envelope, but was a group story send`
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const areStoriesBlocked = getStoriesBlocked();
|
|
||||||
// Note that there are other story-related message types which aren't captured
|
|
||||||
// here. Look for other calls to getStoriesBlocked down-file.
|
|
||||||
if (areStoriesBlocked && (isStoryReply || isStory)) {
|
|
||||||
log.warn(
|
|
||||||
`${logId}: Dropping story message - stories are disabled or unavailable`
|
|
||||||
);
|
|
||||||
this.removeFromCache(envelope);
|
|
||||||
return { plaintext: undefined, envelope };
|
|
||||||
}
|
|
||||||
|
|
||||||
const sender = window.ConversationController.get(
|
|
||||||
envelope.sourceUuid || envelope.source
|
|
||||||
);
|
);
|
||||||
if (
|
}
|
||||||
(isStoryReply || isStory) &&
|
|
||||||
!isGroupV2 &&
|
const areStoriesBlocked = getStoriesBlocked();
|
||||||
(!sender || !sender.get('profileSharing'))
|
// Note that there are other story-related message types which aren't captured
|
||||||
) {
|
// here. Look for other calls to getStoriesBlocked down-file.
|
||||||
log.warn(
|
if (areStoriesBlocked && (isStoryReply || isStory)) {
|
||||||
`${logId}: Dropping story message - !profileSharing for sender`
|
log.warn(
|
||||||
);
|
`${logId}: Dropping story message - stories are disabled or unavailable`
|
||||||
this.removeFromCache(envelope);
|
);
|
||||||
return { plaintext: undefined, envelope };
|
this.removeFromCache(envelope);
|
||||||
}
|
return { plaintext: undefined, envelope };
|
||||||
|
}
|
||||||
|
|
||||||
|
const sender = window.ConversationController.get(
|
||||||
|
envelope.sourceUuid || envelope.source
|
||||||
|
);
|
||||||
|
if (
|
||||||
|
(isStoryReply || isStory) &&
|
||||||
|
!isGroupV2 &&
|
||||||
|
(!sender || !sender.get('profileSharing'))
|
||||||
|
) {
|
||||||
|
log.warn(
|
||||||
|
`${logId}: Dropping story message - !profileSharing for sender`
|
||||||
|
);
|
||||||
|
this.removeFromCache(envelope);
|
||||||
|
return { plaintext: undefined, envelope };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (content.pniSignatureMessage) {
|
if (content.pniSignatureMessage) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue