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

View file

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

View file

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