diff options
author | Chocobozzz <me@florianbigard.com> | 2020-01-23 14:23:19 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-01-23 14:59:44 +0100 |
commit | 44d4ee4fcb7cf8beebac73f85693c09919b91e66 (patch) | |
tree | 24b9867f2e0a5480cda3653ba00702779913fc88 /client/src/app/shared/user-subscription | |
parent | 89566f77fd938cf8b0a617d5d2df4ca718242372 (diff) | |
download | PeerTube-44d4ee4fcb7cf8beebac73f85693c09919b91e66.tar.gz PeerTube-44d4ee4fcb7cf8beebac73f85693c09919b91e66.tar.zst PeerTube-44d4ee4fcb7cf8beebac73f85693c09919b91e66.zip |
Fix e2e tests
Diffstat (limited to 'client/src/app/shared/user-subscription')
-rw-r--r-- | client/src/app/shared/user-subscription/user-subscription.service.ts | 14 |
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 @@ | |||
1 | import { bufferTime, catchError, filter, map, tap, share, switchMap } from 'rxjs/operators' | 1 | import { bufferTime, catchError, filter, map, observeOn, share, switchMap, tap } from 'rxjs/operators' |
2 | import { Observable, ReplaySubject, Subject, of, merge } from 'rxjs' | 2 | import { asyncScheduler, merge, Observable, of, ReplaySubject, Subject } from 'rxjs' |
3 | import { HttpClient, HttpParams } from '@angular/common/http' | 3 | import { HttpClient, HttpParams } from '@angular/common/http' |
4 | import { Injectable } from '@angular/core' | 4 | import { Injectable, NgZone } from '@angular/core' |
5 | import { ResultList } from '../../../../../shared' | 5 | import { ResultList } from '../../../../../shared' |
6 | import { environment } from '../../../environments/environment' | 6 | import { environment } from '../../../environments/environment' |
7 | import { RestExtractor, RestService } from '../rest' | 7 | import { RestExtractor, RestService } from '../rest' |
@@ -11,6 +11,7 @@ import { VideoChannel as VideoChannelServer } from '../../../../../shared/models | |||
11 | import { ComponentPaginationLight } from '@app/shared/rest/component-pagination.model' | 11 | import { ComponentPaginationLight } from '@app/shared/rest/component-pagination.model' |
12 | import { uniq } from 'lodash-es' | 12 | import { uniq } from 'lodash-es' |
13 | import * as debug from 'debug' | 13 | import * as debug from 'debug' |
14 | import { enterZone, leaveZone } from '@app/shared/rxjs/zone' | ||
14 | 15 | ||
15 | const logger = debug('peertube:subscriptions:UserSubscriptionService') | 16 | const 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 | ), |