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
Elevate date alerts above mentions in inbox
Kabiru Mwenja25d0b87755f7
diff --git a/frontend/src/app/features/in-app-notifications/entry/date-alert/in-app-notification-date-alert.component.ts b/frontend/src/app/features/in-app-notifications/entry/date-alert/in-app-notification-date-alert.component.tsindex fd4ddb132b6..0386358b528 100644--- a/frontend/src/app/features/in-app-notifications/entry/date-alert/in-app-notification-date-alert.component.ts+++ b/frontend/src/app/features/in-app-notifications/entry/date-alert/in-app-notification-date-alert.component.ts@@ -107,7 +107,8 @@ export class InAppNotificationDateAlertComponent implements OnInit {private deriveMostRelevantAlert(aggregatedNotifications:INotification[]) {// Second case: We have one date alert + some othersconst dateAlerts = aggregatedNotifications.filter((notification) => notification.reason === 'dateAlert');- const first = aggregatedNotifications[0];+ const first = dateAlerts[0];+if (dateAlerts.length > 1) {const found = dateAlerts.find((notification) => notification._embedded.details[0].property === 'dueDate');return found || first;diff --git a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.ts b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.tsindex c7725a20c70..376c4986dcf 100644--- a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.ts+++ b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.ts@@ -63,20 +63,15 @@ export class InAppNotificationEntryComponent implements OnInit {const href = this.notification._links.resource?.href;this.workPackageId = href && HalResource.matchFromLink(href, 'work_packages');- this.hasReminderAlert = this.aggregatedNotifications.some((notification) => notification.reason === 'reminder');- this.showDateAlert = this.hasActiveDateAlert();+ this.hasReminderAlert = this.hasNotificationReason('reminder');+ this.showDateAlert = this.hasNotificationReason('dateAlert');this.buildTranslatedReason();this.buildProject();this.loadWorkPackage();}- private hasActiveDateAlert():boolean {- if (this.urlParams.get('filter') === 'reason' && this.urlParams.get('name') === 'date_alert') {- return true;- }-- const dateAlerts = this.aggregatedNotifications.filter((notification) => notification.reason === 'dateAlert');- return dateAlerts.length === this.aggregatedNotifications.length;+ private hasNotificationReason(reason:string):boolean {+ return this.aggregatedNotifications.some((notification) => notification.reason === reason);}private loadWorkPackage() {diff --git a/spec/features/notifications/notification_center/notification_center_date_alert_mention_spec.rb b/spec/features/notifications/notification_center/notification_center_date_alert_mention_spec.rbindex 9c8d6881150..542796ac27a 100644--- a/spec/features/notifications/notification_center/notification_center_date_alert_mention_spec.rb+++ b/spec/features/notifications/notification_center/notification_center_date_alert_mention_spec.rb@@ -39,8 +39,9 @@ RSpec.describe "Notification center date alert and mention",context "with date alerts ee", with_ee: %i[date_alerts] doit "shows only the date alert time, not the mentioned author" docenter.within_item(notification_date_alert) do- expect(page).to have_text("Date alert, Mentioned")- expect(page).to have_no_text("Actor user")+ expect(page).to have_text("##{work_package.id}\n- #{project.name} -\nDate alert, Mentioned")+ expect(page).to have_no_text("Actor User")+ expect(page).to have_text("Overdue since 1 day.")endendenddiff --git a/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rb b/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rbindex 88b514c928d..d0b324bf6d9 100644--- a/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rb+++ b/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rb@@ -221,7 +221,7 @@ RSpec.describe "Notification center date alerts", :js, :with_cuprite,center.expect_item(notification_wp_due_today, "Finish date is today.")# Doesn't show the date alert for the mention, not the alert- center.expect_item(notification_wp_double_mention, /(seconds|minutes) ago by Anonymous/)+ center.expect_item(notification_wp_double_mention, "Finish date is in 1 day.")center.expect_no_item(notification_wp_double_date_alert)# When switch to date alerts, it shows the alert, no longer the mention