You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-12-02 22:49:09 +02:00
Desktop, Mobile: Fixes #9157: Clear "Some items cannot be synchronised" banner after situation is resolved
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { Dispatch } from 'redux';
|
||||
import Resource from '../../../models/Resource';
|
||||
import BaseItem from '../../../models/BaseItem';
|
||||
import Setting from '../../../models/Setting';
|
||||
import Logger from '@joplin/utils/Logger';
|
||||
|
||||
const logger = Logger.create('checkDisabledSyncItemsNotification');
|
||||
|
||||
export default async (dispatch: Dispatch) => {
|
||||
const errorCount = await Resource.downloadStatusCounts(Resource.FETCH_STATUS_ERROR);
|
||||
if (errorCount) {
|
||||
logger.info(`${errorCount} resource download errors: Triggering notification`);
|
||||
dispatch({ type: 'SYNC_HAS_DISABLED_SYNC_ITEMS' });
|
||||
return;
|
||||
}
|
||||
|
||||
const disabledCount = await BaseItem.syncDisabledItemsCount(Setting.value('sync.target'));
|
||||
if (disabledCount) {
|
||||
logger.info(`${disabledCount} disabled sync items: Triggering notification`);
|
||||
dispatch({ type: 'SYNC_HAS_DISABLED_SYNC_ITEMS' });
|
||||
return;
|
||||
}
|
||||
|
||||
logger.info('No errors: Hiding notification');
|
||||
|
||||
dispatch({
|
||||
type: 'SYNC_HAS_DISABLED_SYNC_ITEMS',
|
||||
value: false,
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user