@@ -95,10 +95,9 @@ import { AddonBlogOfflineEntryDBRecord } from './database/blog';
9595 * @returns Syncronization result.
9696 */
9797 async performEntriesSync ( siteId : string ) : Promise < AddonBlogSyncResult > {
98- const result : AddonBlogSyncResult = { updated : false , warnings : [ ] } ;
99- const entriesToSync = await this . syncEntriesToRemove ( siteId ) ;
98+ const { entries, result } = await this . syncEntriesToRemove ( siteId ) ;
10099
101- for ( const entry of entriesToSync . entries ) {
100+ for ( const entry of entries ) {
102101 if ( CoreSync . isBlocked ( AddonBlogProvider . COMPONENT , entry . id ?? entry . created , siteId ) ) {
103102 this . logger . debug ( 'Cannot sync entry ' + entry . created + ' because it is blocked.' ) ;
104103
@@ -206,7 +205,7 @@ import { AddonBlogOfflineEntryDBRecord } from './database/blog';
206205 * Sync entries to remove.
207206 *
208207 * @param siteId Site ID.
209- * @returns Entries to remove and result.
208+ * @returns Entries to sync avoiding removed entries and the result of the entries to remove syncronization .
210209 */
211210 protected async syncEntriesToRemove ( siteId ?: string ) : Promise < AddonBlogSyncGetPendingToSyncEntries > {
212211 let entriesToSync = await AddonBlogOffline . getOfflineEntries ( undefined , siteId ) ;
@@ -216,10 +215,11 @@ import { AddonBlogOfflineEntryDBRecord } from './database/blog';
216215 await Promise . all ( entriesToBeRemoved . map ( async ( entry ) => {
217216 try {
218217 await AddonBlog . deleteEntryOnline ( { entryid : entry . id } , siteId ) ;
218+ await AddonBlogOffline . deleteOfflineEntryRecord ( { id : entry . id } , siteId ) ;
219+ await AddonBlogOffline . unmarkEntryAsRemoved ( entry . id , siteId ) ;
219220 const entriesPendingToSync = entriesToSync . filter ( entryToSync => entryToSync . id !== entry . id ) ;
220221
221222 if ( entriesPendingToSync . length !== entriesToSync . length ) {
222- await AddonBlogOffline . deleteOfflineEntryRecord ( { id : entry . id } , siteId ) ;
223223 entriesToSync = entriesPendingToSync ;
224224 }
225225 } catch ( error ) {
0 commit comments