diff options
author | Chocobozzz <me@florianbigard.com> | 2020-01-22 15:01:38 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-01-22 15:01:38 +0100 |
commit | fef213cae10cbbf760b5ec81a1ed154038b59a61 (patch) | |
tree | 94ec1db206d56bd4a474f55bef02a39cba617880 /client/src/app/+video-channels/video-channels.component.ts | |
parent | 0736b2735f3dcbaa17304fa229f0973e70f763b8 (diff) | |
download | PeerTube-fef213cae10cbbf760b5ec81a1ed154038b59a61.tar.gz PeerTube-fef213cae10cbbf760b5ec81a1ed154038b59a61.tar.zst PeerTube-fef213cae10cbbf760b5ec81a1ed154038b59a61.zip |
Fix is managaeble for channels
Diffstat (limited to 'client/src/app/+video-channels/video-channels.component.ts')
-rw-r--r-- | client/src/app/+video-channels/video-channels.component.ts | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/client/src/app/+video-channels/video-channels.component.ts b/client/src/app/+video-channels/video-channels.component.ts index 493a6d499..7b335b13f 100644 --- a/client/src/app/+video-channels/video-channels.component.ts +++ b/client/src/app/+video-channels/video-channels.component.ts | |||
@@ -3,7 +3,7 @@ import { ActivatedRoute } from '@angular/router' | |||
3 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' | 3 | import { VideoChannel } from '@app/shared/video-channel/video-channel.model' |
4 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' | 4 | import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' |
5 | import { RestExtractor } from '@app/shared' | 5 | import { RestExtractor } from '@app/shared' |
6 | import { catchError, distinctUntilChanged, map, switchMap } from 'rxjs/operators' | 6 | import { catchError, distinctUntilChanged, map, switchMap, tap } from 'rxjs/operators' |
7 | import { Subscription } from 'rxjs' | 7 | import { Subscription } from 'rxjs' |
8 | import { AuthService, Notifier } from '@app/core' | 8 | import { AuthService, Notifier } from '@app/core' |
9 | import { Hotkey, HotkeysService } from 'angular2-hotkeys' | 9 | import { Hotkey, HotkeysService } from 'angular2-hotkeys' |
@@ -19,6 +19,7 @@ export class VideoChannelsComponent implements OnInit, OnDestroy { | |||
19 | 19 | ||
20 | videoChannel: VideoChannel | 20 | videoChannel: VideoChannel |
21 | hotkeys: Hotkey[] | 21 | hotkeys: Hotkey[] |
22 | isChannelManageable = false | ||
22 | 23 | ||
23 | private routeSub: Subscription | 24 | private routeSub: Subscription |
24 | 25 | ||
@@ -40,7 +41,17 @@ export class VideoChannelsComponent implements OnInit, OnDestroy { | |||
40 | switchMap(videoChannelName => this.videoChannelService.getVideoChannel(videoChannelName)), | 41 | switchMap(videoChannelName => this.videoChannelService.getVideoChannel(videoChannelName)), |
41 | catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 404 ])) | 42 | catchError(err => this.restExtractor.redirectTo404IfNotFound(err, [ 400, 404 ])) |
42 | ) | 43 | ) |
43 | .subscribe(videoChannel => this.videoChannel = videoChannel) | 44 | .subscribe(videoChannel => { |
45 | this.videoChannel = videoChannel | ||
46 | |||
47 | if (this.authService.isLoggedIn()) { | ||
48 | this.authService.userInformationLoaded | ||
49 | .subscribe(() => { | ||
50 | const channelUserId = this.videoChannel.ownerAccount.userId | ||
51 | this.isChannelManageable = channelUserId && channelUserId === this.authService.getUser().id | ||
52 | }) | ||
53 | } | ||
54 | }) | ||
44 | 55 | ||
45 | this.hotkeys = [ | 56 | this.hotkeys = [ |
46 | new Hotkey('S', (event: KeyboardEvent): boolean => { | 57 | new Hotkey('S', (event: KeyboardEvent): boolean => { |