aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+admin/overview/users
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-01-21 11:03:25 +0100
committerChocobozzz <me@florianbigard.com>2022-01-21 11:03:25 +0100
commitd92d070c91ee73657f2e3a5756954ef63fdba306 (patch)
tree7948b03e025b8878d64c45b5a969871667dab5f1 /client/src/app/+admin/overview/users
parentcce70ae5ca3a2bfd893a7a8c457086151470de70 (diff)
downloadPeerTube-d92d070c91ee73657f2e3a5756954ef63fdba306.tar.gz
PeerTube-d92d070c91ee73657f2e3a5756954ef63fdba306.tar.zst
PeerTube-d92d070c91ee73657f2e3a5756954ef63fdba306.zip
Split user service
Diffstat (limited to 'client/src/app/+admin/overview/users')
-rw-r--r--client/src/app/+admin/overview/users/user-edit/user-create.component.ts7
-rw-r--r--client/src/app/+admin/overview/users/user-edit/user-password.component.ts7
-rw-r--r--client/src/app/+admin/overview/users/user-edit/user-update.component.ts6
-rw-r--r--client/src/app/+admin/overview/users/user-list/user-list.component.ts13
4 files changed, 19 insertions, 14 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 @@
1import { Component, OnInit } from '@angular/core' 1import { Component, OnInit } from '@angular/core'
2import { Router } from '@angular/router' 2import { Router } from '@angular/router'
3import { ConfigService } from '@app/+admin/config/shared/config.service' 3import { ConfigService } from '@app/+admin/config/shared/config.service'
4import { AuthService, Notifier, ScreenService, ServerService, UserService } from '@app/core' 4import { AuthService, Notifier, ScreenService, ServerService } from '@app/core'
5import { 5import {
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'
15import { FormValidatorService } from '@app/shared/shared-forms' 15import { FormValidatorService } from '@app/shared/shared-forms'
16import { UserAdminService } from '@app/shared/shared-users'
16import { UserCreate, UserRole } from '@shared/models' 17import { UserCreate, UserRole } from '@shared/models'
17import { UserEdit } from './user-edit' 18import { 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 @@
1import { Component, Input, OnInit } from '@angular/core' 1import { Component, Input, OnInit } from '@angular/core'
2import { Notifier, UserService } from '@app/core' 2import { Notifier } from '@app/core'
3import { USER_PASSWORD_VALIDATOR } from '@app/shared/form-validators/user-validators' 3import { USER_PASSWORD_VALIDATOR } from '@app/shared/form-validators/user-validators'
4import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' 4import { FormReactive, FormValidatorService } from '@app/shared/shared-forms'
5import { UserAdminService } from '@app/shared/shared-users'
5import { UserUpdate } from '@shared/models' 6import { 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'
12import { FormValidatorService } from '@app/shared/shared-forms' 12import { FormValidatorService } from '@app/shared/shared-forms'
13import { UserAdminService } from '@app/shared/shared-users'
13import { User as UserType, UserAdminFlag, UserRole, UserUpdate } from '@shared/models' 14import { User as UserType, UserAdminFlag, UserRole, UserUpdate } from '@shared/models'
14import { UserEdit } from './user-edit' 15import { 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.`)
diff --git a/client/src/app/+admin/overview/users/user-list/user-list.component.ts b/client/src/app/+admin/overview/users/user-list/user-list.component.ts
index 9fba11cbd..9a9d0f5c6 100644
--- a/client/src/app/+admin/overview/users/user-list/user-list.component.ts
+++ b/client/src/app/+admin/overview/users/user-list/user-list.component.ts
@@ -1,10 +1,11 @@
1import { SortMeta } from 'primeng/api' 1import { SortMeta } from 'primeng/api'
2import { Component, OnInit, ViewChild } from '@angular/core' 2import { Component, OnInit, ViewChild } from '@angular/core'
3import { ActivatedRoute, Router } from '@angular/router' 3import { ActivatedRoute, Router } from '@angular/router'
4import { AuthService, ConfirmService, Notifier, RestPagination, RestTable, ServerService, UserService } from '@app/core' 4import { AuthService, ConfirmService, Notifier, RestPagination, RestTable, ServerService } from '@app/core'
5import { AdvancedInputFilter } from '@app/shared/shared-forms' 5import { AdvancedInputFilter } from '@app/shared/shared-forms'
6import { DropdownAction } from '@app/shared/shared-main' 6import { DropdownAction } from '@app/shared/shared-main'
7import { UserBanModalComponent } from '@app/shared/shared-moderation' 7import { UserBanModalComponent } from '@app/shared/shared-moderation'
8import { UserAdminService } from '@app/shared/shared-users'
8import { User, UserRole } from '@shared/models' 9import { User, UserRole } from '@shared/models'
9 10
10type UserForList = User & { 11type UserForList = User & {
@@ -57,7 +58,7 @@ export class UserListComponent extends RestTable implements OnInit {
57 private confirmService: ConfirmService, 58 private confirmService: ConfirmService,
58 private serverService: ServerService, 59 private serverService: ServerService,
59 private auth: AuthService, 60 private auth: AuthService,
60 private userService: UserService 61 private userAdminService: UserAdminService
61 ) { 62 ) {
62 super() 63 super()
63 } 64 }
@@ -177,7 +178,7 @@ export class UserListComponent extends RestTable implements OnInit {
177 const res = await this.confirmService.confirm($localize`Do you really want to unban ${users.length} users?`, $localize`Unban`) 178 const res = await this.confirmService.confirm($localize`Do you really want to unban ${users.length} users?`, $localize`Unban`)
178 if (res === false) return 179 if (res === false) return
179 180
180 this.userService.unbanUsers(users) 181 this.userAdminService.unbanUsers(users)
181 .subscribe({ 182 .subscribe({
182 next: () => { 183 next: () => {
183 this.notifier.success($localize`${users.length} users unbanned.`) 184 this.notifier.success($localize`${users.length} users unbanned.`)
@@ -200,7 +201,7 @@ export class UserListComponent extends RestTable implements OnInit {
200 const res = await this.confirmService.confirm(message, $localize`Delete`) 201 const res = await this.confirmService.confirm(message, $localize`Delete`)
201 if (res === false) return 202 if (res === false) return
202 203
203 this.userService.removeUser(users) 204 this.userAdminService.removeUser(users)
204 .subscribe({ 205 .subscribe({
205 next: () => { 206 next: () => {
206 this.notifier.success($localize`${users.length} users deleted.`) 207 this.notifier.success($localize`${users.length} users deleted.`)
@@ -212,7 +213,7 @@ export class UserListComponent extends RestTable implements OnInit {
212 } 213 }
213 214
214 setEmailsAsVerified (users: User[]) { 215 setEmailsAsVerified (users: User[]) {
215 this.userService.updateUsers(users, { emailVerified: true }) 216 this.userAdminService.updateUsers(users, { emailVerified: true })
216 .subscribe({ 217 .subscribe({
217 next: () => { 218 next: () => {
218 this.notifier.success($localize`${users.length} users email set as verified.`) 219 this.notifier.success($localize`${users.length} users email set as verified.`)
@@ -230,7 +231,7 @@ export class UserListComponent extends RestTable implements OnInit {
230 protected reloadData () { 231 protected reloadData () {
231 this.selectedUsers = [] 232 this.selectedUsers = []
232 233
233 this.userService.getUsers({ 234 this.userAdminService.getUsers({
234 pagination: this.pagination, 235 pagination: this.pagination,
235 sort: this.sort, 236 sort: this.sort,
236 search: this.search 237 search: this.search