fix related attached file only for task as in the process

This commit is contained in:
Eugenio Romano 2019-02-13 16:22:31 +00:00
parent 3d7075e4c5
commit 6356cfcd84
4 changed files with 19 additions and 6 deletions

View File

@ -118,10 +118,11 @@ export class ProcessContentService {
/** /**
* Gets related content items for a task instance. * Gets related content items for a task instance.
* @param taskId ID of the target task * @param taskId ID of the target task
* @param opts Options supported by JS-API
* @returns Metadata for the content * @returns Metadata for the content
*/ */
getTaskRelatedContent(taskId: string): Observable<any> { getTaskRelatedContent(taskId: string, opts?: any): Observable<any> {
return from(this.contentApi.getRelatedContentForTask(taskId)) return from(this.contentApi.getRelatedContentForTask(taskId, opts))
.pipe(catchError((err) => this.handleError(err))); .pipe(catchError((err) => this.handleError(err)));
} }

View File

@ -193,7 +193,7 @@ export class ContentService {
if (permission === PermissionsEnum.CONSUMER) { if (permission === PermissionsEnum.CONSUMER) {
hasPermissions = true; hasPermissions = true;
} else if (permission === PermissionsEnum.NOT_CONSUMER) { } else if (permission === PermissionsEnum.NOT_CONSUMER) {
hasPermissions = false hasPermissions = false;
} else if (permission && permission.startsWith('!')) { } else if (permission && permission.startsWith('!')) {
hasPermissions = true; hasPermissions = true;
} }

View File

@ -277,7 +277,7 @@ describe('TaskAttachmentList', () => {
fixture.detectChanges(); fixture.detectChanges();
fixture.whenStable().then(() => { fixture.whenStable().then(() => {
component.ngOnChanges({ 'taskId': change }); component.ngOnChanges({ 'taskId': change });
expect(getTaskRelatedContentSpy).toHaveBeenCalledWith('456'); expect(getTaskRelatedContentSpy).toHaveBeenCalledWith('456', 'true');
done(); done();
}); });
}); });

View File

@ -16,7 +16,18 @@
*/ */
import { ContentService, ThumbnailService, EmptyListComponent } from '@alfresco/adf-core'; 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'; import { ProcessContentService } from '@alfresco/adf-core';
@Component({ @Component({
@ -108,7 +119,8 @@ export class TaskAttachmentListComponent implements OnChanges, AfterContentInit
if (taskId) { if (taskId) {
this.isLoading = true; this.isLoading = true;
this.reset(); this.reset();
this.activitiContentService.getTaskRelatedContent(taskId).subscribe( const opts = 'true';
this.activitiContentService.getTaskRelatedContent(taskId, opts).subscribe(
(res: any) => { (res: any) => {
let attachList = []; let attachList = [];
res.data.forEach((content) => { res.data.forEach((content) => {