Fix recursion loop in sendStory

This commit is contained in:
Fedor Indutny 2022-09-08 16:17:38 -07:00 committed by GitHub
parent 8d7cbeef64
commit 1e825fd1e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 4 deletions

View File

@ -278,6 +278,8 @@ export async function sendStory(
isGroupV2(messageConversation.attributes) ||
Boolean(distributionList?.allowsReplies);
let inMemorySenderKeyInfo = distributionList?.senderKeyInfo;
const sendTarget = distributionList
? {
getGroupId: () => undefined,
@ -289,12 +291,14 @@ export async function sendStory(
idForLogging: () => `dl(${receiverId})`,
isGroupV2: () => true,
isValid: () => true,
getSenderKeyInfo: () => distributionList.senderKeyInfo,
saveSenderKeyInfo: async (senderKeyInfo: SenderKeyInfoType) =>
dataInterface.modifyStoryDistribution({
getSenderKeyInfo: () => inMemorySenderKeyInfo,
saveSenderKeyInfo: async (senderKeyInfo: SenderKeyInfoType) => {
inMemorySenderKeyInfo = senderKeyInfo;
await dataInterface.modifyStoryDistribution({
...distributionList,
senderKeyInfo,
}),
});
},
}
: conversation.toSenderKeyTarget();