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

Filter dateAlerts from activity tab badge counter

Oliver Güntherf1f40c659a99
diff --git a/frontend/src/app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-notifications-count.function.ts b/frontend/src/app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-notifications-count.function.ts
index 5ca6e08c746..bdf016bd469 100644
--- a/frontend/src/app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-notifications-count.function.ts
+++ b/frontend/src/app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-notifications-count.function.ts
@@ -8,5 +8,5 @@ export function workPackageNotificationsCount(
injector:Injector,
):Observable<number> {
const storeService = injector.get(WpSingleViewService);
- return storeService.selectNotificationsCount$;
+ return storeService.nonDateAlertNotificationsCount$;
}
diff --git a/frontend/src/app/features/work-packages/routing/wp-view-base/state/wp-single-view.service.ts b/frontend/src/app/features/work-packages/routing/wp-view-base/state/wp-single-view.service.ts
index 15bc8c61cf2..70a0170552f 100644
--- a/frontend/src/app/features/work-packages/routing/wp-view-base/state/wp-single-view.service.ts
+++ b/frontend/src/app/features/work-packages/routing/wp-view-base/state/wp-single-view.service.ts
@@ -48,6 +48,13 @@ export class WpSingleViewService {
map((notifications) => notifications.length),
);
+ nonDateAlertNotificationsCount$ = this
+ .selectNotifications$
+ .pipe(
+ map((notifications) => notifications.filter((notification) => notification.reason !== 'dateAlert')),
+ map((notifications) => notifications.length),
+ );
+
hasNotifications$ = this
.selectNotificationsCount$
.pipe(
diff --git a/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rb b/spec/features/notifications/notification_center/notification_center_date_alerts_spec.rb
index 804419ce302..eabf31810fe 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
@@ -154,6 +154,7 @@ describe "Notification center date alerts", js: true, with_settings: { journal_a
let(:center) { ::Pages::Notifications::Center.new }
let(:side_menu) { ::Components::Notifications::Sidemenu.new }
let(:toaster) { PageObjects::Notifications.new(page) }
+ let(:activity_tab) { ::Components::WorkPackages::Activities.new(notification_wp_due_today) }
# Converts "hh:mm" into { hour: h, min: m }
def time_hash(time)
@@ -223,20 +224,25 @@ describe "Notification center date alerts", js: true, with_settings: { journal_a
center.expect_item(double_alert_start, 'Finish date is in 1 day')
center.expect_no_item(double_alert_due)
+ # Opening a date alert opens in overview
+ center.click_item notification_wp_start_past
+ split_screen = ::Pages::SplitWorkPackage.new wp_start_past
+ split_screen.expect_tab :overview
- # Opening a date alert opens in overview
- center.click_item notification_wp_start_past
- split_screen = ::Pages::SplitWorkPackage.new wp_start_past
- split_screen.expect_tab :overview
+ # We expect no badge count
+ activity_tab.expect_no_notification_badge
- # The same is true for the mention item that is opened in date alerts filter
- center.click_item notification_wp_double_date_alert
- split_screen = ::Pages::SplitWorkPackage.new wp_double_notification
- split_screen.expect_tab :overview
+ # The same is true for the mention item that is opened in date alerts filter
+ center.click_item notification_wp_double_date_alert
+ split_screen = ::Pages::SplitWorkPackage.new wp_double_notification
+ split_screen.expect_tab :overview
- # When a work package is updated to a different date
- wp_double_notification.update_column(:due_date, 5.days.from_now)
- page.driver.refresh
+ # We expect one badge
+ activity_tab.expect_notification_count 1
+
+ # When a work package is updated to a different date
+ wp_double_notification.update_column(:due_date, 5.days.from_now)
+ page.driver.refresh
center.expect_item(notification_wp_double_date_alert, 'Finish date is in 5 days')
center.expect_no_item(notification_wp_double_mention)
diff --git a/spec/support/components/work_packages/activities.rb b/spec/support/components/work_packages/activities.rb
index 3fe83236230..24e99c0e52c 100644
--- a/spec/support/components/work_packages/activities.rb
+++ b/spec/support/components/work_packages/activities.rb
@@ -46,6 +46,14 @@ module Components
end
end
+ def expect_notification_count(count)
+ expect(page).to have_selector('[data-qa-selector="tab-counter-Activity"] span', text: count)
+ end
+
+ def expect_no_notification_badge
+ expect(page).not_to have_selector('[data-qa-selector="tab-counter-Activity"] span')
+ end
+
def hover_action(journal_id, action)
retry_block do
# Focus type edit to expose buttons