mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2026-09-09 18:02:54 +00:00
[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:
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user