[MNT-25584] Hide edit offline option when node is checked out (#5132)

* [MNT-25584] Hide edit offline option when node is checked out

* [MNT-25584] CR fix

* [MNT-25584] Missing docs changes
This commit is contained in:
Michal Kinas
2026-04-02 15:04:21 +02:00
committed by GitHub
parent 1b51e74730
commit 4c7f4f2c14
5 changed files with 42 additions and 4 deletions
+2 -1
View File
@@ -57,7 +57,8 @@ Application related evaluators which can be used to check various different aspe
| 5.1.1 | canToggleFileLock | Checks whether the user can lock/unlock the selected file |
| 5.1.1 | isSmartFolder | Checks if the selected folder has the 'smf:customConfigSmartFolder' or the 'smf:systemConfigSmartFolder' aspect or not |
| 5.1.1 | isMultiSelection | Checks if the user has selected multiple files |
| 6.1.0 | canPrintFile | Checks if current file can be printed or not (media files such as audio/video cannot be printed). |
| 6.1.0 | canPrintFile | Checks if current file can be printed or not (media files such as audio/video cannot be printed). |
| 7.4.0 | app.selection.isCheckedOut | Checks if selected node contains `cm:checkedOut` aspect. |
#### Navigation Rules/Evaluators
@@ -535,7 +535,8 @@
"visible": [
"app.selection.file",
"!app.navigation.isTrashcan",
"canToggleFileLock"
"canToggleFileLock",
"!app.selection.isCheckedOut"
]
}
},
@@ -873,7 +874,8 @@
"visible": [
"app.selection.file",
"!app.navigation.isTrashcan",
"canToggleFileLock"
"canToggleFileLock",
"!app.selection.isCheckedOut"
]
}
},
@@ -1297,7 +1299,8 @@
"visible": [
"app.selection.file",
"!app.navigation.isTrashcan",
"canToggleFileLock"
"canToggleFileLock",
"!app.selection.isCheckedOut"
]
}
},
@@ -153,6 +153,7 @@ import { IsFeatureSupportedInCurrentAcsPipe } from './pipes/is-feature-supported
'app.selection.folder': rules.hasFolderSelected,
'app.selection.folder.canUpdate': rules.canUpdateSelectedFolder,
'app.selection.displayedKnowledgeRetrievalButton': rules.canDisplayKnowledgeRetrievalButton,
'app.selection.isCheckedOut': rules.isCheckedOut,
'app.navigation.folder.canCreate': rules.canCreateFolder,
'app.navigation.isTrashcan': rules.isTrashcan,
@@ -1204,6 +1204,25 @@ describe('app.evaluators', () => {
});
});
describe('isCheckedOut', () => {
it('should return false when there is no selection', () => {
context.selection.isEmpty = true;
expect(app.isCheckedOut(context)).toBeFalse();
});
it('should return false when selected node does not have checked out aspect', () => {
context.selection.isEmpty = false;
context.selection.first = { entry: { aspectNames: ['test'] } } as any;
expect(app.isCheckedOut(context)).toBeFalse();
});
it('should return true when selected node contains checked out aspect', () => {
context.selection.isEmpty = false;
context.selection.first = { entry: { aspectNames: ['cm:checkedOut'] } } as any;
expect(app.isCheckedOut(context)).toBeTrue();
});
});
describe('isSSOEnabled', () => {
it('should return true if sso is enabled', () => {
context.appConfig = { get: () => 'OAUTH' } as any;
@@ -563,3 +563,17 @@ export const canDisplayKnowledgeRetrievalButton = (context: AcaRuleContext): boo
((navigation.isSearchResults(context) || navigation.isLibraryContent(context)) && !navigation.isLibraries(context)));
export const isSSOEnabled = (context: AcaRuleContext): boolean => context.appConfig.get('authType') === 'OAUTH';
/**
* Checks if node contains checked out aspect.
* JSON ref: `app.selection.isCheckedOut`
*
* @param context Rule execution context
*/
export const isCheckedOut = (context: RuleContext): boolean => {
if (!context.selection?.isEmpty) {
const nodeAspects = context.selection.first.entry?.aspectNames ?? [];
return nodeAspects.includes('cm:checkedOut');
}
return false;
};