forked from CIT/Vmeda.Online
		
	MOBILE-3320 workshop: Fix attachments not sent in new submissions
This commit is contained in:
		
							parent
							
								
									562a30655d
								
							
						
					
					
						commit
						65f18cc670
					
				@ -37,7 +37,7 @@
 | 
			
		||||
                    elementId="content_editor" [draftExtraParams]="editorExtraParams"></core-rich-text-editor>
 | 
			
		||||
            </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"
 | 
			
		||||
                allowOffline="true" [acceptedTypes]="workshop.submissionfiletypes" [required]="fileRequired">
 | 
			
		||||
            </core-attachments>
 | 
			
		||||
 | 
			
		||||
@ -20,7 +20,6 @@ import { CoreFileUploader, CoreFileUploaderStoreFilesResult } from '@features/fi
 | 
			
		||||
import { CanLeave } from '@guards/can-leave';
 | 
			
		||||
import { CoreFile } from '@services/file';
 | 
			
		||||
import { CoreFileEntry, CoreFileHelper } from '@services/file-helper';
 | 
			
		||||
import { CoreFileSession } from '@services/file-session';
 | 
			
		||||
import { CoreNavigator } from '@services/navigator';
 | 
			
		||||
import { CoreSites } from '@services/sites';
 | 
			
		||||
import { CoreSync } from '@services/sync';
 | 
			
		||||
@ -67,6 +66,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca
 | 
			
		||||
    textRequired = false;
 | 
			
		||||
    fileAvailable = false;
 | 
			
		||||
    fileRequired = false;
 | 
			
		||||
    attachments: CoreFileEntry[] = [];
 | 
			
		||||
 | 
			
		||||
    protected workshopId!: number;
 | 
			
		||||
    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['content'].setValue(this.submission.content);
 | 
			
		||||
                this.attachments = this.submission.attachmentfiles || [];
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            CoreFileSession.setFiles(
 | 
			
		||||
                this.component,
 | 
			
		||||
                this.getFilesComponentId(),
 | 
			
		||||
                this.submission?.attachmentfiles || [],
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
            this.loaded = true;
 | 
			
		||||
        } catch (error) {
 | 
			
		||||
            this.loaded = false;
 | 
			
		||||
@ -254,7 +249,7 @@ export class AddonModWorkshopEditSubmissionPage implements OnInit, OnDestroy, Ca
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (this.fileAvailable) {
 | 
			
		||||
            values.attachmentfiles = CoreFileSession.getFiles(this.component, this.getFilesComponentId()) || [];
 | 
			
		||||
            values.attachmentfiles = this.attachments;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return values;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user