blob: 9195ebdc3337811a0e4f98c3558590f9978ebd74 [file] [log] [blame]
Adrià Vilanova Martínez3913f4d2024-10-26 21:16:38 +02001import Script from '../../../../common/architecture/scripts/Script';
2import { StartupDataStoragePort } from '../../../../services/communityConsole/StartupDataStorage.port';
3import { OptionsProviderPort } from '../../../../services/options/OptionsProvider';
4
5export default class LoadDraftsSetupScript extends Script {
6 page: never;
7 environment: never;
8 runPhase: never;
9
10 constructor(
11 private optionsProvider: OptionsProviderPort,
12 private startupDataStorage: StartupDataStoragePort,
13 ) {
14 super();
15 }
16
17 async execute() {
18 if (await this.optionsProvider.isEnabled('loaddrafts')) {
19 this.startupDataStorage.enqueueModification((startupDataModel) => {
20 startupDataModel.data[4][13] = true;
21 });
22 // NOTE: Workaround because otherwise the modifications would be applied too late.
23 this.startupDataStorage.applyModifications();
24 }
25 }
26}