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 isNotNull

Ivan Kuchin42810093d249
diff --git a/frontend/src/app/core/state/attachments/attachments.service.ts b/frontend/src/app/core/state/attachments/attachments.service.ts
index adb4c9ac200..69936aa63f4 100644
--- a/frontend/src/app/core/state/attachments/attachments.service.ts
+++ b/frontend/src/app/core/state/attachments/attachments.service.ts
@@ -59,7 +59,6 @@ import {
import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decorator';
import isNewResource, { HAL_NEW_RESOURCE_ID } from 'core-app/features/hal/helpers/is-new-resource';
import waitForUploadsFinished from 'core-app/core/upload/wait-for-uploads-finished';
-import isNotNull from 'core-app/core/state/is-not-null';
@Injectable()
export class AttachmentsResourceService extends ResourceStoreService<IAttachment> {
@@ -164,7 +163,7 @@ export class AttachmentsResourceService extends ResourceStoreService<IAttachment
map((responses) =>
responses
.map((response) => response.body)
- .filter(isNotNull)),
+ .filter((body) => body !== null)),
);
}
diff --git a/frontend/src/app/core/state/is-not-null.ts b/frontend/src/app/core/state/is-not-null.ts
deleted file mode 100644
index 5a0615e6c6e..00000000000
--- a/frontend/src/app/core/state/is-not-null.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 isNotNull<T>(entity:T|null):entity is T {
- return entity !== null;
-}
diff --git a/frontend/src/app/shared/components/modals/wp-destroy-modal/wp-destroy.modal.ts b/frontend/src/app/shared/components/modals/wp-destroy-modal/wp-destroy.modal.ts
index 658c94d7218..90855cea16e 100644
--- a/frontend/src/app/shared/components/modals/wp-destroy-modal/wp-destroy.modal.ts
+++ b/frontend/src/app/shared/components/modals/wp-destroy-modal/wp-destroy.modal.ts
@@ -45,7 +45,6 @@ import {
WorkPackageNotificationService,
} from 'core-app/features/work-packages/services/notifications/work-package-notification.service';
import { WorkPackageService } from 'core-app/features/work-packages/services/work-package.service';
-import isNotNull from 'core-app/core/state/is-not-null';
@Component({
templateUrl: './wp-destroy.modal.html',
@@ -149,7 +148,7 @@ export class WpDestroyModalComponent extends OpModalComponent implements OnInit
this.busy = true;
const ids = this.workPackages
.map((el) => el.id)
- .filter(isNotNull);
+ .filter((id) => id !== null);
this.workPackageService.performBulkDelete(ids, true)
.then(() => {
this.busy = false;
diff --git a/frontend/src/app/shared/components/storages/storage/storage.component.ts b/frontend/src/app/shared/components/storages/storage/storage.component.ts
index 96bee30c733..48a60436d78 100644
--- a/frontend/src/app/shared/components/storages/storage/storage.component.ts
+++ b/frontend/src/app/shared/components/storages/storage/storage.component.ts
@@ -89,7 +89,6 @@ import {
UploadConflictModalComponent,
} from 'core-app/shared/components/storages/upload-conflict-modal/upload-conflict-modal.component';
import { LocationData, UploadData } from 'core-app/shared/components/storages/storage/interfaces';
-import isNotNull from 'core-app/core/state/is-not-null';
import isHttpResponse from 'core-app/core/upload/is-http-response';
import isNewResource from 'core-app/features/hal/helpers/is-new-resource';
import { StoragesResourceService } from 'core-app/core/state/storages/storages.service';
@@ -408,7 +407,7 @@ export class StorageComponent extends UntilDestroyedMixin implements OnInit, OnD
.subscribe();
}
}),
- filter(isNotNull),
+ filter((fileLinkCreationData) => fileLinkCreationData !== null),
switchMap((file) =>
combineLatest([
this.storage.pipe(first()),