Expiration timer shouldn't count as unread on link

This commit is contained in:
Fedor Indutny 2022-05-25 13:48:23 -07:00 committed by GitHub
parent 7138daf5ef
commit 83b3ae9387
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 7 deletions

View File

@ -1891,6 +1891,10 @@ export async function startApp(): Promise<void> {
}
}
// When true - we are running the very first storage and contact sync after
// linking.
let isInitialSync = false;
let connectCount = 0;
let connecting = false;
async function connect(firstRun?: boolean) {
@ -1904,6 +1908,9 @@ export async function startApp(): Promise<void> {
try {
connecting = true;
// Reset the flag and update it below if needed
isInitialSync = false;
log.info('connect', { firstRun, connectCount });
if (reconnectTimer) {
@ -2145,6 +2152,7 @@ export async function startApp(): Promise<void> {
const contactSyncComplete = waitForEvent('contactSync:complete');
log.info('firstRun: requesting initial sync');
isInitialSync = true;
// Request configuration, block, GV1 sync messages, contacts
// (only avatars and inboxPosition),and Storage Service sync.
@ -2176,6 +2184,9 @@ export async function startApp(): Promise<void> {
);
}
log.info('firstRun: initial sync complete');
isInitialSync = false;
// Switch to inbox view even if contact sync is still running
if (
window.reduxStore.getState().app.appView === AppViewType.Installer
@ -2641,6 +2652,7 @@ export async function startApp(): Promise<void> {
undefined,
{
fromSync: true,
isInitialSync,
}
);
}

View File

@ -4460,7 +4460,15 @@ export class ConversationModel extends window.Backbone
providedExpireTimer: number | undefined,
providedSource?: unknown,
initiatingMessage?: MessageModel,
options: { fromSync?: unknown; fromGroupUpdate?: unknown } = {}
{
fromSync = false,
isInitialSync = false,
fromGroupUpdate = false,
}: {
fromSync?: boolean;
isInitialSync?: boolean;
fromGroupUpdate?: boolean;
} = {}
): Promise<boolean | null | MessageModel | void> {
const isSetByOther = providedSource || initiatingMessage;
@ -4490,8 +4498,6 @@ export class ConversationModel extends window.Backbone
return false;
}
window._.defaults(options, { fromSync: false, fromGroupUpdate: false });
if (!expireTimer) {
expireTimer = undefined;
}
@ -4548,14 +4554,14 @@ export class ConversationModel extends window.Backbone
expirationTimerUpdate: {
expireTimer,
source,
fromSync: options.fromSync,
fromGroupUpdate: options.fromGroupUpdate,
fromSync,
fromGroupUpdate,
},
flags: Proto.DataMessage.Flags.EXPIRATION_TIMER_UPDATE,
readStatus: ReadStatus.Unread,
readStatus: isInitialSync ? ReadStatus.Read : ReadStatus.Unread,
received_at_ms: receivedAtMS,
received_at: receivedAt,
seenStatus: SeenStatus.Unseen,
seenStatus: isInitialSync ? SeenStatus.Seen : SeenStatus.Unseen,
sent_at: sentAt,
type: 'timer-notification',
// TODO: DESKTOP-722