Adrià Vilanova MartÃnez | 3913f4d | 2024-10-26 21:16:38 +0200 | [diff] [blame] | 1 | import Script from '../../../../common/architecture/scripts/Script'; |
| 2 | import { StartupDataStoragePort } from '../../../../services/communityConsole/StartupDataStorage.port'; |
| 3 | import { OptionsProviderPort } from '../../../../services/options/OptionsProvider'; |
| 4 | |
| 5 | export 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 | } |