Merge pull request #9784 from opf/fix/39493-and-39466-notification-center

Fix sidebar inbox number of notifications, also refresh notifications inside work package on center reload
pull/9787/head
Oliver Günther 3 years ago committed by GitHub
commit 1a57cf8151
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      frontend/src/app/core/state/in-app-notifications/in-app-notifications.actions.ts
  2. 2
      frontend/src/app/features/in-app-notifications/center/menu/menu.component.ts
  3. 2
      frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts
  4. 9
      frontend/src/app/features/work-packages/routing/wp-view-base/state/wp-single-view.service.ts
  5. 1
      frontend/src/global_styles/openproject/_mixins.sass

@ -18,3 +18,8 @@ export const notificationCountIncreased = action(
'[IAN] The backend sent a notification count that was higher than the last known',
props<{ origin:string, count:number }>(),
);
export const centerUpdatedInPlace = action(
'[IAN] The notification center updated the notification list without a full page refresh',
props<{ origin:string }>(),
);

@ -96,7 +96,7 @@ export class IanMenuComponent implements OnInit {
map(([byProject, byReason]) => [
...this.baseMenuItems.map((baseMenuItem) => ({
...baseMenuItem,
count: byReason.reduce((a, b) => a + (b.count || 0), 0),
count: byProject.reduce((a, b) => a + (b.count || 0), 0),
})),
{
title: this.I18n.t('js.notifications.menu.by_reason'),

@ -23,6 +23,7 @@ import {
markNotificationsAsRead,
notificationsMarkedRead,
notificationCountIncreased,
centerUpdatedInPlace,
} from 'core-app/core/state/in-app-notifications/in-app-notifications.actions';
import { InAppNotification } from 'core-app/core/state/in-app-notifications/in-app-notification.model';
import { IanCenterQuery } from 'core-app/features/in-app-notifications/center/state/ian-center.query';
@ -186,6 +187,7 @@ export class IanCenterService extends UntilDestroyedMixin {
text: this.I18n.t('js.notifications.center.new_notifications.link_text'),
target: () => {
this.store.update({ activeCollection: collection });
this.actions$.dispatch(centerUpdatedInPlace({ origin: this.id }));
},
},
});

@ -12,6 +12,7 @@ import { ApiV3ListFilter } from 'core-app/core/apiv3/paths/apiv3-list-resource.i
import {
markNotificationsAsRead,
notificationsMarkedRead,
centerUpdatedInPlace,
} from 'core-app/core/state/in-app-notifications/in-app-notifications.actions';
import { ActionsService } from 'core-app/core/state/actions/actions.service';
import {
@ -86,4 +87,12 @@ export class WpSingleViewService {
private reloadOnNotificationRead() {
this.reload();
}
/**
* Reload after notifications were successfully marked as read
*/
@EffectCallback(centerUpdatedInPlace)
private reloadOnCenterUpdate() {
this.reload();
}
}

@ -265,6 +265,7 @@ $scrollbar-size: 10px
font-weight: bold
background: #00A3FF
color: white
flex-shrink: 0
@mixin show-on-focus
position: absolute

Loading…
Cancel
Save