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:
MichalKinas
2023-11-03 11:43:06 +01:00
committed by GitHub
parent 968febffb0
commit 69c00fc403
72 changed files with 327 additions and 530 deletions

View File

@@ -83,10 +83,10 @@ export class LocationLinkComponent implements OnInit {
ngOnInit() {
if (this.context) {
const node: NodeEntry = this.context.row.node;
if (node && node.entry && node.entry.path) {
if (node?.entry && node?.entry?.path) {
const path = node.entry.path;
if (path && path.name && path.elements) {
if (path?.name && path?.elements) {
if (this.showLocation) {
this.displayText = of(path.name.substring(1).replace(/\//g, ' › '));
} else {
@@ -144,7 +144,9 @@ export class LocationLinkComponent implements OnInit {
let result: string = null;
const elements = path.elements.map((e) => Object.assign({}, e));
const elements = path.elements.map((e) => {
return { ...e };
});
const personalFiles = this.translationService.instant('APP.BROWSE.PERSONAL.TITLE');
const fileLibraries = this.translationService.instant('APP.BROWSE.LIBRARIES.TITLE');

View File

@@ -62,7 +62,7 @@ export class ToggleSharedComponent implements OnInit, OnDestroy {
this.selectionState = selectionState;
this.isShared =
(this.selectionState.first && this.selectionState.first.entry && (this.selectionState.first.entry as any).sharedByUser) ||
(this.selectionState?.first?.entry && (this.selectionState.first.entry as any).sharedByUser) ||
!!this.selectionState?.first?.entry?.properties?.['qshare:sharedId'];
this.selectionLabel = this.isShared ? 'APP.ACTIONS.SHARE_EDIT' : 'APP.ACTIONS.SHARE';