]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/instance/instance-features-table.component.ts
Merge branch 'release/1.4.0' into develop
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / instance / instance-features-table.component.ts
index aaf0a696014da22fa458c6c01f93feb8191772d8..46df4d0b29d1228f8b846a2ab06bbe8f21fb80e4 100644 (file)
@@ -1,6 +1,7 @@
 import { Component, OnInit } from '@angular/core'
 import { ServerService } from '@app/core'
 import { I18n } from '@ngx-translate/i18n-polyfill'
+import { ServerConfig } from '@shared/models'
 
 @Component({
   selector: 'my-instance-features-table',
@@ -8,8 +9,8 @@ import { I18n } from '@ngx-translate/i18n-polyfill'
   styleUrls: [ './instance-features-table.component.scss' ]
 })
 export class InstanceFeaturesTableComponent implements OnInit {
-  features: { label: string, value?: boolean }[] = []
   quotaHelpIndication = ''
+  config: ServerConfig
 
   constructor (
     private i18n: I18n,
@@ -22,38 +23,23 @@ export class InstanceFeaturesTableComponent implements OnInit {
   }
 
   get dailyUserVideoQuota () {
-    return this.serverService.getConfig().user.videoQuotaDaily
+    return Math.min(this.initialUserVideoQuota, this.serverService.getConfig().user.videoQuotaDaily)
   }
 
   ngOnInit () {
     this.serverService.configLoaded
         .subscribe(() => {
-          this.buildFeatures()
+          this.config = this.serverService.getConfig()
           this.buildQuotaHelpIndication()
         })
   }
 
-  private buildFeatures () {
-    const config = this.serverService.getConfig()
+  buildNSFWLabel () {
+    const policy = this.serverService.getConfig().instance.defaultNSFWPolicy
 
-    this.features = [
-      {
-        label: this.i18n('User registration allowed'),
-        value: config.signup.allowed
-      },
-      {
-        label: this.i18n('Transcode your videos in multiple resolutions'),
-        value: config.transcoding.enabledResolutions.length !== 0
-      },
-      {
-        label: this.i18n('HTTP import (YouTube, Vimeo, direct URL...)'),
-        value: config.import.videos.http.enabled
-      },
-      {
-        label: this.i18n('Torrent import'),
-        value: config.import.videos.torrent.enabled
-      }
-    ]
+    if (policy === 'do_not_list') return this.i18n('Hidden')
+    if (policy === 'blur') return this.i18n('Blurred with confirmation request')
+    if (policy === 'display') return this.i18n('Displayed')
   }
 
   private getApproximateTime (seconds: number) {
@@ -87,5 +73,4 @@ export class InstanceFeaturesTableComponent implements OnInit {
 
     this.quotaHelpIndication = lines.join('<br />')
   }
-
 }