Continue to mark story read if markOnboardingStoryAsRead didn't do it
This commit is contained in:
parent
5395741f11
commit
7db16c4f0e
2 changed files with 22 additions and 7 deletions
|
@ -396,8 +396,13 @@ function markStoryRead(
|
|||
const isSignalOnboardingStory = message.get('sourceUuid') === SIGNAL_ACI;
|
||||
|
||||
if (isSignalOnboardingStory) {
|
||||
drop(markOnboardingStoryAsRead());
|
||||
return;
|
||||
const updatedMessages = await markOnboardingStoryAsRead();
|
||||
if (updatedMessages) {
|
||||
return;
|
||||
}
|
||||
log.warn(
|
||||
'markStoryRead: Failed to mark onboarding story read normally; failing over'
|
||||
);
|
||||
}
|
||||
|
||||
const storyReadDate = Date.now();
|
||||
|
@ -421,11 +426,17 @@ function markStoryRead(
|
|||
};
|
||||
const viewSyncs: Array<SyncType> = [viewedReceipt];
|
||||
|
||||
if (!window.ConversationController.areWePrimaryDevice()) {
|
||||
if (
|
||||
!isSignalOnboardingStory &&
|
||||
!window.ConversationController.areWePrimaryDevice()
|
||||
) {
|
||||
drop(viewSyncJobQueue.add({ viewSyncs }));
|
||||
}
|
||||
|
||||
if (window.Events.getStoryViewReceiptsEnabled()) {
|
||||
if (
|
||||
!isSignalOnboardingStory &&
|
||||
window.Events.getStoryViewReceiptsEnabled()
|
||||
) {
|
||||
drop(
|
||||
conversationJobQueue.add({
|
||||
type: conversationQueueJobEnum.enum.Receipts,
|
||||
|
|
|
@ -8,14 +8,14 @@ import { DurationInSeconds } from './durations';
|
|||
import { markViewed } from '../services/MessageUpdater';
|
||||
import { storageServiceUploadJob } from '../services/storage';
|
||||
|
||||
export async function markOnboardingStoryAsRead(): Promise<void> {
|
||||
export async function markOnboardingStoryAsRead(): Promise<boolean> {
|
||||
const existingOnboardingStoryMessageIds = window.storage.get(
|
||||
'existingOnboardingStoryMessageIds'
|
||||
);
|
||||
|
||||
if (!existingOnboardingStoryMessageIds) {
|
||||
log.warn('markOnboardingStoryAsRead: no existing messages');
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
const messages = await Promise.all(
|
||||
|
@ -40,7 +40,9 @@ export async function markOnboardingStoryAsRead(): Promise<void> {
|
|||
})
|
||||
.filter(isNotNil);
|
||||
|
||||
log.info('markOnboardingStoryAsRead: marked viewed');
|
||||
log.info(
|
||||
`markOnboardingStoryAsRead: marked ${messageAttributes.length} viewed`
|
||||
);
|
||||
|
||||
await window.Signal.Data.saveMessages(messageAttributes, {
|
||||
ourUuid: window.textsecure.storage.user.getCheckedUuid().toString(),
|
||||
|
@ -49,4 +51,6 @@ export async function markOnboardingStoryAsRead(): Promise<void> {
|
|||
await window.storage.put('hasViewedOnboardingStory', true);
|
||||
|
||||
storageServiceUploadJob();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue