[ACS-9765]: cr

This commit is contained in:
Anton Ramanovich
2026-03-11 20:40:55 +01:00
parent 71c020d8be
commit 48ea5f71f2
4 changed files with 9 additions and 12 deletions
@@ -42,7 +42,7 @@ describe('CommentsTabComponent', () => {
imports: [NoopTranslateModule, CommentsTabComponent], imports: [NoopTranslateModule, CommentsTabComponent],
providers: [ providers: [
{ provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock }, { provide: AlfrescoApiService, useClass: AlfrescoApiServiceMock },
{ provide: EXTERNAL_NODE_PERMISSION_COMMENTS_TAB_SERVICE, useValue: [{ canAddComments: () => canAddComment }] }, { provide: EXTERNAL_NODE_PERMISSION_COMMENTS_TAB_SERVICE, useValue: { canAddComments: () => canAddComment }, multi: true },
{ provide: AuthenticationService, useValue: { onLogout: of({}) } } { provide: AuthenticationService, useValue: { onLogout: of({}) } }
] ]
}); });
@@ -58,12 +58,9 @@ export class CommentsTabComponent implements OnInit {
ngOnInit(): void { ngOnInit(): void {
if (!this.node) { if (!this.node) {
this.canUpdateNode = false; this.canUpdateNode = false;
} } else if (this.node.isFolder || (this.node.isFile && !isLocked({ entry: this.node }))) {
if (this.node.isFolder || (this.node.isFile && !isLocked({ entry: this.node }))) { this.canUpdateNode =
this.canUpdateNode = this.permission.check(this.node, ['update']); this.permission.check(this.node, ['update']) && this.externalPermissionNodeService.every((service) => service.canAddComments(this.node));
if (this.externalPermissionNodeService?.length) {
this.canUpdateNode &&= this.externalPermissionNodeService.every((service) => service.canAddComments(this.node));
}
} }
} }
} }
@@ -26,5 +26,9 @@ import { InjectionToken } from '@angular/core';
import { ExternalNodePermissionCommentsTabService } from '../models/external-nodes-permission-comments.interface'; import { ExternalNodePermissionCommentsTabService } from '../models/external-nodes-permission-comments.interface';
export const EXTERNAL_NODE_PERMISSION_COMMENTS_TAB_SERVICE = new InjectionToken<ExternalNodePermissionCommentsTabService[]>( export const EXTERNAL_NODE_PERMISSION_COMMENTS_TAB_SERVICE = new InjectionToken<ExternalNodePermissionCommentsTabService[]>(
'ExternalNodePermissionCommentsTabService' 'ExternalNodePermissionCommentsTabService',
{
providedIn: 'root',
factory: () => []
}
); );
@@ -149,9 +149,5 @@ describe('NodeUtils', () => {
it('should return [false] for node type not starting with rma:', () => { it('should return [false] for node type not starting with rma:', () => {
expect(isRmaContent(prepareNode('cm:content'))).toBeFalse(); expect(isRmaContent(prepareNode('cm:content'))).toBeFalse();
}); });
it('should return false when nodeType is missing', () => {
expect(isRmaContent({} as any)).toBeFalse();
});
}); });
}); });