X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2F%2Bvideos%2F%2Bvideo-watch%2Fshared%2Finformation%2Fprivacy-concerns.component.ts;h=24030df3e492bcae305e7de9b7aa22a98333266d;hb=a9bfa85d2cdf13670aaced740da5b493fbeddfce;hp=bbc81d46d8f4a3b2890c067c62426c05a423c0b5;hpb=c77fdc605b3ccc1ab6890f889d8200fbe9372949;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts b/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts index bbc81d46d..24030df3e 100644 --- a/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts +++ b/client/src/app/+videos/+video-watch/shared/information/privacy-concerns.component.ts @@ -1,9 +1,8 @@ import { Component, Input, OnInit } from '@angular/core' -import { ServerService } from '@app/core' +import { ServerService, User, UserService } from '@app/core' import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage' import { HTMLServerConfig, Video } from '@shared/models' -import { getStoredP2PEnabled } from '../../../../../assets/player/peertube-player-local-storage' -import { isWebRTCDisabled } from '../../../../../assets/player/utils' +import { isP2PEnabled } from '../../../../../assets/player/utils' @Component({ selector: 'my-privacy-concerns', @@ -15,33 +14,32 @@ export class PrivacyConcernsComponent implements OnInit { @Input() video: Video - display = true + display = false private serverConfig: HTMLServerConfig constructor ( - private serverService: ServerService + private serverService: ServerService, + private userService: UserService ) { } ngOnInit () { this.serverConfig = this.serverService.getHTMLConfig() - if (isWebRTCDisabled() || this.isTrackerDisabled() || this.isP2PDisabled() || this.alreadyAccepted()) { - this.display = false - } + this.userService.getAnonymousOrLoggedUser() + .subscribe(user => this.updateDisplay(user)) } acceptedPrivacyConcern () { peertubeLocalStorage.setItem(PrivacyConcernsComponent.LOCAL_STORAGE_PRIVACY_CONCERN_KEY, 'true') - this.display = false - } - private isTrackerDisabled () { - return this.video.isLocal && this.serverConfig.tracker.enabled === false + this.display = false } - private isP2PDisabled () { - return getStoredP2PEnabled() === false + private updateDisplay (user: User) { + if (isP2PEnabled(this.video, this.serverConfig, user.p2pEnabled) && !this.alreadyAccepted()) { + this.display = true + } } private alreadyAccepted () {