ActivityPub-federated video streaming platform using P2P directly in your web browser
Fix ngx loading bar deprecation
Chocobozzz9744bb2ae828
diff --git a/client/src/app/shared/shared-main/users/user-notification.service.ts b/client/src/app/shared/shared-main/users/user-notification.service.tsindex e27dab21aa..e90bb0f1fa 100644--- a/client/src/app/shared/shared-main/users/user-notification.service.ts+++ b/client/src/app/shared/shared-main/users/user-notification.service.ts@@ -1,8 +1,9 @@import { SortMeta } from 'primeng/api'import { catchError, map, tap } from 'rxjs/operators'-import { HttpClient, HttpParams } from '@angular/common/http'+import { HttpClient, HttpContext, HttpParams } from '@angular/common/http'import { Injectable } from '@angular/core'import { AuthService, ComponentPaginationLight, PeerTubeSocket, RestExtractor, RestService } from '@app/core'+import { NGX_LOADING_BAR_IGNORED } from '@ngx-loading-bar/http-client'import { ResultList, UserNotification as UserNotificationServer, UserNotificationSetting } from '@shared/models'import { environment } from '../../../../environments/environment'import { UserNotification } from './user-notification.model'@@ -33,9 +34,11 @@ export class UserNotificationService {if (unread) params = params.append('unread', `${unread}`)- const headers = ignoreLoadingBar ? { ignoreLoadingBar: '' } : undefined+ const context = ignoreLoadingBar+ ? new HttpContext().set(NGX_LOADING_BAR_IGNORED, true)+ : undefined- return this.authHttp.get<ResultList<UserNotification>>(UserNotificationService.BASE_NOTIFICATIONS_URL, { params, headers })+ return this.authHttp.get<ResultList<UserNotification>>(UserNotificationService.BASE_NOTIFICATIONS_URL, { params, context }).pipe(map(res => this.restExtractor.convertResultListDateToHuman(res)),map(res => this.restExtractor.applyToResultListData(res, this.formatNotification.bind(this))),@@ -52,9 +55,9 @@ export class UserNotificationService {const url = UserNotificationService.BASE_NOTIFICATIONS_URL + '/read'const body = { ids: [ notification.id ] }- const headers = { ignoreLoadingBar: '' }+ const context = new HttpContext().set(NGX_LOADING_BAR_IGNORED, true)- return this.authHttp.post(url, body, { headers })+ return this.authHttp.post(url, body, { context }).pipe(map(this.restExtractor.extractDataBool),tap(() => this.peertubeSocket.dispatchNotificationEvent('read')),@@ -64,9 +67,9 @@ export class UserNotificationService {markAllAsRead () {const url = UserNotificationService.BASE_NOTIFICATIONS_URL + '/read-all'- const headers = { ignoreLoadingBar: '' }+ const context = new HttpContext().set(NGX_LOADING_BAR_IGNORED, true)- return this.authHttp.post(url, {}, { headers })+ return this.authHttp.post(url, {}, { context }).pipe(map(this.restExtractor.extractDataBool),tap(() => this.peertubeSocket.dispatchNotificationEvent('read-all')),diff --git a/client/src/app/shared/shared-video-playlist/video-playlist.service.ts b/client/src/app/shared/shared-video-playlist/video-playlist.service.tsindex 3faf81d11e..44d930b074 100644--- a/client/src/app/shared/shared-video-playlist/video-playlist.service.ts+++ b/client/src/app/shared/shared-video-playlist/video-playlist.service.ts@@ -1,11 +1,12 @@import * as debug from 'debug'import { merge, Observable, of, ReplaySubject, Subject } from 'rxjs'import { catchError, filter, map, share, switchMap, tap } from 'rxjs/operators'-import { HttpClient, HttpParams } from '@angular/common/http'+import { HttpClient, HttpContext, HttpParams } from '@angular/common/http'import { Injectable } from '@angular/core'import { AuthUser, ComponentPaginationLight, RestExtractor, RestService, ServerService } from '@app/core'import { buildBulkObservable, objectToFormData } from '@app/helpers'import { Account, AccountService, VideoChannel, VideoChannelService } from '@app/shared/shared-main'+import { NGX_LOADING_BAR_IGNORED } from '@ngx-loading-bar/http-client'import {ResultList,VideoExistInPlaylist,@@ -350,7 +351,7 @@ export class VideoPlaylistService {let params = new HttpParams()params = this.restService.addObjectParams(params, { videoIds })- return this.authHttp.get<VideoExistInPlaylist>(url, { params, headers: { ignoreLoadingBar: '' } })+ return this.authHttp.get<VideoExistInPlaylist>(url, { params, context: new HttpContext().set(NGX_LOADING_BAR_IGNORED, true) }).pipe(catchError(err => this.restExtractor.handleError(err)))}}