MOBILE-2825 workshop: Delete offline files after sync

main
Albert Gasset 2019-02-04 10:57:54 +01:00
parent 0c428eb257
commit 5e098c981b
1 changed files with 12 additions and 2 deletions

View File

@ -353,7 +353,15 @@ export class AddonModWorkshopSyncProvider extends CoreSyncBaseProvider {
result.updated = true; result.updated = true;
return this.workshopOffline.deleteSubmissionAction(action.workshopid, action.submissionid, action.action, return this.workshopOffline.deleteSubmissionAction(action.workshopid, action.submissionid, action.action,
siteId); siteId).then(() => {
// Delete stored files.
if (action.action == 'add' || action.action == 'update') {
const editing = action.action == 'update';
return this.workshopHelper.deleteSubmissionStoredFiles(action.workshopid,
action.submissionid, editing, siteId);
}
});
}); });
}); });
}); });
@ -433,7 +441,9 @@ export class AddonModWorkshopSyncProvider extends CoreSyncBaseProvider {
// Delete the offline data. // Delete the offline data.
result.updated = true; result.updated = true;
return this.workshopOffline.deleteAssessment(workshop.id, assessmentId, siteId); return this.workshopOffline.deleteAssessment(workshop.id, assessmentId, siteId).then(() => {
this.workshopHelper.deleteAssessmentStoredFiles(workshop.id, assessmentId, siteId);
});
}); });
}).then(() => { }).then(() => {
if (discardError) { if (discardError) {