File tree 2 files changed +26
-0
lines changed
2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change 2
2
3
3
## not released
4
4
5
+ - Fix: Don't show ` There is no Data to export ` on empty profiles and automatic backups #71
6
+
5
7
## v1.4.0 (2024-02-22)
6
8
7
9
- Changes that are required for the Joplin default plugin
Original file line number Diff line number Diff line change @@ -504,6 +504,14 @@ class Backup {
504
504
}
505
505
506
506
public async start ( showDoneMsg : boolean = false ) {
507
+ // Prevent error message for empty profile on automatic backup
508
+ // https://github.com/JackGruber/joplin-plugin-backup/issues/71
509
+ // https://github.com/laurent22/joplin/issues/10046
510
+ if ( showDoneMsg == false && ( await this . isThereData ( ) ) === false ) {
511
+ this . log . warn ( `Empty Joplin profile (No notes), skipping backup` ) ;
512
+ return ;
513
+ }
514
+
507
515
if ( this . backupStartTime === null ) {
508
516
this . backupStartTime = new Date ( ) ;
509
517
@@ -1281,6 +1289,22 @@ class Backup {
1281
1289
} ) ;
1282
1290
return true ;
1283
1291
}
1292
+
1293
+ private async isThereData ( ) : Promise < boolean > {
1294
+ let check = await joplin . data . get ( [ "notes" ] , {
1295
+ fields : "title, id, updated_time" ,
1296
+ order_by : "updated_time" ,
1297
+ order_dir : "DESC" ,
1298
+ limit : 1 ,
1299
+ page : 1 ,
1300
+ } ) ;
1301
+
1302
+ if ( check . items . length > 0 ) {
1303
+ return true ;
1304
+ } else {
1305
+ return false ;
1306
+ }
1307
+ }
1284
1308
}
1285
1309
1286
1310
export { Backup , i18n } ;
You can’t perform that action at this time.
0 commit comments