diff options
author | Chocobozzz <me@florianbigard.com> | 2022-01-21 11:03:25 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-01-21 11:03:25 +0100 |
commit | d92d070c91ee73657f2e3a5756954ef63fdba306 (patch) | |
tree | 7948b03e025b8878d64c45b5a969871667dab5f1 /client/src/app/+admin/overview/users/user-edit | |
parent | cce70ae5ca3a2bfd893a7a8c457086151470de70 (diff) | |
download | PeerTube-d92d070c91ee73657f2e3a5756954ef63fdba306.tar.gz PeerTube-d92d070c91ee73657f2e3a5756954ef63fdba306.tar.zst PeerTube-d92d070c91ee73657f2e3a5756954ef63fdba306.zip |
Split user service
Diffstat (limited to 'client/src/app/+admin/overview/users/user-edit')
3 files changed, 12 insertions, 8 deletions
diff --git a/client/src/app/+admin/overview/users/user-edit/user-create.component.ts b/client/src/app/+admin/overview/users/user-edit/user-create.component.ts index b61b22fd0..1713e06ce 100644 --- a/client/src/app/+admin/overview/users/user-edit/user-create.component.ts +++ b/client/src/app/+admin/overview/users/user-edit/user-create.component.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { Component, OnInit } from '@angular/core' | 1 | import { Component, OnInit } from '@angular/core' |
2 | import { Router } from '@angular/router' | 2 | import { Router } from '@angular/router' |
3 | import { ConfigService } from '@app/+admin/config/shared/config.service' | 3 | import { ConfigService } from '@app/+admin/config/shared/config.service' |
4 | import { AuthService, Notifier, ScreenService, ServerService, UserService } from '@app/core' | 4 | import { AuthService, Notifier, ScreenService, ServerService } from '@app/core' |
5 | import { | 5 | import { |
6 | USER_CHANNEL_NAME_VALIDATOR, | 6 | USER_CHANNEL_NAME_VALIDATOR, |
7 | USER_EMAIL_VALIDATOR, | 7 | USER_EMAIL_VALIDATOR, |
@@ -13,6 +13,7 @@ import { | |||
13 | USER_VIDEO_QUOTA_VALIDATOR | 13 | USER_VIDEO_QUOTA_VALIDATOR |
14 | } from '@app/shared/form-validators/user-validators' | 14 | } from '@app/shared/form-validators/user-validators' |
15 | import { FormValidatorService } from '@app/shared/shared-forms' | 15 | import { FormValidatorService } from '@app/shared/shared-forms' |
16 | import { UserAdminService } from '@app/shared/shared-users' | ||
16 | import { UserCreate, UserRole } from '@shared/models' | 17 | import { UserCreate, UserRole } from '@shared/models' |
17 | import { UserEdit } from './user-edit' | 18 | import { UserEdit } from './user-edit' |
18 | 19 | ||
@@ -32,7 +33,7 @@ export class UserCreateComponent extends UserEdit implements OnInit { | |||
32 | protected auth: AuthService, | 33 | protected auth: AuthService, |
33 | private router: Router, | 34 | private router: Router, |
34 | private notifier: Notifier, | 35 | private notifier: Notifier, |
35 | private userService: UserService | 36 | private userAdminService: UserAdminService |
36 | ) { | 37 | ) { |
37 | super() | 38 | super() |
38 | 39 | ||
@@ -71,7 +72,7 @@ export class UserCreateComponent extends UserEdit implements OnInit { | |||
71 | userCreate.videoQuota = parseInt(this.form.value['videoQuota'], 10) | 72 | userCreate.videoQuota = parseInt(this.form.value['videoQuota'], 10) |
72 | userCreate.videoQuotaDaily = parseInt(this.form.value['videoQuotaDaily'], 10) | 73 | userCreate.videoQuotaDaily = parseInt(this.form.value['videoQuotaDaily'], 10) |
73 | 74 | ||
74 | this.userService.addUser(userCreate) | 75 | this.userAdminService.addUser(userCreate) |
75 | .subscribe({ | 76 | .subscribe({ |
76 | next: () => { | 77 | next: () => { |
77 | this.notifier.success($localize`User ${userCreate.username} created.`) | 78 | this.notifier.success($localize`User ${userCreate.username} created.`) |
diff --git a/client/src/app/+admin/overview/users/user-edit/user-password.component.ts b/client/src/app/+admin/overview/users/user-edit/user-password.component.ts index 42bf20de1..8999d1f00 100644 --- a/client/src/app/+admin/overview/users/user-edit/user-password.component.ts +++ b/client/src/app/+admin/overview/users/user-edit/user-password.component.ts | |||
@@ -1,7 +1,8 @@ | |||
1 | import { Component, Input, OnInit } from '@angular/core' | 1 | import { Component, Input, OnInit } from '@angular/core' |
2 | import { Notifier, UserService } from '@app/core' | 2 | import { Notifier } from '@app/core' |
3 | import { USER_PASSWORD_VALIDATOR } from '@app/shared/form-validators/user-validators' | 3 | import { USER_PASSWORD_VALIDATOR } from '@app/shared/form-validators/user-validators' |
4 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' | 4 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' |
5 | import { UserAdminService } from '@app/shared/shared-users' | ||
5 | import { UserUpdate } from '@shared/models' | 6 | import { UserUpdate } from '@shared/models' |
6 | 7 | ||
7 | @Component({ | 8 | @Component({ |
@@ -19,7 +20,7 @@ export class UserPasswordComponent extends FormReactive implements OnInit { | |||
19 | constructor ( | 20 | constructor ( |
20 | protected formValidatorService: FormValidatorService, | 21 | protected formValidatorService: FormValidatorService, |
21 | private notifier: Notifier, | 22 | private notifier: Notifier, |
22 | private userService: UserService | 23 | private userAdminService: UserAdminService |
23 | ) { | 24 | ) { |
24 | super() | 25 | super() |
25 | } | 26 | } |
@@ -35,7 +36,7 @@ export class UserPasswordComponent extends FormReactive implements OnInit { | |||
35 | 36 | ||
36 | const userUpdate: UserUpdate = this.form.value | 37 | const userUpdate: UserUpdate = this.form.value |
37 | 38 | ||
38 | this.userService.updateUser(this.userId, userUpdate) | 39 | this.userAdminService.updateUser(this.userId, userUpdate) |
39 | .subscribe({ | 40 | .subscribe({ |
40 | next: () => this.notifier.success($localize`Password changed for user ${this.username}.`), | 41 | next: () => this.notifier.success($localize`Password changed for user ${this.username}.`), |
41 | 42 | ||
diff --git a/client/src/app/+admin/overview/users/user-edit/user-update.component.ts b/client/src/app/+admin/overview/users/user-edit/user-update.component.ts index 42599a17e..bab288a67 100644 --- a/client/src/app/+admin/overview/users/user-edit/user-update.component.ts +++ b/client/src/app/+admin/overview/users/user-edit/user-update.component.ts | |||
@@ -10,6 +10,7 @@ import { | |||
10 | USER_VIDEO_QUOTA_VALIDATOR | 10 | USER_VIDEO_QUOTA_VALIDATOR |
11 | } from '@app/shared/form-validators/user-validators' | 11 | } from '@app/shared/form-validators/user-validators' |
12 | import { FormValidatorService } from '@app/shared/shared-forms' | 12 | import { FormValidatorService } from '@app/shared/shared-forms' |
13 | import { UserAdminService } from '@app/shared/shared-users' | ||
13 | import { User as UserType, UserAdminFlag, UserRole, UserUpdate } from '@shared/models' | 14 | import { User as UserType, UserAdminFlag, UserRole, UserUpdate } from '@shared/models' |
14 | import { UserEdit } from './user-edit' | 15 | import { UserEdit } from './user-edit' |
15 | 16 | ||
@@ -32,7 +33,8 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy { | |||
32 | private route: ActivatedRoute, | 33 | private route: ActivatedRoute, |
33 | private router: Router, | 34 | private router: Router, |
34 | private notifier: Notifier, | 35 | private notifier: Notifier, |
35 | private userService: UserService | 36 | private userService: UserService, |
37 | private userAdminService: UserAdminService | ||
36 | ) { | 38 | ) { |
37 | super() | 39 | super() |
38 | 40 | ||
@@ -86,7 +88,7 @@ export class UserUpdateComponent extends UserEdit implements OnInit, OnDestroy { | |||
86 | 88 | ||
87 | if (userUpdate.pluginAuth === 'null') userUpdate.pluginAuth = null | 89 | if (userUpdate.pluginAuth === 'null') userUpdate.pluginAuth = null |
88 | 90 | ||
89 | this.userService.updateUser(this.user.id, userUpdate) | 91 | this.userAdminService.updateUser(this.user.id, userUpdate) |
90 | .subscribe({ | 92 | .subscribe({ |
91 | next: () => { | 93 | next: () => { |
92 | this.notifier.success($localize`User ${this.user.username} updated.`) | 94 | this.notifier.success($localize`User ${this.user.username} updated.`) |