Include additional logging around onboarding story

This commit is contained in:
Josh Perez 2023-03-08 20:40:26 -05:00 committed by GitHub
parent 64827af27f
commit 0966118e1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 4 deletions

View file

@ -385,6 +385,7 @@ function markStoryRead(
log.warn(`markStoryRead: no message found ${messageId}`);
return;
}
const authorId = message.attributes.sourceUuid;
strictAssert(
authorId,
@ -394,16 +395,18 @@ function markStoryRead(
const isSignalOnboardingStory = message.get('sourceUuid') === SIGNAL_ACI;
if (isSignalOnboardingStory) {
void markOnboardingStoryAsRead();
drop(markOnboardingStoryAsRead());
return;
}
const storyReadDate = Date.now();
message.set(markViewed(message.attributes, storyReadDate));
void window.Signal.Data.saveMessage(message.attributes, {
ourUuid: window.textsecure.storage.user.getCheckedUuid().toString(),
});
drop(
dataInterface.saveMessage(message.attributes, {
ourUuid: window.textsecure.storage.user.getCheckedUuid().toString(),
})
);
const conversationId = message.get('conversationId');

View file

@ -111,6 +111,7 @@ async function continueDownloadingOnboardingStory(): Promise<void> {
seenStatus: SeenStatus.Unseen,
sent_at: timestamp,
serverTimestamp: timestamp,
sourceDevice: 1,
sourceUuid: signalConversation.get('uuid'),
timestamp,
type: 'story',

View file

@ -1,6 +1,7 @@
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import * as log from '../logging/log';
import { getMessageById } from '../messages/getMessageById';
import { isNotNil } from './isNotNil';
import { DurationInSeconds } from './durations';
@ -13,6 +14,7 @@ export async function markOnboardingStoryAsRead(): Promise<void> {
);
if (!existingOnboardingStoryMessageIds) {
log.warn('markOnboardingStoryAsRead: no existing messages');
return;
}
@ -38,6 +40,8 @@ export async function markOnboardingStoryAsRead(): Promise<void> {
})
.filter(isNotNil);
log.info('markOnboardingStoryAsRead: marked viewed');
await window.Signal.Data.saveMessages(messageAttributes, {
ourUuid: window.textsecure.storage.user.getCheckedUuid().toString(),
});