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

Trying to fix api filter for notifications

Benjamin Bädorf0e6bf4261ec2
diff --git a/frontend/src/app/core/apiv3/endpoints/notifications/apiv3-notifications-paths.ts b/frontend/src/app/core/apiv3/endpoints/notifications/apiv3-notifications-paths.ts
index 99e8d5856c8..b913cc96827 100644
--- a/frontend/src/app/core/apiv3/endpoints/notifications/apiv3-notifications-paths.ts
+++ b/frontend/src/app/core/apiv3/endpoints/notifications/apiv3-notifications-paths.ts
@@ -29,7 +29,11 @@
import { APIv3ResourceCollection } from 'core-app/core/apiv3/paths/apiv3-resource';
import { APIV3Service } from 'core-app/core/apiv3/api-v3.service';
import { Observable } from 'rxjs';
-import { Apiv3ListParameters, listParamsString } from 'core-app/core/apiv3/paths/apiv3-list-resource.interface';
+import {
+ Apiv3ListParameters,
+ ApiV3ListFilter,
+ listParamsString,
+} from 'core-app/core/apiv3/paths/apiv3-list-resource.interface';
import { InAppNotification } from 'core-app/features/in-app-notifications/store/in-app-notification.model';
import { Apiv3NotificationPaths } from 'core-app/core/apiv3/endpoints/notifications/apiv3-notification-paths';
import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decorator';
@@ -67,9 +71,14 @@ export class Apiv3NotificationsPaths
* Load unread events
*/
public unread(additional?:Apiv3ListParameters):Observable<IHALCollection<InAppNotification>> {
+ const unreadFilter:ApiV3ListFilter = ['readIAN', '=', false];
+ const filters = [
+ ...(additional?.filters ? additional.filters : []),
+ unreadFilter,
+ ];
const params:Apiv3ListParameters = {
...additional,
- filters: [['readIAN', '=', false]],
+ filters,
};
return this.list(params);
diff --git a/frontend/src/app/features/work-packages/components/wp-activity/revision/revision-activity.component.html b/frontend/src/app/features/work-packages/components/wp-activity/revision/revision-activity.component.html
index d858ab042d7..5c9905511a7 100644
--- a/frontend/src/app/features/work-packages/components/wp-activity/revision/revision-activity.component.html
+++ b/frontend/src/app/features/work-packages/components/wp-activity/revision/revision-activity.component.html
@@ -5,6 +5,7 @@
<div class="comments-number">
<span
*ngIf="hasUnreadNotification"
+ class=""
>U</span>
<activity-link
[workPackage]="workPackage"
diff --git a/frontend/src/app/features/work-packages/components/wp-activity/user/user-activity.component.html b/frontend/src/app/features/work-packages/components/wp-activity/user/user-activity.component.html
index e6dd3bf8440..d9978198de2 100644
--- a/frontend/src/app/features/work-packages/components/wp-activity/user/user-activity.component.html
+++ b/frontend/src/app/features/work-packages/components/wp-activity/user/user-activity.component.html
@@ -23,6 +23,7 @@
<div class="comments-number">
<span
*ngIf="hasUnreadNotification"
+ class=""
>U</span>
<activity-link
[workPackage]="workPackage"
diff --git a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts
index 21b708eca10..82a347cf3d1 100644
--- a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts
+++ b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts
@@ -92,8 +92,8 @@ export class ActivityPanelBaseController extends UntilDestroyedMixin implements
{
pageSize: NOTIFICATIONS_MAX_SIZE,
filters: [
- [ 'resource_id', '=', [ this.workPackageId ] ],
- [ 'resource_type', '=', [ 'work_package' ] ],
+ [ 'resourceId', '=', [ this.workPackageId ] ],
+ [ 'resourceType', '=', [ 'work_package' ] ],
],
},
),
diff --git a/frontend/src/app/features/work-packages/components/wp-tabs/components/wp-tab-wrapper/tab.ts b/frontend/src/app/features/work-packages/components/wp-tabs/components/wp-tab-wrapper/tab.ts
index 19b10b60db2..85478fa123e 100644
--- a/frontend/src/app/features/work-packages/components/wp-tabs/components/wp-tab-wrapper/tab.ts
+++ b/frontend/src/app/features/work-packages/components/wp-tabs/components/wp-tab-wrapper/tab.ts
@@ -12,4 +12,5 @@ export interface WpTabDefinition extends TabDefinition {
component:Type<TabComponent>;
displayable?:(workPackage:WorkPackageResource, $state:StateService) => boolean;
count?:(workPackage:WorkPackageResource, injector:Injector) => Observable<number>;
+ showCountAsBubble?:boolean;
}
diff --git a/frontend/src/app/features/work-packages/components/wp-tabs/components/wp-tabs/wp-tabs.component.html b/frontend/src/app/features/work-packages/components/wp-tabs/components/wp-tabs/wp-tabs.component.html
index e55adf4742d..a98e2041765 100644
--- a/frontend/src/app/features/work-packages/components/wp-tabs/components/wp-tabs/wp-tabs.component.html
+++ b/frontend/src/app/features/work-packages/components/wp-tabs/components/wp-tabs/wp-tabs.component.html
@@ -1,26 +1,27 @@
<op-scrollable-tabs
[tabs]="tabs"
- class="op-work-package-tabs">
- <ng-container slot="actions" *ngIf="view === 'split'">
- <li class="tab-icon">
- <button
- type="button"
- class="op-link work-packages--details-fullscreen-icon"
- [title]="text.details.goToFullScreen"
- (click)="switchToFullscreen()"
- >
- <op-icon icon-classes="icon-context icon-no-color icon-to-fullscreen"></op-icon>
- </button>
- </li>
- <li class="tab-icon">
- <button
- type="button"
- class="op-link work-packages--details-close-icon"
- [title]="text.details.close"
- (click)="close()"
- >
- <op-icon icon-classes="icon-context icon-no-color icon-close"></op-icon>
- </button>
- </li>
- </ng-container>
+ class="op-work-package-tabs"
+>
+ <ng-container slot="actions" *ngIf="view === 'split'">
+ <li class="tab-icon">
+ <button
+ type="button"
+ class="op-link work-packages--details-fullscreen-icon"
+ [title]="text.details.goToFullScreen"
+ (click)="switchToFullscreen()"
+ >
+ <op-icon icon-classes="icon-context icon-no-color icon-to-fullscreen"></op-icon>
+ </button>
+ </li>
+ <li class="tab-icon">
+ <button
+ type="button"
+ class="op-link work-packages--details-close-icon"
+ [title]="text.details.close"
+ (click)="close()"
+ >
+ <op-icon icon-classes="icon-context icon-no-color icon-close"></op-icon>
+ </button>
+ </li>
+ </ng-container>
</op-scrollable-tabs>
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 32f0401103d..ff25bb23ca2 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
@@ -19,8 +19,8 @@ export function workPackageNotificationsCount(
{
pageSize: NOTIFICATIONS_MAX_SIZE,
filters: [
- [ 'resource_id', '=', [ wpId ] ],
- [ 'resource_type', '=', [ 'work_package' ] ],
+ [ 'resourceId', '=', [ wpId ] ],
+ [ 'resourceType', '=', [ 'work_package' ] ],
],
},
)
diff --git a/frontend/src/app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-tabs.service.ts b/frontend/src/app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-tabs.service.ts
index bbd9454b12e..04dc523284b 100644
--- a/frontend/src/app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-tabs.service.ts
+++ b/frontend/src/app/features/work-packages/components/wp-tabs/services/wp-tabs/wp-tabs.service.ts
@@ -67,6 +67,7 @@ export class WorkPackageTabsService {
component: WorkPackageActivityTabComponent,
name: I18n.t('js.work_packages.tabs.activity'),
count: workPackageNotificationsCount,
+ showCountAsBubble: true,
},
{
id: 'relations',
diff --git a/frontend/src/app/shared/components/tabs/scrollable-tabs/scrollable-tabs.component.html b/frontend/src/app/shared/components/tabs/scrollable-tabs/scrollable-tabs.component.html
index 14d266e6700..2d2daa732ed 100644
--- a/frontend/src/app/shared/components/tabs/scrollable-tabs/scrollable-tabs.component.html
+++ b/frontend/src/app/shared/components/tabs/scrollable-tabs/scrollable-tabs.component.html
@@ -1,59 +1,60 @@
<div class="op-scrollable-tabs" [ngClass]="classes">
<div
- #scrollContainer
- class="op-scrollable-tabs--tab-container"
+ #scrollContainer
+ class="op-scrollable-tabs--tab-container"
>
<ul #scrollPane class="op-tab-row" (scroll)="onScroll($event)">
<li
- *ngFor="let tab of tabs; trackBy:trackById"
- class="op-tab-row--tab"
- [attr.data-tab-id]="tab.id"
- [attr.data-qa-tab-id]="tab.id"
- [attr.data-qa-tab-selected]="tab.id === currentTabId || undefined"
- [attr.data-qa-tab-disabled]="tab.disable || undefined"
+ *ngFor="let tab of tabs; trackBy:trackById"
+ class="op-tab-row--tab"
+ [attr.data-tab-id]="tab.id"
+ [attr.data-qa-tab-id]="tab.id"
+ [attr.data-qa-tab-selected]="tab.id === currentTabId || undefined"
+ [attr.data-qa-tab-disabled]="tab.disable || undefined"
>
<a
- *ngIf="!tab.route"
- [href]="tab.path"
- class="op-tab-row--link"
- [class.op-tab-row--link_selected]="tab.id === currentTabId"
- [class.op-tab-row--link_disabled]="tab.disable !== undefined"
- (click)="clickTab(tab, $event)"
- [attr.title]="tabTitle(tab)"
- [textContent]="tab.name"
+ *ngIf="!tab.route"
+ [href]="tab.path"
+ class="op-tab-row--link"
+ [class.op-tab-row--link_selected]="tab.id === currentTabId"
+ [class.op-tab-row--link_disabled]="tab.disable !== undefined"
+ (click)="clickTab(tab, $event)"
+ [attr.title]="tabTitle(tab)"
+ [textContent]="tab.name"
>
</a>
<a
- *ngIf="tab.route"
- [uiSref]="tab.route"
- [uiParams]="tab.routeParams"
- class="op-tab-row--link"
- uiSrefActive="op-tab-row--link_selected"
- (click)="clickTab(tab, $event)"
- [attr.title]="tabTitle(tab)"
- [class.op-tab-row--link_disabled]="tab.disable !== undefined"
- href=""
- role="button"
+ *ngIf="tab.route"
+ [uiSref]="tab.route"
+ [uiParams]="tab.routeParams"
+ class="op-tab-row--link"
+ uiSrefActive="op-tab-row--link_selected"
+ (click)="clickTab(tab, $event)"
+ [attr.title]="tabTitle(tab)"
+ [class.op-tab-row--link_disabled]="tab.disable !== undefined"
+ href=""
+ role="button"
>
<span [textContent]="tab.name"></span>
<op-tab-count
- *ngIf="tab.counter"
- [counter]="tab.counter"
+ *ngIf="tab.counter && tab.showCountAsBubble"
+ [counter]="tab.counter"
></op-tab-count>
+ <span *ngIf="tab.counter && !tab.showCountAsBubble"> ({{ tab.counter | async }})</span>
</a>
</li>
</ul>
<div
- #scrollLeftBtn [hidden]="hideLeftButton"
- class="op-scrollable-tabs--button op-scrollable-tabs--button_left"
- (click)="scrollLeft()"
+ #scrollLeftBtn [hidden]="hideLeftButton"
+ class="op-scrollable-tabs--button op-scrollable-tabs--button_left"
+ (click)="scrollLeft()"
>
<span class="icon-arrow-left2"></span>
</div>
<div
- #scrollRightBtn [hidden]="hideRightButton"
- class="op-scrollable-tabs--button op-scrollable-tabs--button_right"
- (click)="scrollRight()"
+ #scrollRightBtn [hidden]="hideRightButton"
+ class="op-scrollable-tabs--button op-scrollable-tabs--button_right"
+ (click)="scrollRight()"
>
<span class="icon-arrow-right2"></span>
</div>