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 { isNotNil } from './util/isNotNil';
|
||||
import { IdleDetector } from './IdleDetector';
|
||||
import {
|
||||
getStoriesForRedux,
|
||||
loadStories,
|
||||
repairUnexpiredStories,
|
||||
} from './services/storyLoader';
|
||||
import { getStoriesForRedux, loadStories } from './services/storyLoader';
|
||||
import { senderCertificateService } from './services/senderCertificate';
|
||||
import { GROUP_CREDENTIALS_KEY } from './services/groupCredentialFetcher';
|
||||
import * as KeyboardLayout from './services/keyboardLayout';
|
||||
|
@ -720,13 +716,6 @@ export async function startApp(): Promise<void> {
|
|||
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')) {
|
||||
// Stickers flags
|
||||
await Promise.all([
|
||||
|
|
|
@ -14,6 +14,7 @@ let storyData: Array<MessageAttributesType> | undefined;
|
|||
|
||||
export async function loadStories(): Promise<void> {
|
||||
storyData = await dataInterface.getOlderStories({});
|
||||
await repairUnexpiredStories();
|
||||
}
|
||||
|
||||
export function getStoryDataFromMessageAttributes(
|
||||
|
@ -61,11 +62,7 @@ export function getStoriesForRedux(): Array<StoryDataType> {
|
|||
return stories;
|
||||
}
|
||||
|
||||
export async function repairUnexpiredStories(): Promise<void> {
|
||||
if (!storyData) {
|
||||
await loadStories();
|
||||
}
|
||||
|
||||
async function repairUnexpiredStories(): Promise<void> {
|
||||
strictAssert(storyData, 'Could not load stories');
|
||||
|
||||
const storiesWithExpiry = storyData
|
||||
|
@ -78,6 +75,10 @@ export async function repairUnexpiredStories(): Promise<void> {
|
|||
),
|
||||
}));
|
||||
|
||||
if (!storiesWithExpiry.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
log.info(
|
||||
'repairUnexpiredStories: repairing number of stories',
|
||||
storiesWithExpiry.length
|
||||
|
|
Loading…
Reference in a new issue