aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-08-27 09:26:45 +0200
committerChocobozzz <me@florianbigard.com>2021-08-27 09:26:45 +0200
commitbf80903fde923e0c84226ac442a2a382db74aee4 (patch)
treeeec79c6dc03c131695aa73a7b3eed3a8cb6bbc6c /client/src
parente111a5a3a11a5b251b8989cd406c2dbba9254e28 (diff)
downloadPeerTube-bf80903fde923e0c84226ac442a2a382db74aee4.tar.gz
PeerTube-bf80903fde923e0c84226ac442a2a382db74aee4.tar.zst
PeerTube-bf80903fde923e0c84226ac442a2a382db74aee4.zip
Don't display account setup modal on signup
Don't bother user with a modal just after signup
Diffstat (limited to 'client/src')
-rw-r--r--client/src/app/core/users/user.service.ts9
-rw-r--r--client/src/app/modal/account-setup-modal.component.ts10
2 files changed, 14 insertions, 5 deletions
diff --git a/client/src/app/core/users/user.service.ts b/client/src/app/core/users/user.service.ts
index a8a774eca..be9e66c3c 100644
--- a/client/src/app/core/users/user.service.ts
+++ b/client/src/app/core/users/user.service.ts
@@ -1,6 +1,6 @@
1import { SortMeta } from 'primeng/api' 1import { SortMeta } from 'primeng/api'
2import { from, Observable, of } from 'rxjs' 2import { from, Observable, of } from 'rxjs'
3import { catchError, concatMap, filter, first, map, shareReplay, throttleTime, toArray } from 'rxjs/operators' 3import { catchError, concatMap, filter, first, map, shareReplay, tap, throttleTime, toArray } from 'rxjs/operators'
4import { HttpClient, HttpParams } from '@angular/common/http' 4import { HttpClient, HttpParams } from '@angular/common/http'
5import { Injectable } from '@angular/core' 5import { Injectable } from '@angular/core'
6import { AuthService } from '@app/core/auth' 6import { AuthService } from '@app/core/auth'
@@ -28,6 +28,8 @@ export class UserService {
28 28
29 private userCache: { [ id: number ]: Observable<UserServerModel> } = {} 29 private userCache: { [ id: number ]: Observable<UserServerModel> } = {}
30 30
31 private signupInThisSession = false
32
31 constructor ( 33 constructor (
32 private authHttp: HttpClient, 34 private authHttp: HttpClient,
33 private authService: AuthService, 35 private authService: AuthService,
@@ -37,6 +39,10 @@ export class UserService {
37 private sessionStorageService: SessionStorageService 39 private sessionStorageService: SessionStorageService
38 ) { } 40 ) { }
39 41
42 hasSignupInThisSession () {
43 return this.signupInThisSession
44 }
45
40 changePassword (currentPassword: string, newPassword: string) { 46 changePassword (currentPassword: string, newPassword: string) {
41 const url = UserService.BASE_USERS_URL + 'me' 47 const url = UserService.BASE_USERS_URL + 'me'
42 const body: UserUpdateMe = { 48 const body: UserUpdateMe = {
@@ -153,6 +159,7 @@ export class UserService {
153 return this.authHttp.post(UserService.BASE_USERS_URL + 'register', userCreate) 159 return this.authHttp.post(UserService.BASE_USERS_URL + 'register', userCreate)
154 .pipe( 160 .pipe(
155 map(this.restExtractor.extractDataBool), 161 map(this.restExtractor.extractDataBool),
162 tap(() => this.signupInThisSession = true),
156 catchError(err => this.restExtractor.handleError(err)) 163 catchError(err => this.restExtractor.handleError(err))
157 ) 164 )
158 } 165 }
diff --git a/client/src/app/modal/account-setup-modal.component.ts b/client/src/app/modal/account-setup-modal.component.ts
index e5d36e006..8256f5103 100644
--- a/client/src/app/modal/account-setup-modal.component.ts
+++ b/client/src/app/modal/account-setup-modal.component.ts
@@ -1,5 +1,5 @@
1import { Component, ElementRef, OnInit, ViewChild } from '@angular/core' 1import { Component, ElementRef, OnInit, ViewChild } from '@angular/core'
2import { AuthService, ServerService, User } from '@app/core' 2import { AuthService, ServerService, User, UserService } from '@app/core'
3import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap' 3import { NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap'
4import { HTMLServerConfig } from '@shared/models' 4import { HTMLServerConfig } from '@shared/models'
5 5
@@ -17,6 +17,7 @@ export class AccountSetupModalComponent implements OnInit {
17 private serverConfig: HTMLServerConfig 17 private serverConfig: HTMLServerConfig
18 18
19 constructor ( 19 constructor (
20 private userService: UserService,
20 private authService: AuthService, 21 private authService: AuthService,
21 private modalService: NgbModal, 22 private modalService: NgbModal,
22 private serverService: ServerService 23 private serverService: ServerService
@@ -49,8 +50,9 @@ export class AccountSetupModalComponent implements OnInit {
49 this.authService.userInformationLoaded 50 this.authService.userInformationLoaded
50 .subscribe( 51 .subscribe(
51 () => { 52 () => {
52 if (this.isUserRoot) return false 53 if (this.isUserRoot) return
53 if (this.hasAccountAvatar && this.hasAccountDescription) return false 54 if (this.hasAccountAvatar && this.hasAccountDescription) return
55 if (this.userService.hasSignupInThisSession()) return
54 56
55 this.show() 57 this.show()
56 } 58 }
@@ -58,7 +60,7 @@ export class AccountSetupModalComponent implements OnInit {
58 } 60 }
59 61
60 show () { 62 show () {
61 if (this.ref) return false 63 if (this.ref) return
62 64
63 this.ref = this.modalService.open(this.modal, { 65 this.ref = this.modalService.open(this.modal, {
64 centered: true, 66 centered: true,