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
Prevent error toasts from showing when HTTP status is 0
Oliver Günther0e6f78e2c11e
diff --git a/frontend/src/app/shared/components/copy-to-clipboard/copy-to-clipboard.service.ts b/frontend/src/app/shared/components/copy-to-clipboard/copy-to-clipboard.service.tsindex e0bb8401f94..7580298d0c3 100644--- a/frontend/src/app/shared/components/copy-to-clipboard/copy-to-clipboard.service.ts+++ b/frontend/src/app/shared/components/copy-to-clipboard/copy-to-clipboard.service.ts@@ -60,6 +60,8 @@ export class CopyToClipboardService {const notification = this.toastService[type](message);// Remove the notification some time later- setTimeout(() => this.toastService.remove(notification), 5000);+ if (notification) {+ setTimeout(() => this.toastService.remove(notification), 5000);+ }}}diff --git a/frontend/src/app/shared/components/toaster/toast.service.ts b/frontend/src/app/shared/components/toaster/toast.service.tsindex 2118390d319..26e50bfa5f5 100644--- a/frontend/src/app/shared/components/toaster/toast.service.ts+++ b/frontend/src/app/shared/components/toaster/toast.service.ts@@ -35,11 +35,7 @@ import { HttpErrorResponse, HttpEvent } from '@angular/common/http';import { I18nService } from 'core-app/core/i18n/i18n.service';import { ConfigurationService } from 'core-app/core/config/configuration.service';import waitForUploadsFinished from 'core-app/core/upload/wait-for-uploads-finished';-import {- IHalErrorBase,- IHalMultipleError,- isHalError,-} from 'core-app/features/hal/resources/error-resource';+import { IHalErrorBase, IHalMultipleError, isHalError } from 'core-app/features/hal/resources/error-resource';export function removeSuccessFlashMessages():void {jQuery('.op-toast.-success').remove();@@ -99,7 +95,7 @@ export class ToastService {return ['success', 'error', 'loading'].includes(toast.type);}- public addError(obj:HttpErrorResponse|IToast|string, additionalErrors:unknown[]|string = []):IToast {+ public addError(obj:HttpErrorResponse|IToast|string, additionalErrors:unknown[]|string = []):IToast|null {let message:IToast|string;let errors:string[];@@ -110,6 +106,11 @@ export class ToastService {}if (obj instanceof HttpErrorResponse) {+ if (obj.status === 0) {+ console.error('Request cancelled or failed otherwise: %O', obj);+ return null;+ }+message = isHalError(obj.error) ? obj.error.message : obj.message;if ((obj.error as IHalMultipleError)?._embedded?.errors) {