OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Fix linting errors
Benjamin Bädorfae70e4b50c82
diff --git a/frontend/src/app/core/state/hal-resource.ts b/frontend/src/app/core/state/hal-resource.tsindex 179af058e2d..d3167870870 100644--- a/frontend/src/app/core/state/hal-resource.ts+++ b/frontend/src/app/core/state/hal-resource.ts@@ -4,7 +4,7 @@ export interface IHalResourceLink {}export interface IHalResourceLinks {- self: IHalResourceLink;+ self:IHalResourceLink;}export type FormattableFormat = 'markdown'|'custom';diff --git a/frontend/src/app/shared/components/autocompleter/create-autocompleter/create-autocompleter.component.ts b/frontend/src/app/shared/components/autocompleter/create-autocompleter/create-autocompleter.component.tsindex c22114bde6a..2ff14f26b7f 100644--- a/frontend/src/app/shared/components/autocompleter/create-autocompleter/create-autocompleter.component.ts+++ b/frontend/src/app/shared/components/autocompleter/create-autocompleter/create-autocompleter.component.ts@@ -46,7 +46,7 @@ import { AddTagFn } from '@ng-select/ng-select/lib/ng-select.component';import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destroyed.mixin';import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decorator';import { Subject } from 'rxjs';-import { PrincipalHelper } from 'core-app/shared/components/principal/principal-helper';+import { typeFromHref } from 'core-app/shared/components/principal/principal-helper';import { compareByHref } from 'core-app/shared/helpers/angular/tracking-functions';import { filter } from 'rxjs/operators';@@ -195,6 +195,6 @@ export class CreateAutocompleterComponent extends UntilDestroyedMixin implements}public isPrincipal(item:CreateAutocompleterValueOption) {- return item.href && PrincipalHelper.typeFromHref(item.href) !== null;+ return item.href && typeFromHref(item.href) !== null;}}diff --git a/frontend/src/app/shared/components/principal/principal-helper.ts b/frontend/src/app/shared/components/principal/principal-helper.tsindex 7d9724ee840..c14c703d3b3 100644--- a/frontend/src/app/shared/components/principal/principal-helper.ts+++ b/frontend/src/app/shared/components/principal/principal-helper.ts@@ -30,34 +30,32 @@ import { PrincipalLike } from 'core-app/shared/components/principal/principal-tyimport { IPrincipal } from 'core-app/core/state/principals/principal.model';import { HalSourceLink } from 'core-app/features/hal/resources/hal-resource';-export namespace PrincipalHelper {- export type PrincipalType = 'user'|'placeholder_user'|'group';- export type PrincipalPluralType = 'users'|'placeholder_users'|'groups';+export type PrincipalType = 'user'|'placeholder_user'|'group';+export type PrincipalPluralType = 'users'|'placeholder_users'|'groups';- /*- * This function is a helper that wraps around the old HalResource based principal type and the new interface based one.- *- * TODO: Remove old HalResource stuff :P- */- export function hrefFromPrincipal(p:IPrincipal|PrincipalLike):string {- if ((p as PrincipalLike).href) {- return (p as PrincipalLike).href || '';- }-- if ((p as IPrincipal)._links) {- const self = (p as IPrincipal)._links.self as HalSourceLink;- return self.href || '';- }+/*+ * This function is a helper that wraps around the old HalResource based principal type and the new interface based one.+ *+ * TODO: Remove old HalResource stuff :P+ */+export function hrefFromPrincipal(p:IPrincipal|PrincipalLike):string {+ if ((p as PrincipalLike).href) {+ return (p as PrincipalLike).href || '';+ }- return '';+ if ((p as IPrincipal)._links) {+ const self = (p as IPrincipal)._links.self as HalSourceLink;+ return self.href || '';}- export function typeFromHref(href:string):PrincipalType|null {- const match = /\/(user|group|placeholder_user)s\/\d+$/.exec(href);- if (!match) {- return null;- }+ return '';+}+export function typeFromHref(href:string):PrincipalType|null {+ const match = /\/(user|group|placeholder_user)s\/\d+$/.exec(href);- return match[1] as PrincipalType;+ if (!match) {+ return null;}++ return match[1] as PrincipalType;}diff --git a/frontend/src/app/shared/components/principal/principal-renderer.service.ts b/frontend/src/app/shared/components/principal/principal-renderer.service.tsindex 18b4af62bf5..be79bc42fc1 100644--- a/frontend/src/app/shared/components/principal/principal-renderer.service.ts+++ b/frontend/src/app/shared/components/principal/principal-renderer.service.ts@@ -5,8 +5,11 @@ import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';import idFromLink from 'core-app/features/hal/helpers/id-from-link';import { IPrincipal } from 'core-app/core/state/principals/principal.model';import { PrincipalLike } from './principal-types';-import { PrincipalHelper } from './principal-helper';-import PrincipalType = PrincipalHelper.PrincipalType;+import {+ PrincipalType,+ hrefFromPrincipal,+ typeFromHref,+} from './principal-helper';export type AvatarSize = 'default'|'medium'|'mini';@@ -65,7 +68,7 @@ export class PrincipalRendererService {avatar:AvatarOptions = { hide: false, size: 'default' },):void {container.classList.add('op-principal');- const type = PrincipalHelper.typeFromHref(PrincipalHelper.hrefFromPrincipal(principal)) as PrincipalType;+ const type = typeFromHref(hrefFromPrincipal(principal)) as PrincipalType;if (!avatar.hide) {const el = this.renderAvatar(principal, avatar, type);@@ -131,7 +134,7 @@ export class PrincipalRendererService {}private userAvatarUrl(principal:PrincipalLike|IPrincipal):string|null {- const id = principal.id || idFromLink(PrincipalHelper.hrefFromPrincipal(principal));+ const id = principal.id || idFromLink(hrefFromPrincipal(principal));return id ? this.apiV3Service.users.id(id).avatar.toString() : null;}@@ -153,7 +156,7 @@ export class PrincipalRendererService {}private principalURL(principal:PrincipalLike|IPrincipal, type:PrincipalType):string {- const href = PrincipalHelper.hrefFromPrincipal(principal);+ const href = hrefFromPrincipal(principal);const id = principal.id || (href ? idFromLink(href) : '');switch (type) {diff --git a/frontend/src/app/shared/components/principal/principal.component.ts b/frontend/src/app/shared/components/principal/principal.component.tsindex 4f152c00204..b6225e47039 100644--- a/frontend/src/app/shared/components/principal/principal.component.ts+++ b/frontend/src/app/shared/components/principal/principal.component.ts@@ -44,9 +44,7 @@ import {} from './principal-renderer.service';import { PrincipalLike } from './principal-types';import { DatasetInputs } from 'core-app/shared/components/dataset-inputs.decorator';-import { PrincipalHelper } from 'core-app/shared/components/principal/principal-helper';-import PrincipalPluralType = PrincipalHelper.PrincipalPluralType;-import PrincipalType = PrincipalHelper.PrincipalType;+import { PrincipalType } from 'core-app/shared/components/principal/principal-helper';export const principalSelector = 'op-principal';