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

Implementation/59967 remove reminder notifications from aggregation and have them as standalone (#17426)

Kabiru Mwenja3f84773748b1
diff --git a/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts b/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts
index 0979826f650..9c41f1a4658 100644
--- a/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts
+++ b/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts
@@ -111,7 +111,28 @@ export class IanCenterService extends UntilDestroyedMixin {
notifications$ = this
.aggregatedCenterNotifications$
.pipe(
- map((items) => Object.values(items)),
+ map((items) => {
+ return Object.values(items).reduce((acc, workPackageNotificationGroup) => {
+ const { reminders, others } = workPackageNotificationGroup.reduce((result, notification) => {
+ if (notification.reason === 'reminder') {
+ result.reminders.push(notification);
+ } else {
+ result.others.push(notification);
+ }
+ return result;
+ }, { reminders: [] as INotification[], others: [] as INotification[] });
+
+ // Extract reminders into standalone groups so they can be displayed individually
+ if (reminders.length > 0) {
+ reminders.forEach((reminder) => acc.push([reminder]));
+ }
+ if (others.length > 0) {
+ acc.push(others);
+ }
+
+ return acc;
+ }, [] as INotification[][]);
+ }),
distinctUntilChanged(),
);
diff --git a/spec/features/notifications/notification_center/notification_center_reminder_spec.rb b/spec/features/notifications/notification_center/notification_center_reminder_spec.rb
index 3b9f45e28ae..015aa20a36f 100644
--- a/spec/features/notifications/notification_center/notification_center_reminder_spec.rb
+++ b/spec/features/notifications/notification_center/notification_center_reminder_spec.rb
@@ -4,6 +4,7 @@ require "features/page_objects/notification"
RSpec.describe "Notification center reminder, mention and date alert",
:js,
:with_cuprite,
+ with_ee: %i[date_alerts],
with_settings: { journal_aggregation_time_minutes: 0 } do
shared_let(:project) { create(:project) }
shared_let(:actor) { create(:user, firstname: "Actor", lastname: "User") }
@@ -46,13 +47,18 @@ RSpec.describe "Notification center reminder, mention and date alert",
wait_for_reload
end
- context "with reminders", with_ee: %i[date_alerts] do
- it "shows only the reminder alert time and note" do
- center.within_item(notification_reminder) do
- expect(page).to have_text("Date alert, Mentioned, Reminder")
- expect(page).to have_no_text("Actor user")
- expect(page).to have_text("a few seconds ago.\nNote: “This is an important reminder”")
- end
+ it "shows the reminder alert in own entry" do
+ center.within_item(notification_reminder) do
+ expect(page).to have_text("##{work_package.id}\n- #{project.name} -\nReminder")
+ expect(page).to have_no_text("Actor user")
+ expect(page).to have_text("a few seconds ago.\nNote: “This is an important reminder”")
+ end
+ end
+
+ it "shows other notification reasons aggregated" do
+ center.within_item(notification_date_alert) do
+ expect(page).to have_text("##{work_package.id}\n- #{project.name} -\nDate alert, Mentioned")
+ expect(page).to have_no_text("Actor user")
end
end
end