Skip to content

Commit

Permalink
Fix recursion loop in sendStory
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny-signal committed Sep 8, 2022
1 parent 8d7cbee commit 1e825fd
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ts/jobs/helpers/sendStory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ export async function sendStory(
isGroupV2(messageConversation.attributes) ||
Boolean(distributionList?.allowsReplies);

let inMemorySenderKeyInfo = distributionList?.senderKeyInfo;

const sendTarget = distributionList
? {
getGroupId: () => undefined,
Expand All @@ -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();

Expand Down

0 comments on commit 1e825fd

Please sign in to comment.