diff options
Diffstat (limited to 'client/src/app')
15 files changed, 44 insertions, 174 deletions
diff --git a/client/src/app/core/rest/rest-extractor.service.ts b/client/src/app/core/rest/rest-extractor.service.ts index dd4a78de5..17053811c 100644 --- a/client/src/app/core/rest/rest-extractor.service.ts +++ b/client/src/app/core/rest/rest-extractor.service.ts | |||
@@ -9,10 +9,6 @@ export class RestExtractor { | |||
9 | 9 | ||
10 | constructor (private router: Router) { } | 10 | constructor (private router: Router) { } |
11 | 11 | ||
12 | extractDataBool () { | ||
13 | return true | ||
14 | } | ||
15 | |||
16 | applyToResultListData <T, A, U> ( | 12 | applyToResultListData <T, A, U> ( |
17 | result: ResultList<T>, | 13 | result: ResultList<T>, |
18 | fun: (data: T, ...args: A[]) => U, | 14 | fun: (data: T, ...args: A[]) => U, |
diff --git a/client/src/app/core/users/user.service.ts b/client/src/app/core/users/user.service.ts index a6a0474ab..f173c356a 100644 --- a/client/src/app/core/users/user.service.ts +++ b/client/src/app/core/users/user.service.ts | |||
@@ -49,10 +49,7 @@ export class UserService { | |||
49 | } | 49 | } |
50 | 50 | ||
51 | return this.authHttp.put(url, body) | 51 | return this.authHttp.put(url, body) |
52 | .pipe( | 52 | .pipe(catchError(err => this.restExtractor.handleError(err))) |
53 | map(this.restExtractor.extractDataBool), | ||
54 | catchError(err => this.restExtractor.handleError(err)) | ||
55 | ) | ||
56 | } | 53 | } |
57 | 54 | ||
58 | changeEmail (password: string, newEmail: string) { | 55 | changeEmail (password: string, newEmail: string) { |
@@ -63,10 +60,7 @@ export class UserService { | |||
63 | } | 60 | } |
64 | 61 | ||
65 | return this.authHttp.put(url, body) | 62 | return this.authHttp.put(url, body) |
66 | .pipe( | 63 | .pipe(catchError(err => this.restExtractor.handleError(err))) |
67 | map(this.restExtractor.extractDataBool), | ||
68 | catchError(err => this.restExtractor.handleError(err)) | ||
69 | ) | ||
70 | } | 64 | } |
71 | 65 | ||
72 | // --------------------------------------------------------------------------- | 66 | // --------------------------------------------------------------------------- |
@@ -90,20 +84,14 @@ export class UserService { | |||
90 | const url = UserService.BASE_USERS_URL + 'me' | 84 | const url = UserService.BASE_USERS_URL + 'me' |
91 | 85 | ||
92 | return this.authHttp.put(url, profile) | 86 | return this.authHttp.put(url, profile) |
93 | .pipe( | 87 | .pipe(catchError(err => this.restExtractor.handleError(err))) |
94 | map(this.restExtractor.extractDataBool), | ||
95 | catchError(err => this.restExtractor.handleError(err)) | ||
96 | ) | ||
97 | } | 88 | } |
98 | 89 | ||
99 | deleteMe () { | 90 | deleteMe () { |
100 | const url = UserService.BASE_USERS_URL + 'me' | 91 | const url = UserService.BASE_USERS_URL + 'me' |
101 | 92 | ||
102 | return this.authHttp.delete(url) | 93 | return this.authHttp.delete(url) |
103 | .pipe( | 94 | .pipe(catchError(err => this.restExtractor.handleError(err))) |
104 | map(this.restExtractor.extractDataBool), | ||
105 | catchError(err => this.restExtractor.handleError(err)) | ||
106 | ) | ||
107 | } | 95 | } |
108 | 96 | ||
109 | changeAvatar (avatarForm: FormData) { | 97 | changeAvatar (avatarForm: FormData) { |
@@ -117,16 +105,12 @@ export class UserService { | |||
117 | const url = UserService.BASE_USERS_URL + 'me/avatar' | 105 | const url = UserService.BASE_USERS_URL + 'me/avatar' |
118 | 106 | ||
119 | return this.authHttp.delete(url) | 107 | return this.authHttp.delete(url) |
120 | .pipe( | 108 | .pipe(catchError(err => this.restExtractor.handleError(err))) |
121 | map(this.restExtractor.extractDataBool), | ||
122 | catchError(err => this.restExtractor.handleError(err)) | ||
123 | ) | ||
124 | } | 109 | } |
125 | 110 | ||
126 | signup (userCreate: UserRegister) { | 111 | signup (userCreate: UserRegister) { |
127 | return this.authHttp.post(UserService.BASE_USERS_URL + 'register', userCreate) | 112 | return this.authHttp.post(UserService.BASE_USERS_URL + 'register', userCreate) |
128 | .pipe( | 113 | .pipe( |
129 | map(this.restExtractor.extractDataBool), | ||
130 | tap(() => this.signupInThisSession = true), | 114 | tap(() => this.signupInThisSession = true), |
131 | catchError(err => this.restExtractor.handleError(err)) | 115 | catchError(err => this.restExtractor.handleError(err)) |
132 | ) | 116 | ) |
@@ -143,10 +127,7 @@ export class UserService { | |||
143 | const url = UserService.BASE_USERS_URL + '/ask-reset-password' | 127 | const url = UserService.BASE_USERS_URL + '/ask-reset-password' |
144 | 128 | ||
145 | return this.authHttp.post(url, { email }) | 129 | return this.authHttp.post(url, { email }) |
146 | .pipe( | 130 | .pipe(catchError(err => this.restExtractor.handleError(err))) |
147 | map(this.restExtractor.extractDataBool), | ||
148 | catchError(err => this.restExtractor.handleError(err)) | ||
149 | ) | ||
150 | } | 131 | } |
151 | 132 | ||
152 | resetPassword (userId: number, verificationString: string, password: string) { | 133 | resetPassword (userId: number, verificationString: string, password: string) { |
@@ -157,10 +138,7 @@ export class UserService { | |||
157 | } | 138 | } |
158 | 139 | ||
159 | return this.authHttp.post(url, body) | 140 | return this.authHttp.post(url, body) |
160 | .pipe( | 141 | .pipe(catchError(res => this.restExtractor.handleError(res))) |
161 | map(this.restExtractor.extractDataBool), | ||
162 | catchError(res => this.restExtractor.handleError(res)) | ||
163 | ) | ||
164 | } | 142 | } |
165 | 143 | ||
166 | verifyEmail (userId: number, verificationString: string, isPendingEmail: boolean) { | 144 | verifyEmail (userId: number, verificationString: string, isPendingEmail: boolean) { |
@@ -171,20 +149,14 @@ export class UserService { | |||
171 | } | 149 | } |
172 | 150 | ||
173 | return this.authHttp.post(url, body) | 151 | return this.authHttp.post(url, body) |
174 | .pipe( | 152 | .pipe(catchError(res => this.restExtractor.handleError(res))) |
175 | map(this.restExtractor.extractDataBool), | ||
176 | catchError(res => this.restExtractor.handleError(res)) | ||
177 | ) | ||
178 | } | 153 | } |
179 | 154 | ||
180 | askSendVerifyEmail (email: string) { | 155 | askSendVerifyEmail (email: string) { |
181 | const url = UserService.BASE_USERS_URL + '/ask-send-verify-email' | 156 | const url = UserService.BASE_USERS_URL + '/ask-send-verify-email' |
182 | 157 | ||
183 | return this.authHttp.post(url, { email }) | 158 | return this.authHttp.post(url, { email }) |
184 | .pipe( | 159 | .pipe(catchError(err => this.restExtractor.handleError(err))) |
185 | map(this.restExtractor.extractDataBool), | ||
186 | catchError(err => this.restExtractor.handleError(err)) | ||
187 | ) | ||
188 | } | 160 | } |
189 | 161 | ||
190 | autocomplete (search: string): Observable<string[]> { | 162 | autocomplete (search: string): Observable<string[]> { |
@@ -216,18 +188,12 @@ export class UserService { | |||
216 | 188 | ||
217 | addUser (userCreate: UserCreate) { | 189 | addUser (userCreate: UserCreate) { |
218 | return this.authHttp.post(UserService.BASE_USERS_URL, userCreate) | 190 | return this.authHttp.post(UserService.BASE_USERS_URL, userCreate) |
219 | .pipe( | 191 | .pipe(catchError(err => this.restExtractor.handleError(err))) |
220 | map(this.restExtractor.extractDataBool), | ||
221 | catchError(err => this.restExtractor.handleError(err)) | ||
222 | ) | ||
223 | } | 192 | } |
224 | 193 | ||
225 | updateUser (userId: number, userUpdate: UserUpdate) { | 194 | updateUser (userId: number, userUpdate: UserUpdate) { |
226 | return this.authHttp.put(UserService.BASE_USERS_URL + userId, userUpdate) | 195 | return this.authHttp.put(UserService.BASE_USERS_URL + userId, userUpdate) |
227 | .pipe( | 196 | .pipe(catchError(err => this.restExtractor.handleError(err))) |
228 | map(this.restExtractor.extractDataBool), | ||
229 | catchError(err => this.restExtractor.handleError(err)) | ||
230 | ) | ||
231 | } | 197 | } |
232 | 198 | ||
233 | updateUsers (users: UserServerModel[], userUpdate: UserUpdate) { | 199 | updateUsers (users: UserServerModel[], userUpdate: UserUpdate) { |
diff --git a/client/src/app/shared/shared-instance/instance-follow.service.ts b/client/src/app/shared/shared-instance/instance-follow.service.ts index a6799d3e1..a83f7c4ad 100644 --- a/client/src/app/shared/shared-instance/instance-follow.service.ts +++ b/client/src/app/shared/shared-instance/instance-follow.service.ts | |||
@@ -71,49 +71,34 @@ export class InstanceFollowService { | |||
71 | } | 71 | } |
72 | 72 | ||
73 | return this.authHttp.post(InstanceFollowService.BASE_APPLICATION_URL + '/following', body) | 73 | return this.authHttp.post(InstanceFollowService.BASE_APPLICATION_URL + '/following', body) |
74 | .pipe( | 74 | .pipe(catchError(res => this.restExtractor.handleError(res))) |
75 | map(this.restExtractor.extractDataBool), | ||
76 | catchError(res => this.restExtractor.handleError(res)) | ||
77 | ) | ||
78 | } | 75 | } |
79 | 76 | ||
80 | unfollow (follow: ActorFollow) { | 77 | unfollow (follow: ActorFollow) { |
81 | const handle = follow.following.name + '@' + follow.following.host | 78 | const handle = follow.following.name + '@' + follow.following.host |
82 | 79 | ||
83 | return this.authHttp.delete(InstanceFollowService.BASE_APPLICATION_URL + '/following/' + handle) | 80 | return this.authHttp.delete(InstanceFollowService.BASE_APPLICATION_URL + '/following/' + handle) |
84 | .pipe( | 81 | .pipe(catchError(res => this.restExtractor.handleError(res))) |
85 | map(this.restExtractor.extractDataBool), | ||
86 | catchError(res => this.restExtractor.handleError(res)) | ||
87 | ) | ||
88 | } | 82 | } |
89 | 83 | ||
90 | acceptFollower (follow: ActorFollow) { | 84 | acceptFollower (follow: ActorFollow) { |
91 | const handle = follow.follower.name + '@' + follow.follower.host | 85 | const handle = follow.follower.name + '@' + follow.follower.host |
92 | 86 | ||
93 | return this.authHttp.post(`${InstanceFollowService.BASE_APPLICATION_URL}/followers/${handle}/accept`, {}) | 87 | return this.authHttp.post(`${InstanceFollowService.BASE_APPLICATION_URL}/followers/${handle}/accept`, {}) |
94 | .pipe( | 88 | .pipe(catchError(res => this.restExtractor.handleError(res))) |
95 | map(this.restExtractor.extractDataBool), | ||
96 | catchError(res => this.restExtractor.handleError(res)) | ||
97 | ) | ||
98 | } | 89 | } |
99 | 90 | ||
100 | rejectFollower (follow: ActorFollow) { | 91 | rejectFollower (follow: ActorFollow) { |
101 | const handle = follow.follower.name + '@' + follow.follower.host | 92 | const handle = follow.follower.name + '@' + follow.follower.host |
102 | 93 | ||
103 | return this.authHttp.post(`${InstanceFollowService.BASE_APPLICATION_URL}/followers/${handle}/reject`, {}) | 94 | return this.authHttp.post(`${InstanceFollowService.BASE_APPLICATION_URL}/followers/${handle}/reject`, {}) |
104 | .pipe( | 95 | .pipe(catchError(res => this.restExtractor.handleError(res))) |
105 | map(this.restExtractor.extractDataBool), | ||
106 | catchError(res => this.restExtractor.handleError(res)) | ||
107 | ) | ||
108 | } | 96 | } |
109 | 97 | ||
110 | removeFollower (follow: ActorFollow) { | 98 | removeFollower (follow: ActorFollow) { |
111 | const handle = follow.follower.name + '@' + follow.follower.host | 99 | const handle = follow.follower.name + '@' + follow.follower.host |
112 | 100 | ||
113 | return this.authHttp.delete(`${InstanceFollowService.BASE_APPLICATION_URL}/followers/${handle}`) | 101 | return this.authHttp.delete(`${InstanceFollowService.BASE_APPLICATION_URL}/followers/${handle}`) |
114 | .pipe( | 102 | .pipe(catchError(res => this.restExtractor.handleError(res))) |
115 | map(this.restExtractor.extractDataBool), | ||
116 | catchError(res => this.restExtractor.handleError(res)) | ||
117 | ) | ||
118 | } | 103 | } |
119 | } | 104 | } |
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 @@ | |||
1 | import { of } from 'rxjs' | 1 | import { of } from 'rxjs' |
2 | import { catchError, map } from 'rxjs/operators' | 2 | import { catchError } from 'rxjs/operators' |
3 | import { HttpClient } from '@angular/common/http' | 3 | import { HttpClient } from '@angular/common/http' |
4 | import { Injectable } from '@angular/core' | 4 | import { Injectable } from '@angular/core' |
5 | import { RestExtractor } from '@app/core' | 5 | import { 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 @@ | |||
1 | import { catchError, map, switchMap } from 'rxjs/operators' | 1 | import { catchError, switchMap } from 'rxjs/operators' |
2 | import { HttpClient, HttpParams } from '@angular/common/http' | 2 | import { HttpClient, HttpParams } from '@angular/common/http' |
3 | import { Injectable } from '@angular/core' | 3 | import { Injectable } from '@angular/core' |
4 | import { ComponentPaginationLight, RestExtractor, RestService } from '@app/core' | 4 | import { 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 @@ | |||
1 | import { SortMeta } from 'primeng/api' | 1 | import { SortMeta } from 'primeng/api' |
2 | import { concat, Observable } from 'rxjs' | 2 | import { concat, Observable } from 'rxjs' |
3 | import { catchError, map, toArray } from 'rxjs/operators' | 3 | import { catchError, toArray } from 'rxjs/operators' |
4 | import { HttpClient, HttpParams } from '@angular/common/http' | 4 | import { HttpClient, HttpParams } from '@angular/common/http' |
5 | import { Injectable } from '@angular/core' | 5 | import { Injectable } from '@angular/core' |
6 | import { RestExtractor, RestPagination, RestService } from '@app/core' | 6 | import { 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 | } |
diff --git a/client/src/app/shared/shared-moderation/abuse.service.ts b/client/src/app/shared/shared-moderation/abuse.service.ts index f45b5c8e8..5d1539f69 100644 --- a/client/src/app/shared/shared-moderation/abuse.service.ts +++ b/client/src/app/shared/shared-moderation/abuse.service.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import { omit } from 'lodash-es' | 1 | import { omit } from 'lodash-es' |
2 | import { SortMeta } from 'primeng/api' | 2 | import { SortMeta } from 'primeng/api' |
3 | import { Observable } from 'rxjs' | 3 | import { Observable } from 'rxjs' |
4 | import { catchError, map } from 'rxjs/operators' | 4 | import { catchError } from 'rxjs/operators' |
5 | import { HttpClient, HttpParams } from '@angular/common/http' | 5 | import { HttpClient, HttpParams } from '@angular/common/http' |
6 | import { Injectable } from '@angular/core' | 6 | import { Injectable } from '@angular/core' |
7 | import { RestExtractor, RestPagination, RestService } from '@app/core' | 7 | import { RestExtractor, RestPagination, RestService } from '@app/core' |
@@ -77,40 +77,28 @@ export class AbuseService { | |||
77 | const body = omit(parameters, [ 'id' ]) | 77 | const body = omit(parameters, [ 'id' ]) |
78 | 78 | ||
79 | return this.authHttp.post(url, body) | 79 | return this.authHttp.post(url, body) |
80 | .pipe( | 80 | .pipe(catchError(res => this.restExtractor.handleError(res))) |
81 | map(this.restExtractor.extractDataBool), | ||
82 | catchError(res => this.restExtractor.handleError(res)) | ||
83 | ) | ||
84 | } | 81 | } |
85 | 82 | ||
86 | updateAbuse (abuse: AdminAbuse, abuseUpdate: AbuseUpdate) { | 83 | updateAbuse (abuse: AdminAbuse, abuseUpdate: AbuseUpdate) { |
87 | const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id | 84 | const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id |
88 | 85 | ||
89 | return this.authHttp.put(url, abuseUpdate) | 86 | return this.authHttp.put(url, abuseUpdate) |
90 | .pipe( | 87 | .pipe(catchError(res => this.restExtractor.handleError(res))) |
91 | map(this.restExtractor.extractDataBool), | ||
92 | catchError(res => this.restExtractor.handleError(res)) | ||
93 | ) | ||
94 | } | 88 | } |
95 | 89 | ||
96 | removeAbuse (abuse: AdminAbuse) { | 90 | removeAbuse (abuse: AdminAbuse) { |
97 | const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id | 91 | const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id |
98 | 92 | ||
99 | return this.authHttp.delete(url) | 93 | return this.authHttp.delete(url) |
100 | .pipe( | 94 | .pipe(catchError(res => this.restExtractor.handleError(res))) |
101 | map(this.restExtractor.extractDataBool), | ||
102 | catchError(res => this.restExtractor.handleError(res)) | ||
103 | ) | ||
104 | } | 95 | } |
105 | 96 | ||
106 | addAbuseMessage (abuse: UserAbuse, message: string) { | 97 | addAbuseMessage (abuse: UserAbuse, message: string) { |
107 | const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id + '/messages' | 98 | const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id + '/messages' |
108 | 99 | ||
109 | return this.authHttp.post(url, { message }) | 100 | return this.authHttp.post(url, { message }) |
110 | .pipe( | 101 | .pipe(catchError(res => this.restExtractor.handleError(res))) |
111 | map(this.restExtractor.extractDataBool), | ||
112 | catchError(res => this.restExtractor.handleError(res)) | ||
113 | ) | ||
114 | } | 102 | } |
115 | 103 | ||
116 | listAbuseMessages (abuse: UserAbuse) { | 104 | listAbuseMessages (abuse: UserAbuse) { |
@@ -126,10 +114,7 @@ export class AbuseService { | |||
126 | const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id + '/messages/' + abuseMessage.id | 114 | const url = AbuseService.BASE_ABUSE_URL + '/' + abuse.id + '/messages/' + abuseMessage.id |
127 | 115 | ||
128 | return this.authHttp.delete(url) | 116 | return this.authHttp.delete(url) |
129 | .pipe( | 117 | .pipe(catchError(res => this.restExtractor.handleError(res))) |
130 | map(this.restExtractor.extractDataBool), | ||
131 | catchError(res => this.restExtractor.handleError(res)) | ||
132 | ) | ||
133 | } | 118 | } |
134 | 119 | ||
135 | getPrefefinedReasons (type: AbuseFilter) { | 120 | getPrefefinedReasons (type: AbuseFilter) { |
diff --git a/client/src/app/shared/shared-user-subscription/user-subscription.service.ts b/client/src/app/shared/shared-user-subscription/user-subscription.service.ts index ede65ff39..33a2d04fd 100644 --- a/client/src/app/shared/shared-user-subscription/user-subscription.service.ts +++ b/client/src/app/shared/shared-user-subscription/user-subscription.service.ts | |||
@@ -108,7 +108,6 @@ export class UserSubscriptionService { | |||
108 | 108 | ||
109 | return this.authHttp.delete(url) | 109 | return this.authHttp.delete(url) |
110 | .pipe( | 110 | .pipe( |
111 | map(this.restExtractor.extractDataBool), | ||
112 | tap(() => { | 111 | tap(() => { |
113 | this.myAccountSubscriptionCache[nameWithHost] = false | 112 | this.myAccountSubscriptionCache[nameWithHost] = false |
114 | 113 | ||
@@ -124,7 +123,6 @@ export class UserSubscriptionService { | |||
124 | const body = { uri: nameWithHost } | 123 | const body = { uri: nameWithHost } |
125 | return this.authHttp.post(url, body) | 124 | return this.authHttp.post(url, body) |
126 | .pipe( | 125 | .pipe( |
127 | map(this.restExtractor.extractDataBool), | ||
128 | tap(() => { | 126 | tap(() => { |
129 | this.myAccountSubscriptionCache[nameWithHost] = true | 127 | this.myAccountSubscriptionCache[nameWithHost] = true |
130 | 128 | ||
diff --git a/client/src/app/shared/shared-video-comment/video-comment.service.ts b/client/src/app/shared/shared-video-comment/video-comment.service.ts index fd1cae7f8..6f2ef50cb 100644 --- a/client/src/app/shared/shared-video-comment/video-comment.service.ts +++ b/client/src/app/shared/shared-video-comment/video-comment.service.ts | |||
@@ -114,10 +114,7 @@ export class VideoCommentService { | |||
114 | 114 | ||
115 | return this.authHttp | 115 | return this.authHttp |
116 | .delete(url) | 116 | .delete(url) |
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 | deleteVideoComments (comments: { videoId: number | string, commentId: number }[]) { | 120 | deleteVideoComments (comments: { videoId: number | string, commentId: number }[]) { |
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.ts index 44d930b07..db9f78a7a 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 | |||
@@ -154,7 +154,6 @@ export class VideoPlaylistService { | |||
154 | 154 | ||
155 | return this.authHttp.put(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + videoPlaylist.id, data) | 155 | return this.authHttp.put(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + videoPlaylist.id, data) |
156 | .pipe( | 156 | .pipe( |
157 | map(this.restExtractor.extractDataBool), | ||
158 | tap(() => { | 157 | tap(() => { |
159 | if (!this.myAccountPlaylistCache) return | 158 | if (!this.myAccountPlaylistCache) return |
160 | 159 | ||
@@ -170,7 +169,6 @@ export class VideoPlaylistService { | |||
170 | removeVideoPlaylist (videoPlaylist: VideoPlaylist) { | 169 | removeVideoPlaylist (videoPlaylist: VideoPlaylist) { |
171 | return this.authHttp.delete(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + videoPlaylist.id) | 170 | return this.authHttp.delete(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + videoPlaylist.id) |
172 | .pipe( | 171 | .pipe( |
173 | map(this.restExtractor.extractDataBool), | ||
174 | tap(() => { | 172 | tap(() => { |
175 | if (!this.myAccountPlaylistCache) return | 173 | if (!this.myAccountPlaylistCache) return |
176 | 174 | ||
@@ -207,7 +205,6 @@ export class VideoPlaylistService { | |||
207 | updateVideoOfPlaylist (playlistId: number, playlistElementId: number, body: VideoPlaylistElementUpdate, videoId: number) { | 205 | updateVideoOfPlaylist (playlistId: number, playlistElementId: number, body: VideoPlaylistElementUpdate, videoId: number) { |
208 | return this.authHttp.put(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + playlistId + '/videos/' + playlistElementId, body) | 206 | return this.authHttp.put(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + playlistId + '/videos/' + playlistElementId, body) |
209 | .pipe( | 207 | .pipe( |
210 | map(this.restExtractor.extractDataBool), | ||
211 | tap(() => { | 208 | tap(() => { |
212 | const existsResult = this.videoExistsCache[videoId] | 209 | const existsResult = this.videoExistsCache[videoId] |
213 | 210 | ||
@@ -227,7 +224,6 @@ export class VideoPlaylistService { | |||
227 | removeVideoFromPlaylist (playlistId: number, playlistElementId: number, videoId?: number) { | 224 | removeVideoFromPlaylist (playlistId: number, playlistElementId: number, videoId?: number) { |
228 | return this.authHttp.delete(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + playlistId + '/videos/' + playlistElementId) | 225 | return this.authHttp.delete(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + playlistId + '/videos/' + playlistElementId) |
229 | .pipe( | 226 | .pipe( |
230 | map(this.restExtractor.extractDataBool), | ||
231 | tap(() => { | 227 | tap(() => { |
232 | if (!videoId) return | 228 | if (!videoId) return |
233 | 229 | ||
@@ -249,10 +245,7 @@ export class VideoPlaylistService { | |||
249 | } | 245 | } |
250 | 246 | ||
251 | return this.authHttp.post(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + playlistId + '/videos/reorder', body) | 247 | return this.authHttp.post(VideoPlaylistService.BASE_VIDEO_PLAYLIST_URL + playlistId + '/videos/reorder', body) |
252 | .pipe( | 248 | .pipe(catchError(err => this.restExtractor.handleError(err))) |
253 | map(this.restExtractor.extractDataBool), | ||
254 | catchError(err => this.restExtractor.handleError(err)) | ||
255 | ) | ||
256 | } | 249 | } |
257 | 250 | ||
258 | getPlaylistVideos (options: { | 251 | getPlaylistVideos (options: { |