markStoryRead: More logging in unusual cases

This commit is contained in:
Alvaro
2022-10-03 17:10:20 -06:00
committed by GitHub
parent b65890b07d
commit 44db76531e
8 changed files with 47 additions and 9 deletions

View File

@@ -72,6 +72,7 @@ export type StoryDataType = {
| 'sendStateByConversationId'
| 'source'
| 'sourceUuid'
| 'sourceDevice'
| 'storyDistributionListId'
| 'timestamp'
| 'type'
@@ -426,16 +427,27 @@ function markStoryRead(
!isDownloaded(matchingStory.attachment) &&
!hasFailed(matchingStory.attachment)
) {
log.warn(
`markStoryRead: not downloaded: ${messageId} ${
matchingStory.attachment?.error
? `error: ${matchingStory.attachment?.error}`
: ''
}`
);
return;
}
if (matchingStory.readStatus !== ReadStatus.Unread) {
log.warn(
`markStoryRead: not unread, ${messageId} read status: ${matchingStory.readStatus}`
);
return;
}
const message = await getMessageById(messageId);
if (!message) {
log.warn(`markStoryRead: no message found ${messageId}`);
return;
}