Skip to content

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

inline isDefinedEntity

Ivan Kuchin45d3922a5cb7
diff --git a/frontend/src/app/core/state/is-defined-entity.ts b/frontend/src/app/core/state/is-defined-entity.ts
deleted file mode 100644
index 989cb171c60..00000000000
--- a/frontend/src/app/core/state/is-defined-entity.ts
+++ /dev/null
@@ -1,31 +0,0 @@
-//-- copyright
-// OpenProject is an open source project management software.
-// Copyright (C) the OpenProject GmbH
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License version 3.
-//
-// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:
-// Copyright (C) 2006-2013 Jean-Philippe Lang
-// Copyright (C) 2010-2013 the ChiliProject Team
-//
-// This program is free software; you can redistribute it and/or
-// modify it under the terms of the GNU General Public License
-// as published by the Free Software Foundation; either version 2
-// of the License, or (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program; if not, write to the Free Software
-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-//
-// See COPYRIGHT and LICENSE files for more details.
-//++
-
-export default function isDefinedEntity<T>(entity:T|undefined):entity is T {
- return entity !== undefined;
-}
diff --git a/frontend/src/app/core/state/resource-store.service.ts b/frontend/src/app/core/state/resource-store.service.ts
index e672a0543e4..144beb68281 100644
--- a/frontend/src/app/core/state/resource-store.service.ts
+++ b/frontend/src/app/core/state/resource-store.service.ts
@@ -49,7 +49,6 @@ import {
setResourceLoading,
} from 'core-app/core/state/resource-store';
import { omit } from 'lodash';
-import isDefinedEntity from 'core-app/core/state/is-defined-entity';
import {
ApiV3ListParameters,
listParamsString,
@@ -149,7 +148,7 @@ export abstract class ResourceStoreService<T extends { id:ID }> {
return this
.collectionState(href)
.pipe(
- filter(isDefinedEntity),
+ filter(entity => entity !== undefined),
switchMap((collection:CollectionResponse) => this.query.selectMany(collection.ids)),
);
}
@@ -177,7 +176,7 @@ export abstract class ResourceStoreService<T extends { id:ID }> {
return this
.query
.selectEntity(id)
- .pipe(filter(isDefinedEntity));
+ .pipe(filter(entity => entity !== undefined));
}
/**
diff --git a/frontend/src/app/core/state/storage-files/storage-files.service.ts b/frontend/src/app/core/state/storage-files/storage-files.service.ts
index 2cf49e90e28..dd8718b7bde 100644
--- a/frontend/src/app/core/state/storage-files/storage-files.service.ts
+++ b/frontend/src/app/core/state/storage-files/storage-files.service.ts
@@ -40,7 +40,6 @@ import { IStorageFiles } from 'core-app/core/state/storage-files/storage-files.m
import { HttpClient } from '@angular/common/http';
import { ID, QueryEntity } from '@datorama/akita';
import { IStorageFile } from 'core-app/core/state/storage-files/storage-file.model';
-import isDefinedEntity from 'core-app/core/state/is-defined-entity';
import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';
@Injectable()
@@ -95,7 +94,7 @@ export class StorageFilesResourceService {
return this
.query
.selectEntity(id)
- .pipe(filter(isDefinedEntity));
+ .pipe(filter(entity => entity !== undefined));
}
private lookupMany(ids:ID[]):Observable<IStorageFile[]> {