MOBILE-3320 workshop: Fix filesObject.online.length error
parent
65f18cc670
commit
0075a3880f
|
@ -802,14 +802,14 @@ export class AddonModDataHelperProvider {
|
|||
offline: boolean,
|
||||
siteId?: string,
|
||||
): Promise<number | CoreFileUploaderStoreFilesResult> {
|
||||
if (!files.length) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (offline) {
|
||||
return this.storeFiles(dataId, entryId, fieldId, files, siteId);
|
||||
}
|
||||
|
||||
if (!files.length) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return CoreFileUploader.uploadOrReuploadFiles(files, AddonModDataProvider.COMPONENT, itemId, siteId);
|
||||
}
|
||||
|
||||
|
|
|
@ -332,7 +332,9 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca
|
|||
// Upload attachments first if any.
|
||||
let allowOffline = !inputData.attachmentfiles.length;
|
||||
try {
|
||||
let attachmentsId: CoreFileUploaderStoreFilesResult | number | undefined;
|
||||
let attachmentsId: number | undefined;
|
||||
let storeFilesResult: CoreFileUploaderStoreFilesResult | undefined;
|
||||
|
||||
try {
|
||||
attachmentsId = await AddonModWorkshopHelper.uploadOrStoreSubmissionFiles(
|
||||
this.workshopId,
|
||||
|
@ -344,7 +346,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca
|
|||
saveOffline = true;
|
||||
allowOffline = true;
|
||||
|
||||
attachmentsId = await AddonModWorkshopHelper.uploadOrStoreSubmissionFiles(
|
||||
storeFilesResult = await AddonModWorkshopHelper.uploadOrStoreSubmissionFiles(
|
||||
this.workshopId,
|
||||
inputData.attachmentfiles,
|
||||
true,
|
||||
|
@ -364,7 +366,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca
|
|||
this.courseId,
|
||||
inputData.title,
|
||||
inputData.content,
|
||||
attachmentsId as CoreFileUploaderStoreFilesResult,
|
||||
storeFilesResult,
|
||||
submissionId,
|
||||
AddonModWorkshopAction.UPDATE,
|
||||
);
|
||||
|
@ -391,7 +393,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca
|
|||
this.courseId,
|
||||
inputData.title,
|
||||
inputData.content,
|
||||
attachmentsId as CoreFileUploaderStoreFilesResult,
|
||||
storeFilesResult,
|
||||
undefined,
|
||||
AddonModWorkshopAction.ADD,
|
||||
);
|
||||
|
|
|
@ -17,7 +17,6 @@ import { CoreError } from '@classes/errors/error';
|
|||
import { CoreSite, CoreSiteWSPreSets } from '@classes/site';
|
||||
import { CoreCourseCommonModWSOptions } from '@features/course/services/course';
|
||||
import { CoreCourseLogHelper } from '@features/course/services/log-helper';
|
||||
import { CoreFileUploaderStoreFilesResult } from '@features/fileuploader/services/fileuploader';
|
||||
import { CoreGradesMenuItem } from '@features/grades/services/grades-helper';
|
||||
import { CoreApp } from '@services/app';
|
||||
import { CoreSites, CoreSitesCommonWSOptions, CoreSitesReadingStrategy } from '@services/sites';
|
||||
|
@ -718,7 +717,7 @@ export class AddonModWorkshopProvider {
|
|||
courseId: number,
|
||||
title: string,
|
||||
content: string,
|
||||
attachmentsId?: number | CoreFileUploaderStoreFilesResult,
|
||||
attachmentsId?: number,
|
||||
siteId?: string,
|
||||
allowOffline: boolean = false,
|
||||
): Promise<number | false> {
|
||||
|
@ -731,7 +730,7 @@ export class AddonModWorkshopProvider {
|
|||
courseId,
|
||||
title,
|
||||
content,
|
||||
attachmentsId as CoreFileUploaderStoreFilesResult,
|
||||
undefined,
|
||||
undefined,
|
||||
AddonModWorkshopAction.ADD,
|
||||
siteId,
|
||||
|
@ -814,7 +813,7 @@ export class AddonModWorkshopProvider {
|
|||
courseId: number,
|
||||
title: string,
|
||||
content: string,
|
||||
attachmentsId?: CoreFileUploaderStoreFilesResult | number | undefined,
|
||||
attachmentsId?: number | undefined,
|
||||
siteId?: string,
|
||||
allowOffline: boolean = false,
|
||||
): Promise<number | false> {
|
||||
|
@ -827,7 +826,7 @@ export class AddonModWorkshopProvider {
|
|||
courseId,
|
||||
title,
|
||||
content,
|
||||
attachmentsId as CoreFileUploaderStoreFilesResult,
|
||||
undefined,
|
||||
submissionId,
|
||||
AddonModWorkshopAction.UPDATE,
|
||||
siteId,
|
||||
|
|
Loading…
Reference in New Issue