@@ -131,6 +131,7 @@ const LOKI_SCHEMA_VERSIONS: Array<(currentVersion: number, db: Database) => void
131131 updateToSessionSchemaVersion53 ,
132132 updateToSessionSchemaVersion54 ,
133133 updateToSessionSchemaVersion55 ,
134+ updateToSessionSchemaVersion56 ,
134135 ] ;
135136
136137function updateToSessionSchemaVersion1 ( currentVersion : number , db : Database ) {
@@ -2398,30 +2399,26 @@ async function updateToSessionSchemaVersion54(currentVersion: number, db: Databa
23982399 console . log ( `updateToSessionSchemaVersion${ targetVersion } : success!` ) ;
23992400}
24002401
2401- async function updateToSessionSchemaVersion55 ( currentVersion : number , db : Database ) {
2402- const targetVersion = 55 ;
2403- if ( currentVersion >= targetVersion ) {
2404- return ;
2405- }
2402+ async function removeDonateAppealCTAReadFlag ( targetVersion : number , db : Database ) {
24062403 console . log ( `updateToSessionSchemaVersion${ targetVersion } : starting...` ) ;
24072404
24082405 db . transaction ( ( ) => {
24092406 const ctaInteractions = sqlNode . getItemById ( SettingsKey . ctaInteractions , db ) ?. value ?? [ ] ;
24102407 console . log (
2411- `updateToSessionSchemaVersion55 ${ SettingsKey . ctaInteractions } before: ${ JSON . stringify ( ctaInteractions ) } `
2408+ `updateToSessionSchemaVersion ${ targetVersion } ${ SettingsKey . ctaInteractions } before: ${ JSON . stringify ( ctaInteractions ) } `
24122409 ) ;
24132410
24142411 const idx = ctaInteractions . findIndex ( ( i : any ) => i ?. variant === CTAVariant . DONATE_APPEAL ) ;
24152412 if ( idx !== - 1 ) {
24162413 ctaInteractions . splice ( idx , 1 ) ;
24172414 console . log (
2418- `updateToSessionSchemaVersion55 removed ${ CTAVariant . DONATE_APPEAL } from ${ SettingsKey . ctaInteractions } `
2415+ `updateToSessionSchemaVersion ${ targetVersion } removed ${ CTAVariant . DONATE_APPEAL } from ${ SettingsKey . ctaInteractions } `
24192416 ) ;
24202417 sqlNode . createOrUpdateItem ( { id : SettingsKey . ctaInteractions , value : ctaInteractions } , db ) ;
24212418 }
24222419
24232420 console . log (
2424- `updateToSessionSchemaVersion55 ${ SettingsKey . ctaInteractions } after: ${ JSON . stringify ( sqlNode . getItemById ( SettingsKey . ctaInteractions , db ) ?. value ?? [ ] ) } `
2421+ `updateToSessionSchemaVersion ${ targetVersion } ${ SettingsKey . ctaInteractions } after: ${ JSON . stringify ( sqlNode . getItemById ( SettingsKey . ctaInteractions , db ) ?. value ?? [ ] ) } `
24252422 ) ;
24262423
24272424 writeSessionSchemaVersion ( targetVersion , db ) ;
@@ -2430,6 +2427,24 @@ async function updateToSessionSchemaVersion55(currentVersion: number, db: Databa
24302427 console . log ( `updateToSessionSchemaVersion${ targetVersion } : success!` ) ;
24312428}
24322429
2430+ async function updateToSessionSchemaVersion55 ( currentVersion : number , db : Database ) {
2431+ const targetVersion = 55 ;
2432+ if ( currentVersion >= targetVersion ) {
2433+ return ;
2434+ }
2435+ await removeDonateAppealCTAReadFlag ( targetVersion , db ) ;
2436+ }
2437+
2438+ // Note: updateToSessionSchemaVersion55 and updateToSessionSchemaVersion56 are the same,
2439+ // but run at different times to make the donate appeal CTA show up again.
2440+ async function updateToSessionSchemaVersion56 ( currentVersion : number , db : Database ) {
2441+ const targetVersion = 56 ;
2442+ if ( currentVersion >= targetVersion ) {
2443+ return ;
2444+ }
2445+ await removeDonateAppealCTAReadFlag ( targetVersion , db ) ;
2446+ }
2447+
24332448export function printTableColumns ( table : string , db : Database ) {
24342449 console . info ( db . pragma ( `table_info('${ table } ');` ) ) ;
24352450}
0 commit comments