forked from EVOgeek/Vmeda.Online
MOBILE-3320 workshop: Fix attachments not sent in new submissions
parent
562a30655d
commit
65f18cc670
|
@ -37,7 +37,7 @@
|
||||||
elementId="content_editor" [draftExtraParams]="editorExtraParams"></core-rich-text-editor>
|
elementId="content_editor" [draftExtraParams]="editorExtraParams"></core-rich-text-editor>
|
||||||
</ion-item>
|
</ion-item>
|
||||||
|
|
||||||
<core-attachments *ngIf="fileAvailable" [files]="submission?.attachmentfiles || []" [maxSize]="workshop.maxbytes"
|
<core-attachments *ngIf="fileAvailable" [files]="attachments" [maxSize]="workshop.maxbytes"
|
||||||
[maxSubmissions]="workshop.nattachments" [component]="component" [componentId]="workshop.coursemodule"
|
[maxSubmissions]="workshop.nattachments" [component]="component" [componentId]="workshop.coursemodule"
|
||||||
allowOffline="true" [acceptedTypes]="workshop.submissionfiletypes" [required]="fileRequired">
|
allowOffline="true" [acceptedTypes]="workshop.submissionfiletypes" [required]="fileRequired">
|
||||||
</core-attachments>
|
</core-attachments>
|
||||||
|
|
|
@ -20,7 +20,6 @@ import { CoreFileUploader, CoreFileUploaderStoreFilesResult } from '@features/fi
|
||||||
import { CanLeave } from '@guards/can-leave';
|
import { CanLeave } from '@guards/can-leave';
|
||||||
import { CoreFile } from '@services/file';
|
import { CoreFile } from '@services/file';
|
||||||
import { CoreFileEntry, CoreFileHelper } from '@services/file-helper';
|
import { CoreFileEntry, CoreFileHelper } from '@services/file-helper';
|
||||||
import { CoreFileSession } from '@services/file-session';
|
|
||||||
import { CoreNavigator } from '@services/navigator';
|
import { CoreNavigator } from '@services/navigator';
|
||||||
import { CoreSites } from '@services/sites';
|
import { CoreSites } from '@services/sites';
|
||||||
import { CoreSync } from '@services/sync';
|
import { CoreSync } from '@services/sync';
|
||||||
|
@ -67,6 +66,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca
|
||||||
textRequired = false;
|
textRequired = false;
|
||||||
fileAvailable = false;
|
fileAvailable = false;
|
||||||
fileRequired = false;
|
fileRequired = false;
|
||||||
|
attachments: CoreFileEntry[] = [];
|
||||||
|
|
||||||
protected workshopId!: number;
|
protected workshopId!: number;
|
||||||
protected submissionId = 0;
|
protected submissionId = 0;
|
||||||
|
@ -211,14 +211,9 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca
|
||||||
|
|
||||||
this.editForm.controls['title'].setValue(this.submission.title);
|
this.editForm.controls['title'].setValue(this.submission.title);
|
||||||
this.editForm.controls['content'].setValue(this.submission.content);
|
this.editForm.controls['content'].setValue(this.submission.content);
|
||||||
|
this.attachments = this.submission.attachmentfiles || [];
|
||||||
}
|
}
|
||||||
|
|
||||||
CoreFileSession.setFiles(
|
|
||||||
this.component,
|
|
||||||
this.getFilesComponentId(),
|
|
||||||
this.submission?.attachmentfiles || [],
|
|
||||||
);
|
|
||||||
|
|
||||||
this.loaded = true;
|
this.loaded = true;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.loaded = false;
|
this.loaded = false;
|
||||||
|
@ -254,7 +249,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.fileAvailable) {
|
if (this.fileAvailable) {
|
||||||
values.attachmentfiles = CoreFileSession.getFiles(this.component, this.getFilesComponentId()) || [];
|
values.attachmentfiles = this.attachments;
|
||||||
}
|
}
|
||||||
|
|
||||||
return values;
|
return values;
|
||||||
|
|
Loading…
Reference in New Issue