aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+accounts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-01-22 15:01:38 +0100
committerChocobozzz <me@florianbigard.com>2020-01-22 15:01:38 +0100
commitfef213cae10cbbf760b5ec81a1ed154038b59a61 (patch)
tree94ec1db206d56bd4a474f55bef02a39cba617880 /client/src/app/+accounts
parent0736b2735f3dcbaa17304fa229f0973e70f763b8 (diff)
downloadPeerTube-fef213cae10cbbf760b5ec81a1ed154038b59a61.tar.gz
PeerTube-fef213cae10cbbf760b5ec81a1ed154038b59a61.tar.zst
PeerTube-fef213cae10cbbf760b5ec81a1ed154038b59a61.zip
Fix is managaeble for channels
Diffstat (limited to 'client/src/app/+accounts')
-rw-r--r--client/src/app/+accounts/accounts.component.ts64
1 files changed, 34 insertions, 30 deletions
diff --git a/client/src/app/+accounts/accounts.component.ts b/client/src/app/+accounts/accounts.component.ts
index b06ecfe0e..ad611f221 100644
--- a/client/src/app/+accounts/accounts.component.ts
+++ b/client/src/app/+accounts/accounts.component.ts
@@ -35,34 +35,41 @@ export class AccountsComponent implements OnInit, OnDestroy {
35 private redirectService: RedirectService, 35 private redirectService: RedirectService,
36 private authService: AuthService, 36 private authService: AuthService,
37 private i18n: I18n 37 private i18n: I18n
38 ) {} 38 ) {
39 }
39 40
40 ngOnInit () { 41 ngOnInit () {
41 this.routeSub = this.route.params 42 this.routeSub = this.route.params
42 .pipe( 43 .pipe(
43 map(params => params[ 'accountId' ]), 44 map(params => params[ 'accountId' ]),
44 distinctUntilChanged(), 45 distinctUntilChanged(),
45 switchMap(accountId => this.accountService.getAccount(accountId)), 46 switchMap(accountId => this.accountService.getAccount(accountId)),
46 tap(account => { 47 tap(account => {
47 this.account = account 48 this.account = account
48 49
49 this.isAccountManageable = this.account.userId && this.account.userId === this.authService.getUser().id 50 if (this.authService.isLoggedIn()) {
50 51 this.authService.userInformationLoaded.subscribe(
51 this.accountFollowerTitle = this.i18n( 52 () => {
52 '{{followers}} direct account followers', 53 this.isAccountManageable = this.account.userId && this.account.userId === this.authService.getUser().id
53 { followers: this.subscribersDisplayFor(account.followersCount) } 54
54 ) 55 this.accountFollowerTitle = this.i18n(
55 56 '{{followers}} direct account followers',
56 this.getUserIfNeeded(account) 57 { followers: this.subscribersDisplayFor(account.followersCount) }
57 }), 58 )
58 switchMap(account => this.videoChannelService.listAccountVideoChannels(account)), 59 }
59 catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 404 ])) 60 )
60 ) 61 }
61 .subscribe( 62
62 videoChannels => this.videoChannels = videoChannels.data, 63 this.getUserIfNeeded(account)
63 64 }),
64 err => this.notifier.error(err.message) 65 switchMap(account => this.videoChannelService.listAccountVideoChannels(account)),
65 ) 66 catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 404 ]))
67 )
68 .subscribe(
69 videoChannels => this.videoChannels = videoChannels.data,
70
71 err => this.notifier.error(err.message)
72 )
66 } 73 }
67 74
68 ngOnDestroy () { 75 ngOnDestroy () {
@@ -97,11 +104,8 @@ export class AccountsComponent implements OnInit, OnDestroy {
97 104
98 const user = this.authService.getUser() 105 const user = this.authService.getUser()
99 if (user.hasRight(UserRight.MANAGE_USERS)) { 106 if (user.hasRight(UserRight.MANAGE_USERS)) {
100 forkJoin([ 107 this.userService.getUser(account.userId).subscribe(
101 this.userService.getUser(account.userId), 108 accountUser => this.accountUser = accountUser,
102 this.authService.userInformationLoaded.pipe(first())
103 ]).subscribe(
104 ([ accountUser ]) => this.accountUser = accountUser,
105 109
106 err => this.notifier.error(err.message) 110 err => this.notifier.error(err.message)
107 ) 111 )