Expiration timer shouldn't count as unread on link
This commit is contained in:
parent
7138daf5ef
commit
83b3ae9387
2 changed files with 25 additions and 7 deletions
|
@ -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 connectCount = 0;
|
||||||
let connecting = false;
|
let connecting = false;
|
||||||
async function connect(firstRun?: boolean) {
|
async function connect(firstRun?: boolean) {
|
||||||
|
@ -1904,6 +1908,9 @@ export async function startApp(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
connecting = true;
|
connecting = true;
|
||||||
|
|
||||||
|
// Reset the flag and update it below if needed
|
||||||
|
isInitialSync = false;
|
||||||
|
|
||||||
log.info('connect', { firstRun, connectCount });
|
log.info('connect', { firstRun, connectCount });
|
||||||
|
|
||||||
if (reconnectTimer) {
|
if (reconnectTimer) {
|
||||||
|
@ -2145,6 +2152,7 @@ export async function startApp(): Promise<void> {
|
||||||
const contactSyncComplete = waitForEvent('contactSync:complete');
|
const contactSyncComplete = waitForEvent('contactSync:complete');
|
||||||
|
|
||||||
log.info('firstRun: requesting initial sync');
|
log.info('firstRun: requesting initial sync');
|
||||||
|
isInitialSync = true;
|
||||||
|
|
||||||
// Request configuration, block, GV1 sync messages, contacts
|
// Request configuration, block, GV1 sync messages, contacts
|
||||||
// (only avatars and inboxPosition),and Storage Service sync.
|
// (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
|
// Switch to inbox view even if contact sync is still running
|
||||||
if (
|
if (
|
||||||
window.reduxStore.getState().app.appView === AppViewType.Installer
|
window.reduxStore.getState().app.appView === AppViewType.Installer
|
||||||
|
@ -2641,6 +2652,7 @@ export async function startApp(): Promise<void> {
|
||||||
undefined,
|
undefined,
|
||||||
{
|
{
|
||||||
fromSync: true,
|
fromSync: true,
|
||||||
|
isInitialSync,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4460,7 +4460,15 @@ export class ConversationModel extends window.Backbone
|
||||||
providedExpireTimer: number | undefined,
|
providedExpireTimer: number | undefined,
|
||||||
providedSource?: unknown,
|
providedSource?: unknown,
|
||||||
initiatingMessage?: MessageModel,
|
initiatingMessage?: MessageModel,
|
||||||
options: { fromSync?: unknown; fromGroupUpdate?: unknown } = {}
|
{
|
||||||
|
fromSync = false,
|
||||||
|
isInitialSync = false,
|
||||||
|
fromGroupUpdate = false,
|
||||||
|
}: {
|
||||||
|
fromSync?: boolean;
|
||||||
|
isInitialSync?: boolean;
|
||||||
|
fromGroupUpdate?: boolean;
|
||||||
|
} = {}
|
||||||
): Promise<boolean | null | MessageModel | void> {
|
): Promise<boolean | null | MessageModel | void> {
|
||||||
const isSetByOther = providedSource || initiatingMessage;
|
const isSetByOther = providedSource || initiatingMessage;
|
||||||
|
|
||||||
|
@ -4490,8 +4498,6 @@ export class ConversationModel extends window.Backbone
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
window._.defaults(options, { fromSync: false, fromGroupUpdate: false });
|
|
||||||
|
|
||||||
if (!expireTimer) {
|
if (!expireTimer) {
|
||||||
expireTimer = undefined;
|
expireTimer = undefined;
|
||||||
}
|
}
|
||||||
|
@ -4548,14 +4554,14 @@ export class ConversationModel extends window.Backbone
|
||||||
expirationTimerUpdate: {
|
expirationTimerUpdate: {
|
||||||
expireTimer,
|
expireTimer,
|
||||||
source,
|
source,
|
||||||
fromSync: options.fromSync,
|
fromSync,
|
||||||
fromGroupUpdate: options.fromGroupUpdate,
|
fromGroupUpdate,
|
||||||
},
|
},
|
||||||
flags: Proto.DataMessage.Flags.EXPIRATION_TIMER_UPDATE,
|
flags: Proto.DataMessage.Flags.EXPIRATION_TIMER_UPDATE,
|
||||||
readStatus: ReadStatus.Unread,
|
readStatus: isInitialSync ? ReadStatus.Read : ReadStatus.Unread,
|
||||||
received_at_ms: receivedAtMS,
|
received_at_ms: receivedAtMS,
|
||||||
received_at: receivedAt,
|
received_at: receivedAt,
|
||||||
seenStatus: SeenStatus.Unseen,
|
seenStatus: isInitialSync ? SeenStatus.Seen : SeenStatus.Unseen,
|
||||||
sent_at: sentAt,
|
sent_at: sentAt,
|
||||||
type: 'timer-notification',
|
type: 'timer-notification',
|
||||||
// TODO: DESKTOP-722
|
// TODO: DESKTOP-722
|
||||||
|
|
Loading…
Reference in a new issue