Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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
Loading