From 6356cfcd84f7b3da10d86d0897cb5b8c0a88754d Mon Sep 17 00:00:00 2001 From: Eugenio Romano Date: Wed, 13 Feb 2019 16:22:31 +0000 Subject: [PATCH] fix related attached file only for task as in the process --- .../form/services/process-content.service.ts | 5 +++-- lib/core/services/content.service.ts | 2 +- .../task-attachment-list.component.spec.ts | 2 +- .../attachment/task-attachment-list.component.ts | 16 ++++++++++++++-- 4 files changed, 19 insertions(+), 6 deletions(-) diff --git a/lib/core/form/services/process-content.service.ts b/lib/core/form/services/process-content.service.ts index cbde48c632..5665fe9f76 100644 --- a/lib/core/form/services/process-content.service.ts +++ b/lib/core/form/services/process-content.service.ts @@ -118,10 +118,11 @@ export class ProcessContentService { /** * Gets related content items for a task instance. * @param taskId ID of the target task + * @param opts Options supported by JS-API * @returns Metadata for the content */ - getTaskRelatedContent(taskId: string): Observable { - return from(this.contentApi.getRelatedContentForTask(taskId)) + getTaskRelatedContent(taskId: string, opts?: any): Observable { + return from(this.contentApi.getRelatedContentForTask(taskId, opts)) .pipe(catchError((err) => this.handleError(err))); } diff --git a/lib/core/services/content.service.ts b/lib/core/services/content.service.ts index 24cafd099b..f8b89d05f2 100644 --- a/lib/core/services/content.service.ts +++ b/lib/core/services/content.service.ts @@ -193,7 +193,7 @@ export class ContentService { if (permission === PermissionsEnum.CONSUMER) { hasPermissions = true; } else if (permission === PermissionsEnum.NOT_CONSUMER) { - hasPermissions = false + hasPermissions = false; } else if (permission && permission.startsWith('!')) { hasPermissions = true; } diff --git a/lib/process-services/attachment/task-attachment-list.component.spec.ts b/lib/process-services/attachment/task-attachment-list.component.spec.ts index 479a99bbb3..ef58ca6a4e 100644 --- a/lib/process-services/attachment/task-attachment-list.component.spec.ts +++ b/lib/process-services/attachment/task-attachment-list.component.spec.ts @@ -277,7 +277,7 @@ describe('TaskAttachmentList', () => { fixture.detectChanges(); fixture.whenStable().then(() => { component.ngOnChanges({ 'taskId': change }); - expect(getTaskRelatedContentSpy).toHaveBeenCalledWith('456'); + expect(getTaskRelatedContentSpy).toHaveBeenCalledWith('456', 'true'); done(); }); }); diff --git a/lib/process-services/attachment/task-attachment-list.component.ts b/lib/process-services/attachment/task-attachment-list.component.ts index d1ae055357..3252017fde 100644 --- a/lib/process-services/attachment/task-attachment-list.component.ts +++ b/lib/process-services/attachment/task-attachment-list.component.ts @@ -16,7 +16,18 @@ */ import { ContentService, ThumbnailService, EmptyListComponent } from '@alfresco/adf-core'; -import { AfterContentInit, ContentChild, Component, EventEmitter, Input, NgZone, OnChanges, Output, SimpleChanges, ViewEncapsulation } from '@angular/core'; +import { + AfterContentInit, + ContentChild, + Component, + EventEmitter, + Input, + NgZone, + OnChanges, + Output, + SimpleChanges, + ViewEncapsulation +} from '@angular/core'; import { ProcessContentService } from '@alfresco/adf-core'; @Component({ @@ -108,7 +119,8 @@ export class TaskAttachmentListComponent implements OnChanges, AfterContentInit if (taskId) { this.isLoading = true; this.reset(); - this.activitiContentService.getTaskRelatedContent(taskId).subscribe( + const opts = 'true'; + this.activitiContentService.getTaskRelatedContent(taskId, opts).subscribe( (res: any) => { let attachList = []; res.data.forEach((content) => {