aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/user-subscription
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/user-subscription')
-rw-r--r--client/src/app/shared/user-subscription/user-subscription.service.ts14
1 files changed, 9 insertions, 5 deletions
diff --git a/client/src/app/shared/user-subscription/user-subscription.service.ts b/client/src/app/shared/user-subscription/user-subscription.service.ts
index bfb5848bc..9af9ba23e 100644
--- a/client/src/app/shared/user-subscription/user-subscription.service.ts
+++ b/client/src/app/shared/user-subscription/user-subscription.service.ts
@@ -1,7 +1,7 @@
1import { bufferTime, catchError, filter, map, tap, share, switchMap } from 'rxjs/operators' 1import { bufferTime, catchError, filter, map, observeOn, share, switchMap, tap } from 'rxjs/operators'
2import { Observable, ReplaySubject, Subject, of, merge } from 'rxjs' 2import { asyncScheduler, merge, Observable, of, ReplaySubject, Subject } from 'rxjs'
3import { HttpClient, HttpParams } from '@angular/common/http' 3import { HttpClient, HttpParams } from '@angular/common/http'
4import { Injectable } from '@angular/core' 4import { Injectable, NgZone } from '@angular/core'
5import { ResultList } from '../../../../../shared' 5import { ResultList } from '../../../../../shared'
6import { environment } from '../../../environments/environment' 6import { environment } from '../../../environments/environment'
7import { RestExtractor, RestService } from '../rest' 7import { RestExtractor, RestService } from '../rest'
@@ -11,6 +11,7 @@ import { VideoChannel as VideoChannelServer } from '../../../../../shared/models
11import { ComponentPaginationLight } from '@app/shared/rest/component-pagination.model' 11import { ComponentPaginationLight } from '@app/shared/rest/component-pagination.model'
12import { uniq } from 'lodash-es' 12import { uniq } from 'lodash-es'
13import * as debug from 'debug' 13import * as debug from 'debug'
14import { enterZone, leaveZone } from '@app/shared/rxjs/zone'
14 15
15const logger = debug('peertube:subscriptions:UserSubscriptionService') 16const logger = debug('peertube:subscriptions:UserSubscriptionService')
16 17
@@ -32,13 +33,16 @@ export class UserSubscriptionService {
32 constructor ( 33 constructor (
33 private authHttp: HttpClient, 34 private authHttp: HttpClient,
34 private restExtractor: RestExtractor, 35 private restExtractor: RestExtractor,
35 private restService: RestService 36 private restService: RestService,
37 private ngZone: NgZone
36 ) { 38 ) {
37 this.existsObservable = merge( 39 this.existsObservable = merge(
38 this.existsSubject.pipe( 40 this.existsSubject.pipe(
39 bufferTime(500), 41 // We leave Angular zone so Protractor does not get stuck
42 bufferTime(500, leaveZone(this.ngZone, asyncScheduler)),
40 filter(uris => uris.length !== 0), 43 filter(uris => uris.length !== 0),
41 map(uris => uniq(uris)), 44 map(uris => uniq(uris)),
45 observeOn(enterZone(this.ngZone, asyncScheduler)),
42 switchMap(uris => this.doSubscriptionsExist(uris)), 46 switchMap(uris => this.doSubscriptionsExist(uris)),
43 share() 47 share()
44 ), 48 ),