]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/modal/instance-config-warning-modal.component.ts
Don't display account setup modal on signup
[github/Chocobozzz/PeerTube.git] / client / src / app / modal / instance-config-warning-modal.component.ts
index 5e1433548f767d85f6ad606277938ecf5c4ae16c..e4095897661805db231947fb66e4ffcdfe7a6f72 100644 (file)
@@ -1,8 +1,9 @@
+import { Location } from '@angular/common'
 import { Component, ElementRef, ViewChild } from '@angular/core'
-import { Notifier } from '@app/core'
+import { Notifier, UserService } from '@app/core'
 import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
+import { peertubeLocalStorage } from '@root-helpers/peertube-web-storage'
 import { About } from '@shared/models/server'
-import { UserService } from '@app/shared'
 
 @Component({
   selector: 'my-instance-config-warning-modal',
@@ -15,13 +16,23 @@ export class InstanceConfigWarningModalComponent {
   stopDisplayModal = false
   about: About
 
+  private LOCAL_STORAGE_KEYS = {
+    NO_INSTANCE_CONFIG_WARNING_MODAL: 'no_instance_config_warning_modal'
+  }
+
   constructor (
     private userService: UserService,
+    private location: Location,
     private modalService: NgbModal,
     private notifier: Notifier
   ) { }
 
   show (about: About) {
+    const result = peertubeLocalStorage.getItem(this.LOCAL_STORAGE_KEYS.NO_INSTANCE_CONFIG_WARNING_MODAL)
+    if (result === 'true') return
+
+    if (this.location.path().startsWith('/admin/config/edit-custom')) return
+
     this.about = about
 
     const ref = this.modalService.open(this.modal, { centered: true })
@@ -32,16 +43,17 @@ export class InstanceConfigWarningModalComponent {
   }
 
   isDefaultShortDescription (description: string) {
-    return description === 'PeerTube, a federated (ActivityPub) video streaming platform using P2P (BitTorrent) directly ' +
-      'in the web browser with WebTorrent and Angular.'
+    return description === 'PeerTube, an ActivityPub-federated video streaming platform using P2P directly in your web browser.'
   }
 
   private doNotOpenAgain () {
+    peertubeLocalStorage.setItem(this.LOCAL_STORAGE_KEYS.NO_INSTANCE_CONFIG_WARNING_MODAL, 'true')
+
     this.userService.updateMyProfile({ noInstanceConfigWarningModal: true })
-        .subscribe(
-          () => console.log('We will not open the instance config warning modal again.'),
+        .subscribe({
+          next: () => console.log('We will not open the instance config warning modal again.'),
 
-          err => this.notifier.error(err.message)
-        )
+          error: err => this.notifier.error(err.message)
+        })
   }
 }