X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=client%2Fsrc%2Fapp%2Fcore%2Fusers%2Fuser.service.ts;h=be9e66c3c705f091371ab48375124b16c6f7d332;hb=bf80903fde923e0c84226ac442a2a382db74aee4;hp=3de83152c32d992e0763ad681718815dcea1b9cc;hpb=dc48fdbe68e9dd3a3a6028181e61d8595d98e654;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/core/users/user.service.ts b/client/src/app/core/users/user.service.ts index 3de83152c..be9e66c3c 100644 --- a/client/src/app/core/users/user.service.ts +++ b/client/src/app/core/users/user.service.ts @@ -1,6 +1,6 @@ import { SortMeta } from 'primeng/api' import { from, Observable, of } from 'rxjs' -import { catchError, concatMap, filter, first, map, shareReplay, throttleTime, toArray } from 'rxjs/operators' +import { catchError, concatMap, filter, first, map, shareReplay, tap, throttleTime, toArray } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' import { AuthService } from '@app/core/auth' @@ -28,6 +28,8 @@ export class UserService { private userCache: { [ id: number ]: Observable } = {} + private signupInThisSession = false + constructor ( private authHttp: HttpClient, private authService: AuthService, @@ -35,7 +37,11 @@ export class UserService { private restService: RestService, private localStorageService: LocalStorageService, private sessionStorageService: SessionStorageService - ) { } + ) { } + + hasSignupInThisSession () { + return this.signupInThisSession + } changePassword (currentPassword: string, newPassword: string) { const url = UserService.BASE_USERS_URL + 'me' @@ -153,6 +159,7 @@ export class UserService { return this.authHttp.post(UserService.BASE_USERS_URL + 'register', userCreate) .pipe( map(this.restExtractor.extractDataBool), + tap(() => this.signupInThisSession = true), catchError(err => this.restExtractor.handleError(err)) ) } @@ -266,7 +273,7 @@ export class UserService { getUserWithCache (userId: number) { if (!this.userCache[userId]) { - this.userCache[ userId ] = this.getUser(userId).pipe(shareReplay()) + this.userCache[userId] = this.getUser(userId).pipe(shareReplay()) } return this.userCache[userId] @@ -320,13 +327,7 @@ export class UserService { const filters = this.restService.parseQueryStringFilter(search, { blocked: { prefix: 'banned:', - isBoolean: true, - handler: v => { - if (v === 'true') return v - if (v === 'false') return v - - return undefined - } + isBoolean: true } })