mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-07-31 17:38:28 +00:00
Sonarcloud issues fixes (#3499)
* Sonarcloud issues fixes * Code smell fixes * Refactoring to remove new code duplications * Sonarcloud code smell fixes part I * Sonarcloud code smell fixes part II * Missing code smell fix * Add new ESLint rules to cover fixed SonarCloud issues * Add missing command * Add missing is existing check
This commit is contained in:
@@ -52,7 +52,7 @@ export class ContextMenuItemComponent {
|
||||
}
|
||||
|
||||
private hasClickAction(actionRef: ContentActionRef): boolean {
|
||||
return !!(actionRef && actionRef.actions && actionRef.actions.click);
|
||||
return !!actionRef?.actions?.click;
|
||||
}
|
||||
|
||||
trackByActionId(_: number, obj: ContentActionRef): string {
|
||||
|
@@ -36,8 +36,6 @@ export class OutsideEventDirective implements OnInit, OnDestroy {
|
||||
@Output()
|
||||
clickOutside: EventEmitter<null> = new EventEmitter();
|
||||
|
||||
constructor() {}
|
||||
|
||||
ngOnInit() {
|
||||
this.subscriptions = this.subscriptions.concat([
|
||||
fromEvent(document.body, 'click')
|
||||
@@ -54,11 +52,9 @@ export class OutsideEventDirective implements OnInit, OnDestroy {
|
||||
private findAncestor(el: Element): boolean {
|
||||
const className = 'aca-context-menu';
|
||||
|
||||
if (el.classList.contains(className)) {
|
||||
return true;
|
||||
while (el && !el.classList.contains(className)) {
|
||||
el = el.parentElement;
|
||||
}
|
||||
// eslint-disable-next-line curly
|
||||
while ((el = el.parentElement) && !el.classList.contains(className));
|
||||
return !!el;
|
||||
}
|
||||
}
|
||||
|
@@ -68,11 +68,6 @@ export class ContextMenuService {
|
||||
}
|
||||
|
||||
private createInjector(contextmenuOverlayRef: ContextMenuOverlayRef): Injector {
|
||||
const injectionTokens = new WeakMap();
|
||||
|
||||
injectionTokens.set(ContextMenuOverlayRef, contextmenuOverlayRef);
|
||||
injectionTokens.set(CONTEXT_MENU_DIRECTION, this.direction);
|
||||
|
||||
return Injector.create({
|
||||
parent: this.injector,
|
||||
providers: [
|
||||
|
Reference in New Issue
Block a user