Always repair unexpired stories
This commit is contained in:
parent
0ba6a0926e
commit
253ab7517d
2 changed files with 7 additions and 17 deletions
|
@ -38,11 +38,7 @@ import { normalizeUuid } from './util/normalizeUuid';
|
||||||
import { filter } from './util/iterables';
|
import { filter } from './util/iterables';
|
||||||
import { isNotNil } from './util/isNotNil';
|
import { isNotNil } from './util/isNotNil';
|
||||||
import { IdleDetector } from './IdleDetector';
|
import { IdleDetector } from './IdleDetector';
|
||||||
import {
|
import { getStoriesForRedux, loadStories } from './services/storyLoader';
|
||||||
getStoriesForRedux,
|
|
||||||
loadStories,
|
|
||||||
repairUnexpiredStories,
|
|
||||||
} from './services/storyLoader';
|
|
||||||
import { senderCertificateService } from './services/senderCertificate';
|
import { senderCertificateService } from './services/senderCertificate';
|
||||||
import { GROUP_CREDENTIALS_KEY } from './services/groupCredentialFetcher';
|
import { GROUP_CREDENTIALS_KEY } from './services/groupCredentialFetcher';
|
||||||
import * as KeyboardLayout from './services/keyboardLayout';
|
import * as KeyboardLayout from './services/keyboardLayout';
|
||||||
|
@ -720,13 +716,6 @@ export async function startApp(): Promise<void> {
|
||||||
window.storage.remove('remoteBuildExpiration');
|
window.storage.remove('remoteBuildExpiration');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
|
||||||
window.isBeforeVersion(lastVersion, 'v5.40.0') &&
|
|
||||||
window.isAfterVersion(lastVersion, 'v5.36.0')
|
|
||||||
) {
|
|
||||||
await repairUnexpiredStories();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (window.isBeforeVersion(lastVersion, 'v1.29.2-beta.1')) {
|
if (window.isBeforeVersion(lastVersion, 'v1.29.2-beta.1')) {
|
||||||
// Stickers flags
|
// Stickers flags
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
|
|
|
@ -14,6 +14,7 @@ let storyData: Array<MessageAttributesType> | undefined;
|
||||||
|
|
||||||
export async function loadStories(): Promise<void> {
|
export async function loadStories(): Promise<void> {
|
||||||
storyData = await dataInterface.getOlderStories({});
|
storyData = await dataInterface.getOlderStories({});
|
||||||
|
await repairUnexpiredStories();
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getStoryDataFromMessageAttributes(
|
export function getStoryDataFromMessageAttributes(
|
||||||
|
@ -61,11 +62,7 @@ export function getStoriesForRedux(): Array<StoryDataType> {
|
||||||
return stories;
|
return stories;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function repairUnexpiredStories(): Promise<void> {
|
async function repairUnexpiredStories(): Promise<void> {
|
||||||
if (!storyData) {
|
|
||||||
await loadStories();
|
|
||||||
}
|
|
||||||
|
|
||||||
strictAssert(storyData, 'Could not load stories');
|
strictAssert(storyData, 'Could not load stories');
|
||||||
|
|
||||||
const storiesWithExpiry = storyData
|
const storiesWithExpiry = storyData
|
||||||
|
@ -78,6 +75,10 @@ export async function repairUnexpiredStories(): Promise<void> {
|
||||||
),
|
),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
if (!storiesWithExpiry.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
log.info(
|
log.info(
|
||||||
'repairUnexpiredStories: repairing number of stories',
|
'repairUnexpiredStories: repairing number of stories',
|
||||||
storiesWithExpiry.length
|
storiesWithExpiry.length
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue