aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-main
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-01-18 11:37:29 +0100
committerChocobozzz <me@florianbigard.com>2022-01-18 11:37:29 +0100
commite8bffe9690307f2686ed5573cae2b86ee5f57789 (patch)
treee6268124e5e9c22eb465d94ad638ed8443bc9743 /client/src/app/shared/shared-main
parentc1f7a737cfe174ff1648f269a62540826d0e8089 (diff)
downloadPeerTube-e8bffe9690307f2686ed5573cae2b86ee5f57789.tar.gz
PeerTube-e8bffe9690307f2686ed5573cae2b86ee5f57789.tar.zst
PeerTube-e8bffe9690307f2686ed5573cae2b86ee5f57789.zip
Remove unnecessary function
Diffstat (limited to 'client/src/app/shared/shared-main')
-rw-r--r--client/src/app/shared/shared-main/custom-page/custom-page.service.ts7
-rw-r--r--client/src/app/shared/shared-main/users/user-history.service.ts7
-rw-r--r--client/src/app/shared/shared-main/users/user-notification.service.ts7
-rw-r--r--client/src/app/shared/shared-main/video-caption/video-caption.service.ts12
-rw-r--r--client/src/app/shared/shared-main/video-channel/video-channel.service.ts20
-rw-r--r--client/src/app/shared/shared-main/video/redundancy.service.ts12
-rw-r--r--client/src/app/shared/shared-main/video/video-ownership.service.ts15
-rw-r--r--client/src/app/shared/shared-main/video/video.service.ts10
8 files changed, 20 insertions, 70 deletions
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 @@
1import { of } from 'rxjs' 1import { of } from 'rxjs'
2import { catchError, map } from 'rxjs/operators' 2import { catchError } from 'rxjs/operators'
3import { HttpClient } from '@angular/common/http' 3import { HttpClient } from '@angular/common/http'
4import { Injectable } from '@angular/core' 4import { Injectable } from '@angular/core'
5import { RestExtractor } from '@app/core' 5import { RestExtractor } from '@app/core'
@@ -30,9 +30,6 @@ export class CustomPageService {
30 30
31 updateInstanceHomepage (content: string) { 31 updateInstanceHomepage (content: string) {
32 return this.authHttp.put(CustomPageService.BASE_INSTANCE_HOMEPAGE_URL, { content }) 32 return this.authHttp.put(CustomPageService.BASE_INSTANCE_HOMEPAGE_URL, { content })
33 .pipe( 33 .pipe(catchError(err => this.restExtractor.handleError(err)))
34 map(this.restExtractor.extractDataBool),
35 catchError(err => this.restExtractor.handleError(err))
36 )
37 } 34 }
38} 35}
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 @@
1import { catchError, map, switchMap } from 'rxjs/operators' 1import { catchError, switchMap } from 'rxjs/operators'
2import { HttpClient, HttpParams } from '@angular/common/http' 2import { HttpClient, HttpParams } from '@angular/common/http'
3import { Injectable } from '@angular/core' 3import { Injectable } from '@angular/core'
4import { ComponentPaginationLight, RestExtractor, RestService } from '@app/core' 4import { ComponentPaginationLight, RestExtractor, RestService } from '@app/core'
@@ -43,9 +43,6 @@ export class UserHistoryService {
43 clearAll () { 43 clearAll () {
44 return this.authHttp 44 return this.authHttp
45 .post(UserHistoryService.BASE_USER_VIDEOS_HISTORY_URL + '/remove', {}) 45 .post(UserHistoryService.BASE_USER_VIDEOS_HISTORY_URL + '/remove', {})
46 .pipe( 46 .pipe(catchError(err => this.restExtractor.handleError(err)))
47 map(() => this.restExtractor.extractDataBool()),
48 catchError(err => this.restExtractor.handleError(err))
49 )
50 } 47 }
51} 48}
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 {
59 59
60 return this.authHttp.post(url, body, { context }) 60 return this.authHttp.post(url, body, { context })
61 .pipe( 61 .pipe(
62 map(this.restExtractor.extractDataBool),
63 tap(() => this.peertubeSocket.dispatchNotificationEvent('read')), 62 tap(() => this.peertubeSocket.dispatchNotificationEvent('read')),
64 catchError(res => this.restExtractor.handleError(res)) 63 catchError(res => this.restExtractor.handleError(res))
65 ) 64 )
@@ -71,7 +70,6 @@ export class UserNotificationService {
71 70
72 return this.authHttp.post(url, {}, { context }) 71 return this.authHttp.post(url, {}, { context })
73 .pipe( 72 .pipe(
74 map(this.restExtractor.extractDataBool),
75 tap(() => this.peertubeSocket.dispatchNotificationEvent('read-all')), 73 tap(() => this.peertubeSocket.dispatchNotificationEvent('read-all')),
76 catchError(res => this.restExtractor.handleError(res)) 74 catchError(res => this.restExtractor.handleError(res))
77 ) 75 )
@@ -81,10 +79,7 @@ export class UserNotificationService {
81 const url = UserNotificationService.BASE_NOTIFICATION_SETTINGS 79 const url = UserNotificationService.BASE_NOTIFICATION_SETTINGS
82 80
83 return this.authHttp.put(url, settings) 81 return this.authHttp.put(url, settings)
84 .pipe( 82 .pipe(catchError(res => this.restExtractor.handleError(res)))
85 map(this.restExtractor.extractDataBool),
86 catchError(res => this.restExtractor.handleError(res))
87 )
88 } 83 }
89 84
90 private formatNotification (notification: UserNotificationServer) { 85 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 {
42 42
43 removeCaption (videoId: number | string, language: string) { 43 removeCaption (videoId: number | string, language: string) {
44 return this.authHttp.delete(`${VideoService.BASE_VIDEO_URL}/${videoId}/captions/${language}`) 44 return this.authHttp.delete(`${VideoService.BASE_VIDEO_URL}/${videoId}/captions/${language}`)
45 .pipe( 45 .pipe(catchError(res => this.restExtractor.handleError(res)))
46 map(this.restExtractor.extractDataBool),
47 catchError(res => this.restExtractor.handleError(res))
48 )
49 } 46 }
50 47
51 addCaption (videoId: number | string, language: string, captionfile: File) { 48 addCaption (videoId: number | string, language: string, captionfile: File) {
@@ -53,14 +50,11 @@ export class VideoCaptionService {
53 const data = objectToFormData(body) 50 const data = objectToFormData(body)
54 51
55 return this.authHttp.put(`${VideoService.BASE_VIDEO_URL}/${videoId}/captions/${language}`, data) 52 return this.authHttp.put(`${VideoService.BASE_VIDEO_URL}/${videoId}/captions/${language}`, data)
56 .pipe( 53 .pipe(catchError(res => this.restExtractor.handleError(res)))
57 map(this.restExtractor.extractDataBool),
58 catchError(res => this.restExtractor.handleError(res))
59 )
60 } 54 }
61 55
62 updateCaptions (videoId: number | string, videoCaptions: VideoCaptionEdit[]) { 56 updateCaptions (videoId: number | string, videoCaptions: VideoCaptionEdit[]) {
63 let obs = of(true) 57 let obs: Observable<any> = of(undefined)
64 58
65 for (const videoCaption of videoCaptions) { 59 for (const videoCaption of videoCaptions) {
66 if (videoCaption.action === 'CREATE') { 60 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 {
69 69
70 createVideoChannel (videoChannel: VideoChannelCreate) { 70 createVideoChannel (videoChannel: VideoChannelCreate) {
71 return this.authHttp.post(VideoChannelService.BASE_VIDEO_CHANNEL_URL, videoChannel) 71 return this.authHttp.post(VideoChannelService.BASE_VIDEO_CHANNEL_URL, videoChannel)
72 .pipe( 72 .pipe(catchError(err => this.restExtractor.handleError(err)))
73 map(this.restExtractor.extractDataBool),
74 catchError(err => this.restExtractor.handleError(err))
75 )
76 } 73 }
77 74
78 updateVideoChannel (videoChannelName: string, videoChannel: VideoChannelUpdate) { 75 updateVideoChannel (videoChannelName: string, videoChannel: VideoChannelUpdate) {
79 return this.authHttp.put(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelName, videoChannel) 76 return this.authHttp.put(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelName, videoChannel)
80 .pipe( 77 .pipe(catchError(err => this.restExtractor.handleError(err)))
81 map(this.restExtractor.extractDataBool),
82 catchError(err => this.restExtractor.handleError(err))
83 )
84 } 78 }
85 79
86 changeVideoChannelImage (videoChannelName: string, avatarForm: FormData, type: 'avatar' | 'banner') { 80 changeVideoChannelImage (videoChannelName: string, avatarForm: FormData, type: 'avatar' | 'banner') {
@@ -94,17 +88,11 @@ export class VideoChannelService {
94 const url = VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelName + '/' + type 88 const url = VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannelName + '/' + type
95 89
96 return this.authHttp.delete(url) 90 return this.authHttp.delete(url)
97 .pipe( 91 .pipe(catchError(err => this.restExtractor.handleError(err)))
98 map(this.restExtractor.extractDataBool),
99 catchError(err => this.restExtractor.handleError(err))
100 )
101 } 92 }
102 93
103 removeVideoChannel (videoChannel: VideoChannel) { 94 removeVideoChannel (videoChannel: VideoChannel) {
104 return this.authHttp.delete(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannel.nameWithHost) 95 return this.authHttp.delete(VideoChannelService.BASE_VIDEO_CHANNEL_URL + videoChannel.nameWithHost)
105 .pipe( 96 .pipe(catchError(err => this.restExtractor.handleError(err)))
106 map(this.restExtractor.extractDataBool),
107 catchError(err => this.restExtractor.handleError(err))
108 )
109 } 97 }
110} 98}
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 @@
1import { SortMeta } from 'primeng/api' 1import { SortMeta } from 'primeng/api'
2import { concat, Observable } from 'rxjs' 2import { concat, Observable } from 'rxjs'
3import { catchError, map, toArray } from 'rxjs/operators' 3import { catchError, toArray } from 'rxjs/operators'
4import { HttpClient, HttpParams } from '@angular/common/http' 4import { HttpClient, HttpParams } from '@angular/common/http'
5import { Injectable } from '@angular/core' 5import { Injectable } from '@angular/core'
6import { RestExtractor, RestPagination, RestService } from '@app/core' 6import { RestExtractor, RestPagination, RestService } from '@app/core'
@@ -23,10 +23,7 @@ export class RedundancyService {
23 const body = { redundancyAllowed } 23 const body = { redundancyAllowed }
24 24
25 return this.authHttp.put(url, body) 25 return this.authHttp.put(url, body)
26 .pipe( 26 .pipe(catchError(err => this.restExtractor.handleError(err)))
27 map(this.restExtractor.extractDataBool),
28 catchError(err => this.restExtractor.handleError(err))
29 )
30 } 27 }
31 28
32 listVideoRedundancies (options: { 29 listVideoRedundancies (options: {
@@ -65,9 +62,6 @@ export class RedundancyService {
65 62
66 private removeRedundancy (redundancyId: number) { 63 private removeRedundancy (redundancyId: number) {
67 return this.authHttp.delete(RedundancyService.BASE_REDUNDANCY_URL + '/videos/' + redundancyId) 64 return this.authHttp.delete(RedundancyService.BASE_REDUNDANCY_URL + '/videos/' + redundancyId)
68 .pipe( 65 .pipe(catchError(res => this.restExtractor.handleError(res)))
69 map(this.restExtractor.extractDataBool),
70 catchError(res => this.restExtractor.handleError(res))
71 )
72 } 66 }
73} 67}
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 {
25 } 25 }
26 26
27 return this.authHttp.post(url, body) 27 return this.authHttp.post(url, body)
28 .pipe( 28 .pipe(catchError(res => this.restExtractor.handleError(res)))
29 map(this.restExtractor.extractDataBool),
30 catchError(res => this.restExtractor.handleError(res))
31 )
32 } 29 }
33 30
34 getOwnershipChanges (pagination: RestPagination, sort: SortMeta): Observable<ResultList<VideoChangeOwnership>> { 31 getOwnershipChanges (pagination: RestPagination, sort: SortMeta): Observable<ResultList<VideoChangeOwnership>> {
@@ -47,18 +44,12 @@ export class VideoOwnershipService {
47 acceptOwnership (id: number, input: VideoChangeOwnershipAccept) { 44 acceptOwnership (id: number, input: VideoChangeOwnershipAccept) {
48 const url = VideoOwnershipService.BASE_VIDEO_CHANGE_OWNERSHIP_URL + 'ownership/' + id + '/accept' 45 const url = VideoOwnershipService.BASE_VIDEO_CHANGE_OWNERSHIP_URL + 'ownership/' + id + '/accept'
49 return this.authHttp.post(url, input) 46 return this.authHttp.post(url, input)
50 .pipe( 47 .pipe(catchError(this.restExtractor.handleError))
51 map(this.restExtractor.extractDataBool),
52 catchError(this.restExtractor.handleError)
53 )
54 } 48 }
55 49
56 refuseOwnership (id: number) { 50 refuseOwnership (id: number) {
57 const url = VideoOwnershipService.BASE_VIDEO_CHANGE_OWNERSHIP_URL + 'ownership/' + id + '/refuse' 51 const url = VideoOwnershipService.BASE_VIDEO_CHANGE_OWNERSHIP_URL + 'ownership/' + id + '/refuse'
58 return this.authHttp.post(url, {}) 52 return this.authHttp.post(url, {})
59 .pipe( 53 .pipe(catchError(this.restExtractor.handleError))
60 map(this.restExtractor.extractDataBool),
61 catchError(this.restExtractor.handleError)
62 )
63 } 54 }
64} 55}
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 {
114 const data = objectToFormData(body) 114 const data = objectToFormData(body)
115 115
116 return this.authHttp.put(`${VideoService.BASE_VIDEO_URL}/${video.id}`, data) 116 return this.authHttp.put(`${VideoService.BASE_VIDEO_URL}/${video.id}`, data)
117 .pipe( 117 .pipe(catchError(err => this.restExtractor.handleError(err)))
118 map(this.restExtractor.extractDataBool),
119 catchError(err => this.restExtractor.handleError(err))
120 )
121 } 118 }
122 119
123 uploadVideo (video: FormData) { 120 uploadVideo (video: FormData) {
@@ -449,9 +446,6 @@ export class VideoService {
449 446
450 return this.authHttp 447 return this.authHttp
451 .put(url, body) 448 .put(url, body)
452 .pipe( 449 .pipe(catchError(err => this.restExtractor.handleError(err)))
453 map(this.restExtractor.extractDataBool),
454 catchError(err => this.restExtractor.handleError(err))
455 )
456 } 450 }
457} 451}