From e8bffe9690307f2686ed5573cae2b86ee5f57789 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 18 Jan 2022 11:37:29 +0100 Subject: Remove unnecessary function --- .../shared-main/custom-page/custom-page.service.ts | 7 ++----- .../shared/shared-main/users/user-history.service.ts | 7 ++----- .../shared-main/users/user-notification.service.ts | 7 +------ .../video-caption/video-caption.service.ts | 12 +++--------- .../video-channel/video-channel.service.ts | 20 ++++---------------- .../shared/shared-main/video/redundancy.service.ts | 12 +++--------- .../shared-main/video/video-ownership.service.ts | 15 +++------------ .../app/shared/shared-main/video/video.service.ts | 10 ++-------- 8 files changed, 20 insertions(+), 70 deletions(-) (limited to 'client/src/app/shared/shared-main') diff --git a/client/src/app/shared/shared-main/custom-page/custom-page.service.ts b/client/src/app/shared/shared-main/custom-page/custom-page.service.ts index e5c2b3cd4..2914dd6d9 100644 --- a/client/src/app/shared/shared-main/custom-page/custom-page.service.ts +++ b/client/src/app/shared/shared-main/custom-page/custom-page.service.ts @@ -1,5 +1,5 @@ import { of } from 'rxjs' -import { catchError, map } from 'rxjs/operators' +import { catchError } from 'rxjs/operators' import { HttpClient } from '@angular/common/http' import { Injectable } from '@angular/core' import { RestExtractor } from '@app/core' @@ -30,9 +30,6 @@ export class CustomPageService { updateInstanceHomepage (content: string) { return this.authHttp.put(CustomPageService.BASE_INSTANCE_HOMEPAGE_URL, { content }) - .pipe( - map(this.restExtractor.extractDataBool), - catchError(err => this.restExtractor.handleError(err)) - ) + .pipe(catchError(err => this.restExtractor.handleError(err))) } } diff --git a/client/src/app/shared/shared-main/users/user-history.service.ts b/client/src/app/shared/shared-main/users/user-history.service.ts index 0cfb2d203..4cebbc707 100644 --- a/client/src/app/shared/shared-main/users/user-history.service.ts +++ b/client/src/app/shared/shared-main/users/user-history.service.ts @@ -1,4 +1,4 @@ -import { catchError, map, switchMap } from 'rxjs/operators' +import { catchError, switchMap } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' import { ComponentPaginationLight, RestExtractor, RestService } from '@app/core' @@ -43,9 +43,6 @@ export class UserHistoryService { clearAll () { return this.authHttp .post(UserHistoryService.BASE_USER_VIDEOS_HISTORY_URL + '/remove', {}) - .pipe( - map(() => this.restExtractor.extractDataBool()), - catchError(err => this.restExtractor.handleError(err)) - ) + .pipe(catchError(err => this.restExtractor.handleError(err))) } } 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.ts index e90bb0f1f..df886ed65 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 @@ -59,7 +59,6 @@ export class UserNotificationService { return this.authHttp.post(url, body, { context }) .pipe( - map(this.restExtractor.extractDataBool), tap(() => this.peertubeSocket.dispatchNotificationEvent('read')), catchError(res => this.restExtractor.handleError(res)) ) @@ -71,7 +70,6 @@ export class UserNotificationService { return this.authHttp.post(url, {}, { context }) .pipe( - map(this.restExtractor.extractDataBool), tap(() => this.peertubeSocket.dispatchNotificationEvent('read-all')), catchError(res => this.restExtractor.handleError(res)) ) @@ -81,10 +79,7 @@ export class UserNotificationService { const url = UserNotificationService.BASE_NOTIFICATION_SETTINGS return this.authHttp.put(url, settings) - .pipe( - map(this.restExtractor.extractDataBool), - catchError(res => this.restExtractor.handleError(res)) - ) + .pipe(catchError(res => this.restExtractor.handleError(res))) } private formatNotification (notification: UserNotificationServer) { diff --git a/client/src/app/shared/shared-main/video-caption/video-caption.service.ts b/client/src/app/shared/shared-main/video-caption/video-caption.service.ts index 29d6d0f4c..97b79d842 100644 --- a/client/src/app/shared/shared-main/video-caption/video-caption.service.ts +++ b/client/src/app/shared/shared-main/video-caption/video-caption.service.ts @@ -42,10 +42,7 @@ export class VideoCaptionService { removeCaption (videoId: number | string, language: string) { return this.authHttp.delete(`${VideoService.BASE_VIDEO_URL}/${videoId}/captions/${language}`) - .pipe( - map(this.restExtractor.extractDataBool), - catchError(res => this.restExtractor.handleError(res)) - ) + .pipe(catchError(res => this.restExtractor.handleError(res))) } addCaption (videoId: number | string, language: string, captionfile: File) { @@ -53,14 +50,11 @@ export class VideoCaptionService { const data = objectToFormData(body) return this.authHttp.put(`${VideoService.BASE_VIDEO_URL}/${videoId}/captions/${language}`, data) - .pipe( - map(this.restExtractor.extractDataBool), - catchError(res => this.restExtractor.handleError(res)) - ) + .pipe(catchError(res => this.restExtractor.handleError(res))) } updateCaptions (videoId: number | string, videoCaptions: VideoCaptionEdit[]) { - let obs = of(true) + let obs: Observable = of(undefined) for (const videoCaption of videoCaptions) { if (videoCaption.action === 'CREATE') { diff --git a/client/src/app/shared/shared-main/video-channel/video-channel.service.ts b/client/src/app/shared/shared-main/video-channel/video-channel.service.ts index dc00fabdc..f37f13c51 100644 --- a/client/src/app/shared/shared-main/video-channel/video-channel.service.ts +++ b/client/src/app/shared/shared-main/video-channel/video-channel.service.ts @@ -69,18 +69,12 @@ export class VideoChannelService { createVideoChannel (videoChannel: VideoChannelCreate) { return this.authHttp.post(VideoChannelService.BASE_VIDEO_CHANNEL_URL, videoChannel) - .pipe( - map(this.restExtractor.extractDataBool), - catchError(err => this.restExtractor.handleError(err)) - ) + .pipe(catchError(err => this.restExtractor.handleError(err))) } updateVideoChannel (videoChannelName: string, videoChannel: VideoChannelUpdate) { return this.authHttp.put(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelName, videoChannel) - .pipe( - map(this.restExtractor.extractDataBool), - catchError(err => this.restExtractor.handleError(err)) - ) + .pipe(catchError(err => this.restExtractor.handleError(err))) } changeVideoChannelImage (videoChannelName: string, avatarForm: FormData, type: 'avatar' | 'banner') { @@ -94,17 +88,11 @@ export class VideoChannelService { const url = VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelName + '/' + type return this.authHttp.delete(url) - .pipe( - map(this.restExtractor.extractDataBool), - catchError(err => this.restExtractor.handleError(err)) - ) + .pipe(catchError(err => this.restExtractor.handleError(err))) } removeVideoChannel (videoChannel: VideoChannel) { return this.authHttp.delete(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannel.nameWithHost) - .pipe( - map(this.restExtractor.extractDataBool), - catchError(err => this.restExtractor.handleError(err)) - ) + .pipe(catchError(err => this.restExtractor.handleError(err))) } } diff --git a/client/src/app/shared/shared-main/video/redundancy.service.ts b/client/src/app/shared/shared-main/video/redundancy.service.ts index 966d7fafd..4377d628a 100644 --- a/client/src/app/shared/shared-main/video/redundancy.service.ts +++ b/client/src/app/shared/shared-main/video/redundancy.service.ts @@ -1,6 +1,6 @@ import { SortMeta } from 'primeng/api' import { concat, Observable } from 'rxjs' -import { catchError, map, toArray } from 'rxjs/operators' +import { catchError, toArray } from 'rxjs/operators' import { HttpClient, HttpParams } from '@angular/common/http' import { Injectable } from '@angular/core' import { RestExtractor, RestPagination, RestService } from '@app/core' @@ -23,10 +23,7 @@ export class RedundancyService { const body = { redundancyAllowed } return this.authHttp.put(url, body) - .pipe( - map(this.restExtractor.extractDataBool), - catchError(err => this.restExtractor.handleError(err)) - ) + .pipe(catchError(err => this.restExtractor.handleError(err))) } listVideoRedundancies (options: { @@ -65,9 +62,6 @@ export class RedundancyService { private removeRedundancy (redundancyId: number) { return this.authHttp.delete(RedundancyService.BASE_REDUNDANCY_URL + '/videos/' + redundancyId) - .pipe( - map(this.restExtractor.extractDataBool), - catchError(res => this.restExtractor.handleError(res)) - ) + .pipe(catchError(res => this.restExtractor.handleError(res))) } } diff --git a/client/src/app/shared/shared-main/video/video-ownership.service.ts b/client/src/app/shared/shared-main/video/video-ownership.service.ts index 273930a6c..bc0e1b1d1 100644 --- a/client/src/app/shared/shared-main/video/video-ownership.service.ts +++ b/client/src/app/shared/shared-main/video/video-ownership.service.ts @@ -25,10 +25,7 @@ export class VideoOwnershipService { } return this.authHttp.post(url, body) - .pipe( - map(this.restExtractor.extractDataBool), - catchError(res => this.restExtractor.handleError(res)) - ) + .pipe(catchError(res => this.restExtractor.handleError(res))) } getOwnershipChanges (pagination: RestPagination, sort: SortMeta): Observable> { @@ -47,18 +44,12 @@ export class VideoOwnershipService { acceptOwnership (id: number, input: VideoChangeOwnershipAccept) { const url = VideoOwnershipService.BASE_VIDEO_CHANGE_OWNERSHIP_URL + 'ownership/' + id + '/accept' return this.authHttp.post(url, input) - .pipe( - map(this.restExtractor.extractDataBool), - catchError(this.restExtractor.handleError) - ) + .pipe(catchError(this.restExtractor.handleError)) } refuseOwnership (id: number) { const url = VideoOwnershipService.BASE_VIDEO_CHANGE_OWNERSHIP_URL + 'ownership/' + id + '/refuse' return this.authHttp.post(url, {}) - .pipe( - map(this.restExtractor.extractDataBool), - catchError(this.restExtractor.handleError) - ) + .pipe(catchError(this.restExtractor.handleError)) } } diff --git a/client/src/app/shared/shared-main/video/video.service.ts b/client/src/app/shared/shared-main/video/video.service.ts index 9bfa397f8..94af9cd38 100644 --- a/client/src/app/shared/shared-main/video/video.service.ts +++ b/client/src/app/shared/shared-main/video/video.service.ts @@ -114,10 +114,7 @@ export class VideoService { const data = objectToFormData(body) return this.authHttp.put(`${VideoService.BASE_VIDEO_URL}/${video.id}`, data) - .pipe( - map(this.restExtractor.extractDataBool), - catchError(err => this.restExtractor.handleError(err)) - ) + .pipe(catchError(err => this.restExtractor.handleError(err))) } uploadVideo (video: FormData) { @@ -449,9 +446,6 @@ export class VideoService { return this.authHttp .put(url, body) - .pipe( - map(this.restExtractor.extractDataBool), - catchError(err => this.restExtractor.handleError(err)) - ) + .pipe(catchError(err => this.restExtractor.handleError(err))) } } -- cgit v1.2.3