diff --git a/src/app/services/node-actions.service.spec.ts b/src/app/services/node-actions.service.spec.ts index ba94b0cc7..5fb1abc6e 100644 --- a/src/app/services/node-actions.service.spec.ts +++ b/src/app/services/node-actions.service.spec.ts @@ -41,7 +41,8 @@ class TestNode { isFile?: boolean, name?: string, permission?: string[], - nodeType?: string + nodeType?: string, + properties?: any ) { this.entry = {}; this.entry.id = id || 'node-id'; @@ -52,6 +53,9 @@ class TestNode { if (permission) { this.entry['allowableOperations'] = permission; } + if (properties) { + this.entry.properties = properties; + } } } @@ -305,6 +309,22 @@ describe('NodeActionsService', () => { }) ).toBe(true); }); + + it('should filter destination nodes and not show the restricted site content', () => { + const restrictedSiteContent = new TestNode( + 'blog-id', + !isFile, + 'blog', + [], + 'cm:folder', + { 'st:componentId': 'blog' } + ); + expect( + testContentNodeSelectorComponentData.data.rowFilter({ + node: restrictedSiteContent + }) + ).toBe(false); + }); }); describe('copyNodes', () => { diff --git a/src/app/services/node-actions.service.ts b/src/app/services/node-actions.service.ts index 612e0143a..d0860d2b4 100644 --- a/src/app/services/node-actions.service.ts +++ b/src/app/services/node-actions.service.ts @@ -52,6 +52,14 @@ import { catchError, map, mergeMap } from 'rxjs/operators'; export class NodeActionsService { static SNACK_MESSAGE_DURATION_WITH_UNDO = 10000; static SNACK_MESSAGE_DURATION = 3000; + static restrictedSiteContent = [ + 'blog', + 'calendar', + 'dataLists', + 'discussions', + 'links', + 'wiki' + ]; contentCopied: Subject = new Subject< MinimalNodeEntity[] @@ -289,6 +297,17 @@ export class NodeActionsService { ); } + private isRestrictedSiteContent(entry) { + if (entry && entry.properties && entry.properties['st:componentId']) { + const restrictedItem = NodeActionsService.restrictedSiteContent.find( + restrictedId => entry.properties['st:componentId'] === restrictedId + ); + return !!restrictedItem; + } + + return false; + } + close() { this.dialog.closeAll(); } @@ -636,7 +655,11 @@ export class NodeActionsService { const node: MinimalNodeEntryEntity = row.node.entry; this.isSitesDestinationAvailable = !!node['guid']; - return !node.isFile && node.nodeType !== 'app:folderlink'; + return ( + !node.isFile && + node.nodeType !== 'app:folderlink' && + !this.isRestrictedSiteContent(node) + ); } // todo: review once 1.10-beta6 is out