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