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
First draft of rails-based submenu for notifications center
Henriette Darge2a9aa9593fdc
diff --git a/app/components/open_project/common/submenu_component.html.erb b/app/components/open_project/common/submenu_component.html.erbindex a76df1ea59f..9517b3776f8 100644--- a/app/components/open_project/common/submenu_component.html.erb+++ b/app/components/open_project/common/submenu_component.html.erb@@ -32,7 +32,13 @@<li class="op-sidemenu--item" data-filter--filter-list-target="searchItem"><% selected = menu_item.selected ? 'selected' : '' %><a class="op-sidemenu--item-action <%= selected %>" href="<%= menu_item.href %>" data-test-selector="op-sidemenu--item-action">+ <% if menu_item.icon %>+ <span class="op-sidemenu--item-icon icon-<%= menu_item.icon %>"></span>+ <% end %><span class="op-sidemenu--item-title"><%= menu_item.title %></span>+ <% if menu_item.count %>+ <span class="op-bubble op-bubble_alt_highlighting"><%= menu_item.count %></span>+ <% end %></a></li><% end %>@@ -61,10 +67,17 @@<li class="op-sidemenu--item" data-filter--filter-list-target="searchItem"><% selected = child_item.selected ? 'selected' : '' %><a class="op-sidemenu--item-action <%= selected %>" href="<%= child_item.href %>" data-test-selector="op-sidemenu--item-action">+ <% if child_item.icon %>+ <span class="op-sidemenu--item-icon icon-<%= child_item.icon %>"></span>+ <% end %><span class="op-sidemenu--item-title"><%= child_item.title %></span><% if child_item.favored %><%= render Primer::Beta::Octicon.new(icon: "star-fill", "aria-label": I18n.t(:label_favorite), classes: %w[op-sidemenu--item-mark op-primer--star-icon]) %><% end %>++ <% if child_item.count %>+ <span class="op-bubble op-bubble_alt_highlighting"><%= child_item.count %></span>+ <% end %></a></li><% end %>diff --git a/app/controllers/notifications/menus_controller.rb b/app/controllers/notifications/menus_controller.rbnew file mode 100644index 00000000000..2d064408901--- /dev/null+++ b/app/controllers/notifications/menus_controller.rb@@ -0,0 +1,42 @@+# -- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2010-2023 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+# +++module Notifications+ class MenusController < ApplicationController+ # No authorize as every user (or logged in user)+ # is allowed to see the menu.+ no_authorization_required! :show++ def show+ menu = Menus::Notifications.new(controller_path: params[:controller_path], params:, current_user:)++ @sidebar_menu_items = menu.first_level_menu_items++ render layout: nil+ end+ end+enddiff --git a/app/helpers/menus/notifications.rb b/app/helpers/menus/notifications.rbnew file mode 100644index 00000000000..64a3618cac9--- /dev/null+++ b/app/helpers/menus/notifications.rb@@ -0,0 +1,116 @@+#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) 2012-2024 the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++module Menus+ class Notifications+ ENTERPRISE_REASONS = %w[shared date_alert].freeze++ include Rails.application.routes.url_helpers++ attr_reader :controller_path, :params, :current_user,+ :query, :unread_by_reason, :unread_by_project++ def initialize(controller_path:, params:, current_user:)+ # rubocop:disable Rails/HelperInstanceVariable+ @controller_path = controller_path+ @params = params+ @current_user = current_user+ @unread_by_reason = filter_unread_by_reason+ @unread_by_project = filter_unread_by_project+ # rubocop:enable Rails/HelperInstanceVariable+ end++ def first_level_menu_items+ [+ OpenProject::Menu::MenuGroup.new(header: nil,+ children: [inbox_menu]),+ OpenProject::Menu::MenuGroup.new(header: I18n.t("notifications.menu.by_reason"),+ children: reason_filters),+ OpenProject::Menu::MenuGroup.new(header: I18n.t("notifications.menu.by_project"),+ children: project_filters)+ ]+ end++ private++ def filter_unread_by_reason+ query = Queries::Notifications::NotificationQuery.new(user: current_user)+ query.where(:read_ian, "=", "f")+ query.group(:reason)+ query.group_values+ end++ def filter_unread_by_project+ query = Queries::Notifications::NotificationQuery.new(user: current_user)+ query.where(:read_ian, "=", "f")+ query.group(:project)+ query.group_values+ end++ def inbox_menu+ OpenProject::Menu::MenuItem.new(title: I18n.t("notifications.menu.inbox"),+ icon: :inbox,+ href: notifications_path,+ selected: !(params[:name] && params[:filter]))+ end++ def selected?(filter, name)+ params[:filter] == filter && params[:name] == name+ end++ def reason_filters+ %w[mentioned assigned responsible watched date_alert shared].map do |reason|+ count = unread_by_reason[reason]+ OpenProject::Menu::MenuItem.new(title: I18n.t("mail.work_packages.reason.#{reason}"),+ icon: icon_map.fetch(reason, reason),+ href: notifications_path(filter: "reason", name: reason),+ count: count == 0 ? nil : count,+ selected: selected?("reason", reason))+ end+ end++ def project_filters+ unread_by_project.map do |project, count|+ OpenProject::Menu::MenuItem.new(title: project.name,+ href: notifications_path(filter: "project", name: project.id),+ count: count,+ selected: selected?("project", project.id))+ end+ end++ def icon_map+ {+ "mentioned" => :mention,+ "responsible" => :accountable,+ "watched" => :watching,+ "shared" => :share,+ "date_alert" => :"date-alert"+ }+ end+ end+enddiff --git a/app/views/notifications/_menu_notification_center.html.erb b/app/views/notifications/_menu_notification_center.html.erbdeleted file mode 100644index 41fa535b06b..00000000000--- a/app/views/notifications/_menu_notification_center.html.erb+++ /dev/null@@ -1 +0,0 @@-<op-ian-menu></op-ian-menu>diff --git a/app/views/notifications/menus/_menu.html.erb b/app/views/notifications/menus/_menu.html.erbnew file mode 100644index 00000000000..25a13c75e09--- /dev/null+++ b/app/views/notifications/menus/_menu.html.erb@@ -0,0 +1,8 @@+<%= turbo_frame_tag "notifications_sidemenu",+ src: notifications_menu_path(+ controller_path:,+ **params.permit(:filter, :name)+ ),+ target: '_top',+ data: { turbo: false },+ loading: :lazy %>diff --git a/app/views/notifications/menus/show.html.erb b/app/views/notifications/menus/show.html.erbnew file mode 100644index 00000000000..b3dacd093ed--- /dev/null+++ b/app/views/notifications/menus/show.html.erb@@ -0,0 +1,3 @@+<%= turbo_frame_tag "notifications_sidemenu" do %>+ <%= render OpenProject::Common::SubmenuComponent.new(sidebar_menu_items: @sidebar_menu_items) %>+<% end %>diff --git a/config/initializers/menus.rb b/config/initializers/menus.rbindex 66fb0644075..b3d128a4e06 100644--- a/config/initializers/menus.rb+++ b/config/initializers/menus.rb@@ -185,7 +185,7 @@ endRedmine::MenuManager.map :notifications_menu do |menu|menu.push :notification_grouping_select,{ controller: "/my", action: "notifications" },- partial: "notifications/menu_notification_center"+ partial: "notifications/menus/menu"endRedmine::MenuManager.map :my_menu do |menu|diff --git a/config/locales/en.yml b/config/locales/en.ymlindex 9607c686136..847ce253bfb 100644--- a/config/locales/en.yml+++ b/config/locales/en.yml@@ -1903,6 +1903,10 @@ en:unknown_storage: "Unknown storage"notifications:+ menu:+ by_project: "Unread by project"+ by_reason: "Reason"+ inbox: "Inbox"send_notifications: "Send notifications for this action"work_packages:subject:@@ -2589,6 +2593,7 @@ en:shared: "Shared"subscribed: "all"prefix: "Received because of the notification setting: %{reason}"+ date_alert: "Date alert"date_alert_start_date: "Date alert"date_alert_due_date: "Date alert"see_all: "See all"diff --git a/config/locales/js-en.yml b/config/locales/js-en.ymlindex 64fc797b90c..ed8d1088640 100644--- a/config/locales/js-en.yml+++ b/config/locales/js-en.yml@@ -721,15 +721,6 @@ en:new_notifications:message: "There are new notifications."link_text: "Click here to load them."- menu:- accountable: "Accountable"- by_project: "Unread by project"- by_reason: "Reason"- inbox: "Inbox"- mentioned: "Mentioned"- watched: "Watcher"- date_alert: "Date alert"- shared: "Shared"settings:change_notification_settings: 'You can modify your <a target="_blank" href="%{url}">notification settings</a> to ensure you never miss an important update.'title: "Notification settings"diff --git a/config/routes.rb b/config/routes.rbindex 4813e953708..63bf00232ca 100644--- a/config/routes.rb+++ b/config/routes.rb@@ -703,6 +703,12 @@ Rails.application.routes.draw doget "(/*state)", to: "angular#notifications_layout", as: :notifications_centerend+ resources :notifications, only: :index do+ collection do+ resource :menu, module: :notifications, only: %i[show], as: :notifications_menu+ end+ end+# OAuthClient needs a "callback" URL that Nextcloud calls with a "code" (see OAuth2 RFC)scope "oauth_clients/:oauth_client_id" doget "callback", controller: "oauth_clients", action: :callbackdiff --git a/frontend/src/app/core/setup/global-dynamic-components.const.ts b/frontend/src/app/core/setup/global-dynamic-components.const.tsindex eeaa5c73953..502bb1529ba 100644--- a/frontend/src/app/core/setup/global-dynamic-components.const.ts+++ b/frontend/src/app/core/setup/global-dynamic-components.const.ts@@ -133,7 +133,6 @@ import {InAppNotificationBellComponent,opInAppNotificationBellSelector,} from 'core-app/features/in-app-notifications/bell/in-app-notification-bell.component';-import { IanMenuComponent, ianMenuSelector } from 'core-app/features/in-app-notifications/center/menu/menu.component';import {OpModalOverlayComponent,opModalOverlaySelector,@@ -201,7 +200,6 @@ export const globalDynamicComponents:OptionalBootstrapDefinition[] = [{ selector: editableQueryPropsSelector, cls: EditableQueryPropsComponent },{ selector: backupSelector, cls: BackupComponent },{ selector: opInAppNotificationBellSelector, cls: InAppNotificationBellComponent },- { selector: ianMenuSelector, cls: IanMenuComponent },{ selector: opModalOverlaySelector, cls: OpModalOverlayComponent },{ selector: spotDropModalPortalComponentSelector, cls: SpotDropModalPortalComponent },diff --git a/frontend/src/app/features/in-app-notifications/center/menu/menu.component.html b/frontend/src/app/features/in-app-notifications/center/menu/menu.component.htmldeleted file mode 100644index c2b22df3291..00000000000--- a/frontend/src/app/features/in-app-notifications/center/menu/menu.component.html+++ /dev/null@@ -1,4 +0,0 @@-<op-sidemenu- [items]="menuItems$ | async"- data-test-selector="op-sidemenu"-></op-sidemenu>diff --git a/frontend/src/app/features/in-app-notifications/center/menu/menu.component.sass b/frontend/src/app/features/in-app-notifications/center/menu/menu.component.sassdeleted file mode 100644index d72922e03ca..00000000000--- a/frontend/src/app/features/in-app-notifications/center/menu/menu.component.sass+++ /dev/null@@ -1,5 +0,0 @@-.op-ian-menu,-:host- display: block- // TODO: This should be standardized across the sidebar at some point- padding-top: 16pxdiff --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.tsdeleted file mode 100644index ed4c14a663d..00000000000--- a/frontend/src/app/features/in-app-notifications/center/menu/menu.component.ts+++ /dev/null@@ -1,195 +0,0 @@-// -- copyright-// OpenProject is an open source project management software.-// Copyright (C) 2012-2024 the OpenProject GmbH-//-// This program is free software; you can redistribute it and/or-// modify it under the terms of the GNU General Public License version 3.-//-// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:-// Copyright (C) 2006-2013 Jean-Philippe Lang-// Copyright (C) 2010-2013 the ChiliProject Team-//-// This program is free software; you can redistribute it and/or-// modify it under the terms of the GNU General Public License-// as published by the Free Software Foundation; either version 2-// of the License, or (at your option) any later version.-//-// This program is distributed in the hope that it will be useful,-// but WITHOUT ANY WARRANTY; without even the implied warranty of-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-// GNU General Public License for more details.-//-// You should have received a copy of the GNU General Public License-// along with this program; if not, write to the Free Software-// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.-//-// See COPYRIGHT and LICENSE files for more details.-//++--import {- ChangeDetectionStrategy,- ChangeDetectorRef,- Component,- OnInit,- HostBinding,-} from '@angular/core';-import { combineLatest } from 'rxjs';-import { map } from 'rxjs/operators';-import { StateService } from '@uirouter/core';-import idFromLink from 'core-app/features/hal/helpers/id-from-link';-import { I18nService } from 'core-app/core/i18n/i18n.service';-import { INotificationPageQueryParameters } from '../../in-app-notifications.routes';-import { IanMenuService } from './state/ian-menu.service';-import { BannersService } from 'core-app/core/enterprise/banners.service';-import { ConfigurationService } from 'core-app/core/config/configuration.service';--export const ianMenuSelector = 'op-ian-menu';--const getUiLinkForFilters = (filters:INotificationPageQueryParameters = {}) => ({- uiSref: 'notifications.center.show',- uiParams: filters,-});--@Component({- selector: ianMenuSelector,- templateUrl: './menu.component.html',- styleUrls: ['./menu.component.sass'],- providers: [IanMenuService],- changeDetection: ChangeDetectionStrategy.OnPush,-})-export class IanMenuComponent implements OnInit {- @HostBinding('class.op-ian-menu') className = true;-- baseMenuItems = [- {- key: 'inbox',- title: this.I18n.t('js.notifications.menu.inbox'),- icon: 'inbox',- ...getUiLinkForFilters({ filter: '', name: '' }),- },- ];-- reasonMenuItems = [- {- key: 'mentioned',- title: this.I18n.t('js.notifications.menu.mentioned'),- icon: 'mention',- ...getUiLinkForFilters({ filter: 'reason', name: 'mentioned' }),- },- {- key: 'assigned',- title: this.I18n.t('js.label_assignee'),- icon: 'assigned',- ...getUiLinkForFilters({ filter: 'reason', name: 'assigned' }),- },- {- key: 'responsible',- title: this.I18n.t('js.notifications.menu.accountable'),- icon: 'accountable',- ...getUiLinkForFilters({ filter: 'reason', name: 'responsible' }),- },- {- key: 'watched',- title: this.I18n.t('js.notifications.menu.watched'),- icon: 'watching',- ...getUiLinkForFilters({ filter: 'reason', name: 'watched' }),- },- {- key: 'dateAlert',- title: this.I18n.t('js.notifications.menu.date_alert'),- icon: 'date-alert',- isEnterprise: true,- ...this.eeGuardedDateAlertRoute,- },- {- key: 'shared',- title: this.I18n.t('js.notifications.menu.shared'),- isEnterprise: true,- icon: 'share',- ...this.eeGuardedShareRoute,- },- ];-- notificationsByProject$ = this.ianMenuService.notificationsByProject$.pipe(- map((items) => items- .map((item) => ({- ...item,- title: (item.projectHasParent ? '... ' : '') + item.value,- ...getUiLinkForFilters({ filter: 'project', name: idFromLink(item._links.valueLink[0].href) }),- }))- .sort((a, b) => {- if (b.projectHasParent && !a.projectHasParent) {- return -1;- }-- return a.value.toLowerCase().localeCompare(b.value.toLowerCase());- })),- );-- notificationsByReason$ = this.ianMenuService.notificationsByReason$.pipe(- map((items) => this.reasonMenuItems.map((reason) => ({- ...items.find((item) => item.value === reason.key),- ...reason,- }))),- );-- menuItems$ = combineLatest([- this.notificationsByProject$,- this.notificationsByReason$,- ]).pipe(- map(([byProject, byReason]) => [- ...this.baseMenuItems.map((baseMenuItem) => ({- ...baseMenuItem,- count: byProject.reduce((a, b) => a + (b.count || 0), 0),- })),- {- title: this.I18n.t('js.notifications.menu.by_reason'),- collapsible: true,- children: byReason,- },- {- title: this.I18n.t('js.notifications.menu.by_project'),- collapsible: true,- children: byProject,- },- ]),- );-- text = {- title: this.I18n.t('js.notifications.title'),- button_close: this.I18n.t('js.button_close'),- no_results: {- unread: this.I18n.t('js.notifications.no_unread'),- all: this.I18n.t('js.notice_no_results_to_display'),- },- };-- constructor(- readonly cdRef:ChangeDetectorRef,- readonly I18n:I18nService,- readonly ianMenuService:IanMenuService,- readonly state:StateService,- readonly bannersService:BannersService,- readonly configurationService:ConfigurationService,- ) { }-- ngOnInit():void {- this.ianMenuService.reload();- }-- private get eeGuardedDateAlertRoute() {- if (this.bannersService.eeShowBanners) {- return { uiSref: 'notifications.date_alerts_upsale', uiParams: null, uiOptions: { inherit: false } };- }-- return getUiLinkForFilters({ filter: 'reason', name: 'dateAlert' });- }-- private get eeGuardedShareRoute() {- if (this.bannersService.eeShowBanners) {- return { uiSref: 'notifications.share_upsale', uiParams: null, uiOptions: { inherit: false } };- }-- return getUiLinkForFilters({ filter: 'reason', name: 'shared' });- }-}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.tsdeleted file mode 100644index 9fd6343a94e..00000000000--- a/frontend/src/app/features/in-app-notifications/center/menu/state/ian-menu.service.ts+++ /dev/null@@ -1,114 +0,0 @@-import {- Injectable,- Injector,-} from '@angular/core';-import {- notificationCountIncreased,- notificationsMarkedRead,-} from 'core-app/core/state/in-app-notifications/in-app-notifications.actions';-import {- EffectCallback,- EffectHandler,-} from 'core-app/core/state/effects/effect-handler.decorator';-import { ActionsService } from 'core-app/core/state/actions/actions.service';-import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';-import { ApiV3ListParameters } from 'core-app/core/apiv3/paths/apiv3-list-resource.interface';-import idFromLink from 'core-app/features/hal/helpers/id-from-link';-import { InAppNotificationsResourceService } from 'core-app/core/state/in-app-notifications/in-app-notifications.service';-import { ProjectsResourceService } from 'core-app/core/state/projects/projects.service';-import {- IAN_MENU_PROJECT_FILTERS,- IAN_MENU_REASON_FILTERS,- IanMenuStore,-} from './ian-menu.store';-import { Query } from '@datorama/akita';-import {- map,- switchMap,-} from 'rxjs/operators';-import { combineLatest } from 'rxjs';--@Injectable()-@EffectHandler-export class IanMenuService {- readonly id = 'ian-center';-- readonly store = new IanMenuStore();-- readonly query = new Query(this.store);-- projectsFilter$ = this.query.select('projectsFilter');-- projectsForNotifications$ = this- .projectsFilter$- .pipe(- switchMap((filterParams) => this.projectsResourceService.collection(filterParams)),- );-- notificationsByProject$ = combineLatest([- this.query.select('notificationsByProject'),- this.projectsForNotifications$,- ]).pipe(- map(([notifications, projects]) => notifications.map((notification) => {- const project = projects.find((p) => p.id.toString() === idFromLink(notification._links.valueLink[0].href));- return {- ...notification,- projectHasParent: !!project?._links.parent.href,- };- })),- );-- notificationsByReason$ = this.query.select('notificationsByReason');-- constructor(- readonly injector:Injector,- readonly ianResourceService:InAppNotificationsResourceService,- readonly projectsResourceService:ProjectsResourceService,- readonly actions$:ActionsService,- readonly apiV3Service:ApiV3Service,- ) {- }-- /**- * Check for updates after bell count increased- */- @EffectCallback(notificationCountIncreased)- private checkForNewNotifications() {- this.reload();- }-- /**- * Reload after notifications were successfully marked as read- */- @EffectCallback(notificationsMarkedRead)- private reloadOnNotificationRead() {- return this.reload();- }-- public reload():void {- this.ianResourceService.fetchCollection(IAN_MENU_PROJECT_FILTERS)- .subscribe((data) => {- const projectsFilter:ApiV3ListParameters = {- pageSize: 100,- filters: [],- };-- if (data.groups) {- projectsFilter.filters = [['id', '=', data.groups.map((group) => idFromLink(group._links.valueLink[0].href))]];- }-- this.store.update({- notificationsByProject: data.groups,- projectsFilter,- });-- // Only request if there are any groups- if (data.groups && data.groups.length > 0) {- this.projectsResourceService.fetchCollection(projectsFilter).subscribe();- }- });- this.ianResourceService.fetchCollection(IAN_MENU_REASON_FILTERS)- // eslint-disable-next-line @typescript-eslint/no-unsafe-return- .subscribe((data) => this.store.update({ notificationsByReason: data.groups }));- }-}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.tsdeleted file mode 100644index 090459b1b74..00000000000--- a/frontend/src/app/features/in-app-notifications/center/menu/state/ian-menu.store.ts+++ /dev/null@@ -1,51 +0,0 @@-import { Store, StoreConfig } from '@datorama/akita';-import { ApiV3ListParameters } from 'core-app/core/apiv3/paths/apiv3-list-resource.interface';--export interface IanMenuGroupingData {- value:string;- count:number;- projectHasParent?:boolean;- _links:{- valueLink:{- href:string;- }[];- };-}--export interface BaseMenuItemData {- value:string;- count:number;-}--export interface IanMenuState {- notificationsByProject:IanMenuGroupingData[],- notificationsByReason:IanMenuGroupingData[],- projectsFilter:ApiV3ListParameters,-}--export const IAN_MENU_PROJECT_FILTERS:ApiV3ListParameters = {- pageSize: 100,- groupBy: 'project',- filters: [['read_ian', '=', false]],-};--export const IAN_MENU_REASON_FILTERS:ApiV3ListParameters = {- pageSize: 100,- groupBy: 'reason',- filters: [['read_ian', '=', false]],-};--export function createInitialState():IanMenuState {- return {- notificationsByProject: [],- notificationsByReason: [],- projectsFilter: {},- };-}--@StoreConfig({ name: 'ian-menu' })-export class IanMenuStore extends Store<IanMenuState> {- constructor() {- super(createInitialState());- }-}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.tsindex d74bf78b2e3..daaa9fdaff1 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@@ -77,6 +77,7 @@ import { UntilDestroyedMixin } from 'core-app/shared/helpers/angular/until-destrimport idFromLink from 'core-app/features/hal/helpers/id-from-link';import { DeviceService } from 'core-app/core/browser/device.service';import { ApiV3ListFilter, ApiV3ListParameters } from 'core-app/core/apiv3/paths/apiv3-list-resource.interface';+import { FrameElement } from '@hotwired/turbo';@Injectable()@EffectHandler@@ -93,6 +94,8 @@ export class IanCenterService extends UntilDestroyedMixin {activeCollection$ = this.query.select('activeCollection');+ menuFrame = document.getElementById('notifications_sidemenu') as FrameElement;+// eslint-disable-next-line @typescript-eslint/no-non-null-assertionactiveReason$:Observable<string|null> = this.uiRouterGlobals.params$!.pipe(this.untilDestroyed(),@@ -365,6 +368,9 @@ export class IanCenterService extends UntilDestroyedMixin {if (!this.deviceService.isMobile && this.state.includes('**.details.*')) {this.showNextNotification();}++ // Reload the sidemenu frame+ this.menuFrame.reload();}private sideLoadInvolvedWorkPackages(elements:INotification[]):Promise<unknown> {diff --git a/frontend/src/app/features/in-app-notifications/in-app-notifications.module.ts b/frontend/src/app/features/in-app-notifications/in-app-notifications.module.tsindex d0f43b3310e..38b4267ccb1 100644--- a/frontend/src/app/features/in-app-notifications/in-app-notifications.module.ts+++ b/frontend/src/app/features/in-app-notifications/in-app-notifications.module.ts@@ -10,7 +10,6 @@ import { ScrollingModule } from '@angular/cdk/scrolling';import { IAN_ROUTES } from 'core-app/features/in-app-notifications/in-app-notifications.routes';import { InAppNotificationCenterComponent } from 'core-app/features/in-app-notifications/center/in-app-notification-center.component';import { InAppNotificationCenterPageComponent } from 'core-app/features/in-app-notifications/center/in-app-notification-center-page.component';-import { IanMenuComponent } from 'core-app/features/in-app-notifications/center/menu/menu.component';import { OpenprojectWorkPackagesModule } from 'core-app/features/work-packages/openproject-work-packages.module';import { DynamicModule } from 'ng-dynamic-component';import { InAppNotificationStatusComponent } from './entry/status/in-app-notification-status.component';@@ -34,7 +33,6 @@ import { InAppNotificationsDateAlertsUpsaleComponent } from 'core-app/features/iNotificationSettingsButtonComponent,ActivateFacetButtonComponent,MarkAllAsReadButtonComponent,- IanMenuComponent,EmptyStateComponent,InAppNotificationActorsLineComponent,InAppNotificationDateAlertComponent,diff --git a/frontend/src/typings/shims.d.ts b/frontend/src/typings/shims.d.tsindex 46fea2f96dc..c3552ccee51 100644--- a/frontend/src/typings/shims.d.ts+++ b/frontend/src/typings/shims.d.ts@@ -35,7 +35,7 @@ declare module '@hotwired/turbo' {export const navigator:{submitForm:(form:HTMLFormElement, submitter?:HTMLElement) => void;- }+ };export interface StreamElement {templateElement:HTMLTemplateElement;diff --git a/lib/open_project/menu.rb b/lib/open_project/menu.rbindex d6b7c3abde1..dfc014f0eea 100644--- a/lib/open_project/menu.rb+++ b/lib/open_project/menu.rb@@ -31,8 +31,8 @@module OpenProjectmodule MenuMenuGroup = Data.define(:header, :children)- MenuItem = Data.define(:title, :href, :selected, :favored) do- def initialize(title:, href:, selected:, favored: false)+ MenuItem = Data.define(:title, :href, :selected, :favored, :icon, :count) do+ def initialize(title:, href:, selected:, favored: false, icon: nil, count: nil)superendend