Fix story backups mock test & read-receipt setting restoration

Co-authored-by: trevor-signal <131492920+trevor-signal@users.noreply.github.com>
This commit is contained in:
automated-signal 2024-08-28 18:17:37 -05:00 committed by GitHub
parent 12032b839a
commit a04e0a4616
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 15 additions and 4 deletions

View file

@ -617,10 +617,14 @@ export class BackupImportStream extends Writable {
'hasStoriesDisabled',
accountSettings?.storiesDisabled === true
);
// an undefined value for storyViewReceiptsEnabled is semantically different from
// false: it causes us to fallback to `read-receipt-setting`
await storage.put(
'storyViewReceiptsEnabled',
accountSettings?.storyViewReceiptsEnabled === true
accountSettings?.storyViewReceiptsEnabled ?? undefined
);
await storage.put(
'hasCompletedUsernameOnboarding',
accountSettings?.hasCompletedUsernameOnboarding === true

View file

@ -4,6 +4,7 @@
import createDebug from 'debug';
import Long from 'long';
import { Proto, StorageState } from '@signalapp/mock-server';
import { expect } from 'playwright/test';
import { generateStoryDistributionId } from '../../types/StoryDistributionId';
import { MY_STORY_ID } from '../../types/Stories';
@ -224,6 +225,9 @@ describe('backups', function (this: Mocha.Suite) {
debug('Opening story privacy');
await window.locator('.StoriesTab__MoreActionsIcon').click();
await window.getByRole('button', { name: 'Story Privacy' }).click();
await expect(
window.locator('.StoriesSettingsModal__overlay')
).toHaveCSS('opacity', '1');
await snapshot('story privacy');
},

View file

@ -481,7 +481,10 @@ export class Bootstrap {
const window = await app.getWindow();
await callback(window, async (name: string) => {
debug('creating screenshot');
snapshots.push({ name, data: await window.screenshot() });
snapshots.push({
name,
data: await window.screenshot(),
});
});
let index = 0;
@ -512,7 +515,7 @@ export class Bootstrap {
{}
);
if (numPixels === 0) {
if (numPixels === 0 && !process.env.FORCE_ARTIFACT_SAVE) {
debug('no screenshot difference');
return;
}

View file

@ -80,7 +80,7 @@ export type StorageAccessType = {
hasSeenGroupStoryEducationSheet: boolean;
hasViewedOnboardingStory: boolean;
hasStoriesDisabled: boolean;
storyViewReceiptsEnabled: boolean;
storyViewReceiptsEnabled: boolean | undefined;
identityKeyMap: IdentityKeyMap;
lastAttemptedToRefreshProfilesAt: number;
lastResortKeyUpdateTime: number;