Skip to content

Commit

Permalink
Implementation/59967 remove reminder notifications from aggregation a…
Browse files Browse the repository at this point in the history
  • Loading branch information
akabiru authored Dec 10, 2024
1 parent a8537f3 commit 3f84773
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
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") }
Expand Down Expand Up @@ -46,13 +47,18 @@
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

0 comments on commit 3f84773

Please sign in to comment.