aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/+video-channels
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/+video-channels
parent0736b2735f3dcbaa17304fa229f0973e70f763b8 (diff)
downloadPeerTube-fef213cae10cbbf760b5ec81a1ed154038b59a61.tar.gz
PeerTube-fef213cae10cbbf760b5ec81a1ed154038b59a61.tar.zst
PeerTube-fef213cae10cbbf760b5ec81a1ed154038b59a61.zip
Fix is managaeble for channels
Diffstat (limited to 'client/src/app/+video-channels')
-rw-r--r--client/src/app/+video-channels/video-channels.component.html2
-rw-r--r--client/src/app/+video-channels/video-channels.component.ts15
2 files changed, 14 insertions, 3 deletions
diff --git a/client/src/app/+video-channels/video-channels.component.html b/client/src/app/+video-channels/video-channels.component.html
index 065fc2c04..f0bb083ca 100644
--- a/client/src/app/+video-channels/video-channels.component.html
+++ b/client/src/app/+video-channels/video-channels.component.html
@@ -16,7 +16,7 @@
16 </div> 16 </div>
17 17
18 <div class="right-buttons"> 18 <div class="right-buttons">
19 <a *ngIf="isManageable" [routerLink]="[ '/my-account/video-channels/update', videoChannel.nameWithHost ]" class="btn btn-outline-tertiary mr-2" i18n>Manage</a> 19 <a *ngIf="isChannelManageable" [routerLink]="[ '/my-account/video-channels/update', videoChannel.nameWithHost ]" class="btn btn-outline-tertiary mr-2" i18n>Manage</a>
20 <my-subscribe-button #subscribeButton [videoChannels]="[videoChannel]"></my-subscribe-button> 20 <my-subscribe-button #subscribeButton [videoChannels]="[videoChannel]"></my-subscribe-button>
21 </div> 21 </div>
22 </div> 22 </div>
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'
3import { VideoChannel } from '@app/shared/video-channel/video-channel.model' 3import { VideoChannel } from '@app/shared/video-channel/video-channel.model'
4import { VideoChannelService } from '@app/shared/video-channel/video-channel.service' 4import { VideoChannelService } from '@app/shared/video-channel/video-channel.service'
5import { RestExtractor } from '@app/shared' 5import { RestExtractor } from '@app/shared'
6import { catchError, distinctUntilChanged, map, switchMap } from 'rxjs/operators' 6import { catchError, distinctUntilChanged, map, switchMap, tap } from 'rxjs/operators'
7import { Subscription } from 'rxjs' 7import { Subscription } from 'rxjs'
8import { AuthService, Notifier } from '@app/core' 8import { AuthService, Notifier } from '@app/core'
9import { Hotkey, HotkeysService } from 'angular2-hotkeys' 9import { 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 => {