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
Instead of making an extra API call, use the result of the "reasons"-API call and summarise the counts
Henriette Darge9dea3824e024
diff --git a/frontend/src/app/features/in-app-notifications/center/menu/menu.component.ts b/frontend/src/app/features/in-app-notifications/center/menu/menu.component.tsindex 671465d34c6..d3f09331a31 100644--- a/frontend/src/app/features/in-app-notifications/center/menu/menu.component.ts+++ b/frontend/src/app/features/in-app-notifications/center/menu/menu.component.ts@@ -58,13 +58,6 @@ export class IanMenuComponent implements OnInit {},];- baseMenuItemNotifications$ = this.ianMenuService.query.baseMenuItemNotifications$.pipe(- map((items) => this.baseMenuItems.map((baseItem) => ({- ...items.find((item) => item.value === baseItem.key),- ...baseItem,- }))),- );-notificationsByProject$ = this.ianMenuService.query.notificationsByProject$.pipe(map((items) => items.map((item) => ({@@ -89,12 +82,14 @@ export class IanMenuComponent implements OnInit {);menuItems$ = combineLatest([- this.baseMenuItemNotifications$,this.notificationsByProject$,this.notificationsByReason$,]).pipe(- map(([baseMenu, byProject, byReason]) => [- ...baseMenu,+ map(([byProject, byReason]) => [+ ...this.baseMenuItems.map((baseMenuItem) => ({+ ...baseMenuItem,+ count: byReason.reduce((a, b) => a + (b.count || 0), 0),+ })),{title: this.I18n.t('js.notifications.menu.by_reason'),collapsible: true,diff --git a/frontend/src/app/features/in-app-notifications/center/menu/state/ian-menu.query.ts b/frontend/src/app/features/in-app-notifications/center/menu/state/ian-menu.query.tsindex 413bc8b87d6..c32f60f1f88 100644--- a/frontend/src/app/features/in-app-notifications/center/menu/state/ian-menu.query.ts+++ b/frontend/src/app/features/in-app-notifications/center/menu/state/ian-menu.query.ts@@ -44,8 +44,6 @@ export class IanMenuQuery extends Query<IanMenuState> {notificationsByReason$ = this.select('notificationsByReason');- baseMenuItemNotifications$ = this.select('baseMenuItemNotifications');-constructor(protected store:IanMenuStore,protected resourceService:InAppNotificationsResourceService,diff --git a/frontend/src/app/features/in-app-notifications/center/menu/state/ian-menu.service.ts b/frontend/src/app/features/in-app-notifications/center/menu/state/ian-menu.service.tsindex 00256b1ff4d..30c500178ee 100644--- a/frontend/src/app/features/in-app-notifications/center/menu/state/ian-menu.service.ts+++ b/frontend/src/app/features/in-app-notifications/center/menu/state/ian-menu.service.ts@@ -18,7 +18,6 @@ import {IanMenuStore,IAN_MENU_PROJECT_FILTERS,IAN_MENU_REASON_FILTERS,- IAN_MENU_INBOX_FILTER,} from './ian-menu.store';@Injectable()@@ -68,9 +67,5 @@ export class IanMenuService {this.ianResourceService.fetchNotifications(IAN_MENU_REASON_FILTERS)// eslint-disable-next-line @typescript-eslint/no-unsafe-return.subscribe((data) => this.store.update({ notificationsByReason: data.groups }));-- this.ianResourceService.fetchNotifications(IAN_MENU_INBOX_FILTER)- // eslint-disable-next-line @typescript-eslint/no-unsafe-return- .subscribe((data) => this.store.update({ baseMenuItemNotifications: [{ value: 'inbox', count: data.total }] }));}}diff --git a/frontend/src/app/features/in-app-notifications/center/menu/state/ian-menu.store.ts b/frontend/src/app/features/in-app-notifications/center/menu/state/ian-menu.store.tsindex b49cd9d68e0..30bc2e79541 100644--- a/frontend/src/app/features/in-app-notifications/center/menu/state/ian-menu.store.ts+++ b/frontend/src/app/features/in-app-notifications/center/menu/state/ian-menu.store.ts@@ -18,7 +18,6 @@ export interface BaseMenuItemData {}export interface IanMenuState {- baseMenuItemNotifications:BaseMenuItemData[]notificationsByProject:IanMenuGroupingData[],notificationsByReason:IanMenuGroupingData[],projectsFilter:Apiv3ListParameters,@@ -36,14 +35,8 @@ export const IAN_MENU_REASON_FILTERS:Apiv3ListParameters = {filters: [['read_ian', '=', false]],};-export const IAN_MENU_INBOX_FILTER:Apiv3ListParameters = {- pageSize: 0,- filters: [['read_ian', '=', false]],-};-export function createInitialState():IanMenuState {return {- baseMenuItemNotifications: [],notificationsByProject: [],notificationsByReason: [],projectsFilter: {},