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

Replace other injections of store and query

Oliver Günther248e9a9eb457
diff --git a/frontend/src/app/features/user-preferences/notifications-settings/inline-create/notification-setting-inline-create.component.ts b/frontend/src/app/features/user-preferences/notifications-settings/inline-create/notification-setting-inline-create.component.ts
index 60c699080eb..447c086d9a4 100644
--- a/frontend/src/app/features/user-preferences/notifications-settings/inline-create/notification-setting-inline-create.component.ts
+++ b/frontend/src/app/features/user-preferences/notifications-settings/inline-create/notification-setting-inline-create.component.ts
@@ -15,6 +15,7 @@ import { APIV3Service } from 'core-app/core/apiv3/api-v3.service';
import { ApiV3FilterBuilder } from 'core-app/shared/helpers/api-v3/api-v3-filter-builder';
import { HalSourceLink } from 'core-app/features/hal/resources/hal-resource';
import { UserPreferencesQuery } from 'core-app/features/user-preferences/state/user-preferences.query';
+import { UserPreferencesService } from 'core-app/features/user-preferences/state/user-preferences.service';
export interface NotificationSettingProjectOption {
name:string;
@@ -49,7 +50,7 @@ export class NotificationSettingInlineCreateComponent {
constructor(
private I18n:I18nService,
private apiV3Service:APIV3Service,
- private query:UserPreferencesQuery,
+ private storeService:UserPreferencesService,
) {
}
@@ -72,7 +73,7 @@ export class NotificationSettingInlineCreateComponent {
.filtered(filters)
.get()
.pipe(
- withLatestFrom(this.query.selectedProjects$),
+ withLatestFrom(this.storeService.query.selectedProjects$),
map(([collection, selected]) => collection.elements.map(
(project) => (
{ href: project.href || '', name: project.name, disabled: selected.has(project.href) }
diff --git a/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.ts b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.ts
index e40c6983eae..42eb376ee47 100644
--- a/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.ts
+++ b/frontend/src/app/features/user-preferences/notifications-settings/page/notifications-settings-page.component.ts
@@ -27,8 +27,7 @@ export class NotificationsSettingsPageComponent implements OnInit {
constructor(
private I18n:I18nService,
- private stateService:UserPreferencesService,
- private query:UserPreferencesQuery,
+ private storeService:UserPreferencesService,
private currentUserService:CurrentUserService,
private uiRouterGlobals:UIRouterGlobals,
) {
@@ -42,12 +41,12 @@ export class NotificationsSettingsPageComponent implements OnInit {
.pipe(take(1))
.subscribe((user) => {
this.userId = this.userId || user.id!;
- this.stateService.get(this.userId);
+ this.storeService.get(this.userId);
});
}
public saveChanges():void {
- const prefs = this.query.getValue();
- this.stateService.update(this.userId, prefs);
+ const prefs = this.storeService.query.getValue();
+ this.storeService.update(this.userId, prefs);
}
}
diff --git a/frontend/src/app/features/user-preferences/notifications-settings/row/notification-setting-row.component.ts b/frontend/src/app/features/user-preferences/notifications-settings/row/notification-setting-row.component.ts
index bc8855ec606..86895e94831 100644
--- a/frontend/src/app/features/user-preferences/notifications-settings/row/notification-setting-row.component.ts
+++ b/frontend/src/app/features/user-preferences/notifications-settings/row/notification-setting-row.component.ts
@@ -1,10 +1,13 @@
import {
- ChangeDetectionStrategy, Component, Input, OnInit,
+ ChangeDetectionStrategy,
+ Component,
+ Input,
+ OnInit,
} from '@angular/core';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { arrayUpdate } from '@datorama/akita';
import { NotificationSetting } from 'core-app/features/user-preferences/state/notification-setting.model';
-import { UserPreferencesStore } from 'core-app/features/user-preferences/state/user-preferences.store';
+import { UserPreferencesService } from 'core-app/features/user-preferences/state/user-preferences.service';
@Component({
// eslint-disable-next-line @angular-eslint/component-selector
@@ -44,7 +47,7 @@ export class NotificationSettingRowComponent implements OnInit {
constructor(
private I18n:I18nService,
- private store:UserPreferencesStore,
+ private storeService:UserPreferencesService,
) {
}
@@ -53,7 +56,7 @@ export class NotificationSettingRowComponent implements OnInit {
}
remove():void {
- this.store.update(
+ this.storeService.store.update(
({ notifications }) => ({
notifications: notifications.filter((notification) => notification._links.project.href !== this.setting._links.project.href),
}),
@@ -61,7 +64,7 @@ export class NotificationSettingRowComponent implements OnInit {
}
update(delta:Partial<NotificationSetting>) {
- this.store.update(
+ this.storeService.store.update(
({ notifications }) => ({
notifications: arrayUpdate(
notifications, this.matcherFn.bind(this), delta,
diff --git a/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.ts b/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.ts
index be0c27bcdaa..684da640951 100644
--- a/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.ts
+++ b/frontend/src/app/features/user-preferences/notifications-settings/table/notification-settings-table.component.ts
@@ -1,15 +1,13 @@
// noinspection ES6UnusedImports
import {
- Component, OnInit, ChangeDetectionStrategy, Input,
+ ChangeDetectionStrategy,
+ Component,
+ Input,
} from '@angular/core';
import { KeyValue } from '@angular/common';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { UserPreferencesService } from 'core-app/features/user-preferences/state/user-preferences.service';
-import { UserPreferencesStore } from 'core-app/features/user-preferences/state/user-preferences.store';
-import { UserPreferencesQuery } from 'core-app/features/user-preferences/state/user-preferences.query';
-import { CurrentUserService } from 'core-app/core/current-user/current-user.service';
-import { UIRouterGlobals } from '@uirouter/core';
import { HalSourceLink } from 'core-app/features/hal/resources/hal-resource';
import {
buildNotificationSetting,
@@ -26,7 +24,7 @@ import { arrayAdd } from '@datorama/akita';
export class NotificationSettingsTableComponent {
@Input() userId:string;
- groupedNotificationSettings$ = this.query.notificationsGroupedByProject$;
+ groupedNotificationSettings$ = this.storeService.query.notificationsGroupedByProject$;
text = {
save: this.I18n.t('js.button_save'),
@@ -57,9 +55,7 @@ export class NotificationSettingsTableComponent {
constructor(
private I18n:I18nService,
- private stateService:UserPreferencesService,
- private store:UserPreferencesStore,
- private query:UserPreferencesQuery,
+ private storeService:UserPreferencesService,
) {
}
@@ -70,7 +66,7 @@ export class NotificationSettingsTableComponent {
buildNotificationSetting(project, { channel: 'mail_digest' }),
];
- this.store.update(
+ this.storeService.store.update(
({ notifications }) => ({
notifications: arrayAdd(notifications, added),
}),
diff --git a/frontend/src/app/features/user-preferences/notifications-settings/toolbar/notifications-settings-toolbar.component.ts b/frontend/src/app/features/user-preferences/notifications-settings/toolbar/notifications-settings-toolbar.component.ts
index 127d875cdd3..8496b410e19 100644
--- a/frontend/src/app/features/user-preferences/notifications-settings/toolbar/notifications-settings-toolbar.component.ts
+++ b/frontend/src/app/features/user-preferences/notifications-settings/toolbar/notifications-settings-toolbar.component.ts
@@ -1,7 +1,9 @@
-import { ChangeDetectionStrategy, Component } from '@angular/core';
-import { UserPreferencesQuery } from 'core-app/features/user-preferences/state/user-preferences.query';
+import {
+ ChangeDetectionStrategy,
+ Component,
+} from '@angular/core';
import { I18nService } from 'core-app/core/i18n/i18n.service';
-import { UserPreferencesStore } from 'core-app/features/user-preferences/state/user-preferences.store';
+import { UserPreferencesService } from 'core-app/features/user-preferences/state/user-preferences.service';
@Component({
selector: 'op-notifications-settings-toolbar',
@@ -9,7 +11,7 @@ import { UserPreferencesStore } from 'core-app/features/user-preferences/state/u
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class NotificationsSettingsToolbarComponent {
- projectSettings$ = this.query.projectNotifications$;
+ projectSettings$ = this.storeService.query.projectNotifications$;
text = {
title: this.I18n.t('js.notifications.settings.title'),
@@ -17,14 +19,13 @@ export class NotificationsSettingsToolbarComponent {
};
constructor(
- private query:UserPreferencesQuery,
- private store:UserPreferencesStore,
+ private storeService:UserPreferencesService,
private I18n:I18nService,
) {
}
removeAll():void {
- this.store.update(
+ this.storeService.store.update(
({ notifications }) => ({
notifications: notifications.filter((notification) => notification._links.project.href === null),
}),