mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[ADF-2421] Unable to copy / move a file from Recent or Favorites when user has only granular permissions on the file (#3041)
* [ADF-2421] Unable to copy / move a file from Recent or Favorites when user has only granular permissions on the file * [ADF-2421] refactor code * [ADF-2421] refactor to simplify code
This commit is contained in:
committed by
Eugenio Romano
parent
499c3cd66e
commit
f8f79b3f31
@@ -959,6 +959,38 @@ describe('DocumentList', () => {
|
||||
documentList.loadFolderByNodeId('123');
|
||||
});
|
||||
|
||||
it('should reset noPermission on loading folder by node id', () => {
|
||||
documentList.noPermission = true;
|
||||
fixture.detectChanges();
|
||||
|
||||
documentList.loadFolderByNodeId('-trashcan-');
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(documentList.noPermission).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should reset noPermission upon reload', () => {
|
||||
documentList.noPermission = true;
|
||||
fixture.detectChanges();
|
||||
|
||||
documentList.reload();
|
||||
fixture.detectChanges();
|
||||
|
||||
expect(documentList.noPermission).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should reload contents if node data changes after previously got noPermission error', () => {
|
||||
spyOn(documentList.data, 'loadPage').and.callThrough();
|
||||
|
||||
documentList.noPermission = true;
|
||||
fixture.detectChanges();
|
||||
|
||||
documentList.ngOnChanges({ node: new SimpleChange(null, {list: {entities: {}}}, true) });
|
||||
|
||||
expect(documentList.data.loadPage).toHaveBeenCalled();
|
||||
expect(documentList.noPermission).toBeFalsy();
|
||||
});
|
||||
|
||||
xit('should load previous page if there are no other elements in multi page table', (done) => {
|
||||
documentList.currentFolderId = '1d26e465-dea3-42f3-b415-faa8364b9692';
|
||||
documentList.folderNode = new NodeMinimal();
|
||||
|
@@ -337,6 +337,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
} else if (this.data) {
|
||||
if (changes.node && changes.node.currentValue) {
|
||||
this.resetSelection();
|
||||
|
||||
this.data.loadPage(changes.node.currentValue);
|
||||
this.pagination.next(changes.node.currentValue.list.pagination);
|
||||
} else if (changes.rowFilter) {
|
||||
@@ -557,6 +558,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
loadFolderNodesByFolderNodeId(id: string, maxItems: number, skipCount: number, merge: boolean = false): Promise<any> {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.resetSelection();
|
||||
|
||||
this.documentListService
|
||||
.getFolder(null, {
|
||||
maxItems: maxItems,
|
||||
@@ -581,6 +583,7 @@ export class DocumentListComponent implements OnInit, OnChanges, OnDestroy, Afte
|
||||
resetSelection() {
|
||||
this.dataTable.resetSelection();
|
||||
this.selection = [];
|
||||
this.noPermission = false;
|
||||
}
|
||||
|
||||
private isSkipCountChanged(changePage: SimpleChanges) {
|
||||
|
Reference in New Issue
Block a user