diff options
author | Chocobozzz <me@florianbigard.com> | 2021-08-17 11:27:47 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-08-17 14:01:45 +0200 |
commit | 1378c0d343028f3d40d7d795422684ab9e6a1599 (patch) | |
tree | 08062b84a38a7e2dfe0aa674e7ca8e1b7321044e /client/src/app/+videos | |
parent | c186a67f90203af6bfa434f026efdc99193bcd65 (diff) | |
download | PeerTube-1378c0d343028f3d40d7d795422684ab9e6a1599.tar.gz PeerTube-1378c0d343028f3d40d7d795422684ab9e6a1599.tar.zst PeerTube-1378c0d343028f3d40d7d795422684ab9e6a1599.zip |
Fix client lint
Diffstat (limited to 'client/src/app/+videos')
15 files changed, 187 insertions, 181 deletions
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts index db25dc6be..30c79594d 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts +++ b/client/src/app/+videos/+video-edit/video-add-components/video-go-live.component.ts | |||
@@ -8,7 +8,7 @@ import { FormValidatorService } from '@app/shared/shared-forms' | |||
8 | import { Video, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' | 8 | import { Video, VideoCaptionService, VideoEdit, VideoService } from '@app/shared/shared-main' |
9 | import { LiveVideoService } from '@app/shared/shared-video-live' | 9 | import { LiveVideoService } from '@app/shared/shared-video-live' |
10 | import { LoadingBarService } from '@ngx-loading-bar/core' | 10 | import { LoadingBarService } from '@ngx-loading-bar/core' |
11 | import { LiveVideo, LiveVideoCreate, LiveVideoUpdate, PeerTubeProblemDocument, ServerErrorCode, VideoPrivacy } from '@shared/models' | 11 | import { LiveVideo, LiveVideoCreate, LiveVideoUpdate, PeerTubeProblemDocument, ServerErrorCode } from '@shared/models' |
12 | import { VideoSend } from './video-send' | 12 | import { VideoSend } from './video-send' |
13 | 13 | ||
14 | @Component({ | 14 | @Component({ |
@@ -74,33 +74,34 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView | |||
74 | const toPatch = Object.assign({}, video, { privacy: this.firstStepPrivacyId }) | 74 | const toPatch = Object.assign({}, video, { privacy: this.firstStepPrivacyId }) |
75 | this.form.patchValue(toPatch) | 75 | this.form.patchValue(toPatch) |
76 | 76 | ||
77 | this.liveVideoService.goLive(video).subscribe( | 77 | this.liveVideoService.goLive(video) |
78 | res => { | 78 | .subscribe({ |
79 | this.videoId = res.video.id | 79 | next: res => { |
80 | this.videoUUID = res.video.uuid | 80 | this.videoId = res.video.id |
81 | this.isInUpdateForm = true | 81 | this.videoUUID = res.video.uuid |
82 | this.isInUpdateForm = true | ||
82 | 83 | ||
83 | this.firstStepDone.emit(name) | 84 | this.firstStepDone.emit(name) |
84 | 85 | ||
85 | this.fetchVideoLive() | 86 | this.fetchVideoLive() |
86 | }, | 87 | }, |
88 | |||
89 | error: err => { | ||
90 | this.firstStepError.emit() | ||
87 | 91 | ||
88 | err => { | 92 | let message = err.message |
89 | this.firstStepError.emit() | ||
90 | 93 | ||
91 | let message = err.message | 94 | const error = err.body as PeerTubeProblemDocument |
92 | 95 | ||
93 | const error = err.body as PeerTubeProblemDocument | 96 | if (error?.code === ServerErrorCode.MAX_INSTANCE_LIVES_LIMIT_REACHED) { |
97 | message = $localize`Cannot create live because this instance have too many created lives` | ||
98 | } else if (error?.code === ServerErrorCode.MAX_USER_LIVES_LIMIT_REACHED) { | ||
99 | message = $localize`Cannot create live because you created too many lives` | ||
100 | } | ||
94 | 101 | ||
95 | if (error?.code === ServerErrorCode.MAX_INSTANCE_LIVES_LIMIT_REACHED) { | 102 | this.notifier.error(message) |
96 | message = $localize`Cannot create live because this instance have too many created lives` | ||
97 | } else if (error?.code === ServerErrorCode.MAX_USER_LIVES_LIMIT_REACHED) { | ||
98 | message = $localize`Cannot create live because you created too many lives` | ||
99 | } | 103 | } |
100 | 104 | }) | |
101 | this.notifier.error(message) | ||
102 | } | ||
103 | ) | ||
104 | } | 105 | } |
105 | 106 | ||
106 | updateSecondStep () { | 107 | updateSecondStep () { |
@@ -123,19 +124,19 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView | |||
123 | this.updateVideoAndCaptions(video), | 124 | this.updateVideoAndCaptions(video), |
124 | 125 | ||
125 | this.liveVideoService.updateLive(this.videoId, liveVideoUpdate) | 126 | this.liveVideoService.updateLive(this.videoId, liveVideoUpdate) |
126 | ]).subscribe( | 127 | ]).subscribe({ |
127 | () => { | 128 | next: () => { |
128 | this.notifier.success($localize`Live published.`) | 129 | this.notifier.success($localize`Live published.`) |
129 | 130 | ||
130 | this.router.navigateByUrl(Video.buildWatchUrl(video)) | 131 | this.router.navigateByUrl(Video.buildWatchUrl(video)) |
131 | }, | 132 | }, |
132 | 133 | ||
133 | err => { | 134 | error: err => { |
134 | this.error = err.message | 135 | this.error = err.message |
135 | scrollToTop() | 136 | scrollToTop() |
136 | console.error(err) | 137 | console.error(err) |
137 | } | 138 | } |
138 | ) | 139 | }) |
139 | } | 140 | } |
140 | 141 | ||
141 | getMaxLiveDuration () { | 142 | getMaxLiveDuration () { |
@@ -148,15 +149,15 @@ export class VideoGoLiveComponent extends VideoSend implements OnInit, AfterView | |||
148 | 149 | ||
149 | private fetchVideoLive () { | 150 | private fetchVideoLive () { |
150 | this.liveVideoService.getVideoLive(this.videoId) | 151 | this.liveVideoService.getVideoLive(this.videoId) |
151 | .subscribe( | 152 | .subscribe({ |
152 | liveVideo => { | 153 | next: liveVideo => { |
153 | this.liveVideo = liveVideo | 154 | this.liveVideo = liveVideo |
154 | }, | 155 | }, |
155 | 156 | ||
156 | err => { | 157 | error: err => { |
157 | this.firstStepError.emit() | 158 | this.firstStepError.emit() |
158 | this.notifier.error(err.message) | 159 | this.notifier.error(err.message) |
159 | } | 160 | } |
160 | ) | 161 | }) |
161 | } | 162 | } |
162 | } | 163 | } |
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts index 62aaeb019..fef1f5d65 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts +++ b/client/src/app/+videos/+video-edit/video-add-components/video-import-torrent.component.ts | |||
@@ -88,40 +88,41 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Af | |||
88 | 88 | ||
89 | this.loadingBar.useRef().start() | 89 | this.loadingBar.useRef().start() |
90 | 90 | ||
91 | this.videoImportService.importVideoTorrent(torrentfile || this.magnetUri, videoUpdate).subscribe( | 91 | this.videoImportService.importVideoTorrent(torrentfile || this.magnetUri, videoUpdate) |
92 | res => { | 92 | .subscribe({ |
93 | this.loadingBar.useRef().complete() | 93 | next: res => { |
94 | this.firstStepDone.emit(res.video.name) | 94 | this.loadingBar.useRef().complete() |
95 | this.isImportingVideo = false | 95 | this.firstStepDone.emit(res.video.name) |
96 | this.hasImportedVideo = true | 96 | this.isImportingVideo = false |
97 | 97 | this.hasImportedVideo = true | |
98 | this.video = new VideoEdit(Object.assign(res.video, { | 98 | |
99 | commentsEnabled: videoUpdate.commentsEnabled, | 99 | this.video = new VideoEdit(Object.assign(res.video, { |
100 | downloadEnabled: videoUpdate.downloadEnabled, | 100 | commentsEnabled: videoUpdate.commentsEnabled, |
101 | privacy: { id: this.firstStepPrivacyId }, | 101 | downloadEnabled: videoUpdate.downloadEnabled, |
102 | support: null, | 102 | privacy: { id: this.firstStepPrivacyId }, |
103 | thumbnailUrl: null, | 103 | support: null, |
104 | previewUrl: null | 104 | thumbnailUrl: null, |
105 | })) | 105 | previewUrl: null |
106 | 106 | })) | |
107 | hydrateFormFromVideo(this.form, this.video, false) | 107 | |
108 | }, | 108 | hydrateFormFromVideo(this.form, this.video, false) |
109 | 109 | }, | |
110 | err => { | 110 | |
111 | this.loadingBar.useRef().complete() | 111 | error: err => { |
112 | this.isImportingVideo = false | 112 | this.loadingBar.useRef().complete() |
113 | this.firstStepError.emit() | 113 | this.isImportingVideo = false |
114 | 114 | this.firstStepError.emit() | |
115 | let message = err.message | 115 | |
116 | 116 | let message = err.message | |
117 | const error = err.body as PeerTubeProblemDocument | 117 | |
118 | if (error?.code === ServerErrorCode.INCORRECT_FILES_IN_TORRENT) { | 118 | const error = err.body as PeerTubeProblemDocument |
119 | message = $localize`Torrents with only 1 file are supported.` | 119 | if (error?.code === ServerErrorCode.INCORRECT_FILES_IN_TORRENT) { |
120 | } | 120 | message = $localize`Torrents with only 1 file are supported.` |
121 | } | ||
121 | 122 | ||
122 | this.notifier.error(message) | 123 | this.notifier.error(message) |
123 | } | 124 | } |
124 | ) | 125 | }) |
125 | } | 126 | } |
126 | 127 | ||
127 | updateSecondStep () { | 128 | updateSecondStep () { |
@@ -135,19 +136,19 @@ export class VideoImportTorrentComponent extends VideoSend implements OnInit, Af | |||
135 | 136 | ||
136 | // Update the video | 137 | // Update the video |
137 | this.updateVideoAndCaptions(this.video) | 138 | this.updateVideoAndCaptions(this.video) |
138 | .subscribe( | 139 | .subscribe({ |
139 | () => { | 140 | next: () => { |
140 | this.isUpdatingVideo = false | 141 | this.isUpdatingVideo = false |
141 | this.notifier.success($localize`Video to import updated.`) | 142 | this.notifier.success($localize`Video to import updated.`) |
142 | 143 | ||
143 | this.router.navigate([ '/my-library', 'video-imports' ]) | 144 | this.router.navigate([ '/my-library', 'video-imports' ]) |
144 | }, | 145 | }, |
145 | 146 | ||
146 | err => { | 147 | error: err => { |
147 | this.error = err.message | 148 | this.error = err.message |
148 | scrollToTop() | 149 | scrollToTop() |
149 | console.error(err) | 150 | console.error(err) |
150 | } | 151 | } |
151 | ) | 152 | }) |
152 | } | 153 | } |
153 | } | 154 | } |
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts index 3243b4d38..e1893b28f 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts +++ b/client/src/app/+videos/+video-edit/video-add-components/video-import-url.component.ts | |||
@@ -6,7 +6,7 @@ import { getAbsoluteAPIUrl, scrollToTop } from '@app/helpers' | |||
6 | import { FormValidatorService } from '@app/shared/shared-forms' | 6 | import { FormValidatorService } from '@app/shared/shared-forms' |
7 | import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main' | 7 | import { VideoCaptionService, VideoEdit, VideoImportService, VideoService } from '@app/shared/shared-main' |
8 | import { LoadingBarService } from '@ngx-loading-bar/core' | 8 | import { LoadingBarService } from '@ngx-loading-bar/core' |
9 | import { VideoPrivacy, VideoUpdate } from '@shared/models' | 9 | import { VideoUpdate } from '@shared/models' |
10 | import { hydrateFormFromVideo } from '../shared/video-edit-utils' | 10 | import { hydrateFormFromVideo } from '../shared/video-edit-utils' |
11 | import { VideoSend } from './video-send' | 11 | import { VideoSend } from './video-send' |
12 | 12 | ||
@@ -86,8 +86,8 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, AfterV | |||
86 | ) | 86 | ) |
87 | }) | 87 | }) |
88 | ) | 88 | ) |
89 | .subscribe( | 89 | .subscribe({ |
90 | ({ video, videoCaptions }) => { | 90 | next: ({ video, videoCaptions }) => { |
91 | this.loadingBar.useRef().complete() | 91 | this.loadingBar.useRef().complete() |
92 | this.firstStepDone.emit(video.name) | 92 | this.firstStepDone.emit(video.name) |
93 | this.isImportingVideo = false | 93 | this.isImportingVideo = false |
@@ -117,13 +117,13 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, AfterV | |||
117 | hydrateFormFromVideo(this.form, this.video, true) | 117 | hydrateFormFromVideo(this.form, this.video, true) |
118 | }, | 118 | }, |
119 | 119 | ||
120 | err => { | 120 | error: err => { |
121 | this.loadingBar.useRef().complete() | 121 | this.loadingBar.useRef().complete() |
122 | this.isImportingVideo = false | 122 | this.isImportingVideo = false |
123 | this.firstStepError.emit() | 123 | this.firstStepError.emit() |
124 | this.notifier.error(err.message) | 124 | this.notifier.error(err.message) |
125 | } | 125 | } |
126 | ) | 126 | }) |
127 | } | 127 | } |
128 | 128 | ||
129 | updateSecondStep () { | 129 | updateSecondStep () { |
@@ -137,19 +137,19 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, AfterV | |||
137 | 137 | ||
138 | // Update the video | 138 | // Update the video |
139 | this.updateVideoAndCaptions(this.video) | 139 | this.updateVideoAndCaptions(this.video) |
140 | .subscribe( | 140 | .subscribe({ |
141 | () => { | 141 | next: () => { |
142 | this.isUpdatingVideo = false | 142 | this.isUpdatingVideo = false |
143 | this.notifier.success($localize`Video to import updated.`) | 143 | this.notifier.success($localize`Video to import updated.`) |
144 | 144 | ||
145 | this.router.navigate([ '/my-library', 'video-imports' ]) | 145 | this.router.navigate([ '/my-library', 'video-imports' ]) |
146 | }, | 146 | }, |
147 | 147 | ||
148 | err => { | 148 | error: err => { |
149 | this.error = err.message | 149 | this.error = err.message |
150 | scrollToTop() | 150 | scrollToTop() |
151 | console.error(err) | 151 | console.error(err) |
152 | } | 152 | } |
153 | ) | 153 | }) |
154 | } | 154 | } |
155 | } | 155 | } |
diff --git a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts index 189bc9669..b8cb4fa1e 100644 --- a/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts +++ b/client/src/app/+videos/+video-edit/video-add-components/video-upload.component.ts | |||
@@ -240,8 +240,8 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
240 | this.isUpdatingVideo = true | 240 | this.isUpdatingVideo = true |
241 | 241 | ||
242 | this.updateVideoAndCaptions(video) | 242 | this.updateVideoAndCaptions(video) |
243 | .subscribe( | 243 | .subscribe({ |
244 | () => { | 244 | next: () => { |
245 | this.isUpdatingVideo = false | 245 | this.isUpdatingVideo = false |
246 | this.isUploadingVideo = false | 246 | this.isUploadingVideo = false |
247 | 247 | ||
@@ -249,12 +249,12 @@ export class VideoUploadComponent extends VideoSend implements OnInit, OnDestroy | |||
249 | this.router.navigateByUrl(Video.buildWatchUrl(video)) | 249 | this.router.navigateByUrl(Video.buildWatchUrl(video)) |
250 | }, | 250 | }, |
251 | 251 | ||
252 | err => { | 252 | error: err => { |
253 | this.error = err.message | 253 | this.error = err.message |
254 | scrollToTop() | 254 | scrollToTop() |
255 | console.error(err) | 255 | console.error(err) |
256 | } | 256 | } |
257 | ) | 257 | }) |
258 | } | 258 | } |
259 | 259 | ||
260 | private getInputVideoFile () { | 260 | private getInputVideoFile () { |
diff --git a/client/src/app/+videos/+video-edit/video-update.component.ts b/client/src/app/+videos/+video-edit/video-update.component.ts index 1534eee82..95336dc75 100644 --- a/client/src/app/+videos/+video-edit/video-update.component.ts +++ b/client/src/app/+videos/+video-edit/video-update.component.ts | |||
@@ -47,34 +47,35 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
47 | 47 | ||
48 | this.route.data | 48 | this.route.data |
49 | .pipe(map(data => data.videoData)) | 49 | .pipe(map(data => data.videoData)) |
50 | .subscribe(({ video, videoChannels, videoCaptions, liveVideo }) => { | 50 | .subscribe({ |
51 | this.video = new VideoEdit(video) | 51 | next: ({ video, videoChannels, videoCaptions, liveVideo }) => { |
52 | this.videoDetails = video | 52 | this.video = new VideoEdit(video) |
53 | 53 | this.videoDetails = video | |
54 | this.userVideoChannels = videoChannels | 54 | |
55 | this.videoCaptions = videoCaptions | 55 | this.userVideoChannels = videoChannels |
56 | this.liveVideo = liveVideo | 56 | this.videoCaptions = videoCaptions |
57 | 57 | this.liveVideo = liveVideo | |
58 | this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE | 58 | |
59 | 59 | this.schedulePublicationPossible = this.video.privacy === VideoPrivacy.PRIVATE | |
60 | // FIXME: Angular does not detect the change inside this subscription, so use the patched setTimeout | 60 | |
61 | setTimeout(() => { | 61 | // FIXME: Angular does not detect the change inside this subscription, so use the patched setTimeout |
62 | hydrateFormFromVideo(this.form, this.video, true) | 62 | setTimeout(() => { |
63 | 63 | hydrateFormFromVideo(this.form, this.video, true) | |
64 | if (this.liveVideo) { | 64 | |
65 | this.form.patchValue({ | 65 | if (this.liveVideo) { |
66 | saveReplay: this.liveVideo.saveReplay, | 66 | this.form.patchValue({ |
67 | permanentLive: this.liveVideo.permanentLive | 67 | saveReplay: this.liveVideo.saveReplay, |
68 | }) | 68 | permanentLive: this.liveVideo.permanentLive |
69 | } | 69 | }) |
70 | }) | 70 | } |
71 | }, | 71 | }) |
72 | }, | ||
72 | 73 | ||
73 | err => { | 74 | error: err => { |
74 | console.error(err) | 75 | console.error(err) |
75 | this.notifier.error(err.message) | 76 | this.notifier.error(err.message) |
76 | } | 77 | } |
77 | ) | 78 | }) |
78 | } | 79 | } |
79 | 80 | ||
80 | @HostListener('window:beforeunload', [ '$event' ]) | 81 | @HostListener('window:beforeunload', [ '$event' ]) |
@@ -150,8 +151,8 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
150 | return this.liveVideoService.updateLive(this.video.id, liveVideoUpdate) | 151 | return this.liveVideoService.updateLive(this.video.id, liveVideoUpdate) |
151 | }) | 152 | }) |
152 | ) | 153 | ) |
153 | .subscribe( | 154 | .subscribe({ |
154 | () => { | 155 | next: () => { |
155 | this.updateDone = true | 156 | this.updateDone = true |
156 | this.isUpdatingVideo = false | 157 | this.isUpdatingVideo = false |
157 | this.loadingBar.useRef().complete() | 158 | this.loadingBar.useRef().complete() |
@@ -159,13 +160,13 @@ export class VideoUpdateComponent extends FormReactive implements OnInit { | |||
159 | this.router.navigateByUrl(Video.buildWatchUrl(this.video)) | 160 | this.router.navigateByUrl(Video.buildWatchUrl(this.video)) |
160 | }, | 161 | }, |
161 | 162 | ||
162 | err => { | 163 | error: err => { |
163 | this.loadingBar.useRef().complete() | 164 | this.loadingBar.useRef().complete() |
164 | this.isUpdatingVideo = false | 165 | this.isUpdatingVideo = false |
165 | this.notifier.error(err.message) | 166 | this.notifier.error(err.message) |
166 | console.error(err) | 167 | console.error(err) |
167 | } | 168 | } |
168 | ) | 169 | }) |
169 | } | 170 | } |
170 | 171 | ||
171 | hydratePluginFieldsFromVideo () { | 172 | hydratePluginFieldsFromVideo () { |
diff --git a/client/src/app/+videos/+video-watch/shared/action-buttons/video-rate.component.ts b/client/src/app/+videos/+video-watch/shared/action-buttons/video-rate.component.ts index ecb5a9281..48d48f33f 100644 --- a/client/src/app/+videos/+video-watch/shared/action-buttons/video-rate.component.ts +++ b/client/src/app/+videos/+video-watch/shared/action-buttons/video-rate.component.ts | |||
@@ -90,16 +90,16 @@ export class VideoRateComponent implements OnInit, OnChanges, OnDestroy { | |||
90 | if (this.isUserLoggedIn === false) return | 90 | if (this.isUserLoggedIn === false) return |
91 | 91 | ||
92 | this.videoService.getUserVideoRating(this.video.id) | 92 | this.videoService.getUserVideoRating(this.video.id) |
93 | .subscribe( | 93 | .subscribe({ |
94 | ratingObject => { | 94 | next: ratingObject => { |
95 | if (!ratingObject) return | 95 | if (!ratingObject) return |
96 | 96 | ||
97 | this.userRating = ratingObject.rating | 97 | this.userRating = ratingObject.rating |
98 | this.userRatingLoaded.emit(this.userRating) | 98 | this.userRatingLoaded.emit(this.userRating) |
99 | }, | 99 | }, |
100 | 100 | ||
101 | err => this.notifier.error(err.message) | 101 | error: err => this.notifier.error(err.message) |
102 | ) | 102 | }) |
103 | } | 103 | } |
104 | 104 | ||
105 | private setRating (nextRating: UserVideoRateType) { | 105 | private setRating (nextRating: UserVideoRateType) { |
@@ -110,16 +110,16 @@ export class VideoRateComponent implements OnInit, OnChanges, OnDestroy { | |||
110 | } | 110 | } |
111 | 111 | ||
112 | ratingMethods[nextRating].call(this.videoService, this.video.id) | 112 | ratingMethods[nextRating].call(this.videoService, this.video.id) |
113 | .subscribe( | 113 | .subscribe({ |
114 | () => { | 114 | next: () => { |
115 | // Update the video like attribute | 115 | // Update the video like attribute |
116 | this.updateVideoRating(this.userRating, nextRating) | 116 | this.updateVideoRating(this.userRating, nextRating) |
117 | this.userRating = nextRating | 117 | this.userRating = nextRating |
118 | this.rateUpdated.emit(this.userRating) | 118 | this.rateUpdated.emit(this.userRating) |
119 | }, | 119 | }, |
120 | 120 | ||
121 | (err: { message: string }) => this.notifier.error(err.message) | 121 | error: err => this.notifier.error(err.message) |
122 | ) | 122 | }) |
123 | } | 123 | } |
124 | 124 | ||
125 | private updateVideoRating (oldRating: UserVideoRateType, newRating: UserVideoRateType) { | 125 | private updateVideoRating (oldRating: UserVideoRateType, newRating: UserVideoRateType) { |
diff --git a/client/src/app/+videos/+video-watch/shared/comment/video-comment-add.component.ts b/client/src/app/+videos/+video-watch/shared/comment/video-comment-add.component.ts index 78efe1684..ac65f7260 100644 --- a/client/src/app/+videos/+video-watch/shared/comment/video-comment-add.component.ts +++ b/client/src/app/+videos/+video-watch/shared/comment/video-comment-add.component.ts | |||
@@ -137,19 +137,19 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges, | |||
137 | obs = this.addCommentThread(commentCreate) | 137 | obs = this.addCommentThread(commentCreate) |
138 | } | 138 | } |
139 | 139 | ||
140 | obs.subscribe( | 140 | obs.subscribe({ |
141 | comment => { | 141 | next: comment => { |
142 | this.addingComment = false | 142 | this.addingComment = false |
143 | this.commentCreated.emit(comment) | 143 | this.commentCreated.emit(comment) |
144 | this.form.reset() | 144 | this.form.reset() |
145 | }, | 145 | }, |
146 | 146 | ||
147 | err => { | 147 | error: err => { |
148 | this.addingComment = false | 148 | this.addingComment = false |
149 | 149 | ||
150 | this.notifier.error(err.text) | 150 | this.notifier.error(err.text) |
151 | } | 151 | } |
152 | ) | 152 | }) |
153 | } | 153 | } |
154 | 154 | ||
155 | isAddButtonDisplayed () { | 155 | isAddButtonDisplayed () { |
diff --git a/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.ts b/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.ts index 0e1c4c207..f858f4750 100644 --- a/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.ts +++ b/client/src/app/+videos/+video-watch/shared/comment/video-comment.component.ts | |||
@@ -149,11 +149,11 @@ export class VideoCommentComponent implements OnInit, OnChanges { | |||
149 | const user = this.authService.getUser() | 149 | const user = this.authService.getUser() |
150 | if (user.hasRight(UserRight.MANAGE_USERS)) { | 150 | if (user.hasRight(UserRight.MANAGE_USERS)) { |
151 | this.userService.getUserWithCache(account.userId) | 151 | this.userService.getUserWithCache(account.userId) |
152 | .subscribe( | 152 | .subscribe({ |
153 | user => this.commentUser = user, | 153 | next: user => this.commentUser = user, |
154 | 154 | ||
155 | err => this.notifier.error(err.message) | 155 | error: err => this.notifier.error(err.message) |
156 | ) | 156 | }) |
157 | } | 157 | } |
158 | } | 158 | } |
159 | 159 | ||
diff --git a/client/src/app/+videos/+video-watch/shared/comment/video-comments.component.ts b/client/src/app/+videos/+video-watch/shared/comment/video-comments.component.ts index 2c39e63fb..72866b874 100644 --- a/client/src/app/+videos/+video-watch/shared/comment/video-comments.component.ts +++ b/client/src/app/+videos/+video-watch/shared/comment/video-comments.component.ts | |||
@@ -90,22 +90,22 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
90 | 'filter:api.video-watch.video-thread-replies.list.result' | 90 | 'filter:api.video-watch.video-thread-replies.list.result' |
91 | ) | 91 | ) |
92 | 92 | ||
93 | obs.subscribe( | 93 | obs.subscribe({ |
94 | res => { | 94 | next: res => { |
95 | this.threadComments[commentId] = res | 95 | this.threadComments[commentId] = res |
96 | this.threadLoading[commentId] = false | 96 | this.threadLoading[commentId] = false |
97 | this.hooks.runAction('action:video-watch.video-thread-replies.loaded', 'video-watch', { data: res }) | 97 | this.hooks.runAction('action:video-watch.video-thread-replies.loaded', 'video-watch', { data: res }) |
98 | 98 | ||
99 | if (highlightThread) { | 99 | if (highlightThread) { |
100 | this.highlightedThread = new VideoComment(res.comment) | 100 | this.highlightedThread = new VideoComment(res.comment) |
101 | 101 | ||
102 | // Scroll to the highlighted thread | 102 | // Scroll to the highlighted thread |
103 | setTimeout(() => this.commentHighlightBlock.nativeElement.scrollIntoView(), 0) | 103 | setTimeout(() => this.commentHighlightBlock.nativeElement.scrollIntoView(), 0) |
104 | } | 104 | } |
105 | }, | 105 | }, |
106 | 106 | ||
107 | err => this.notifier.error(err.message) | 107 | error: err => this.notifier.error(err.message) |
108 | ) | 108 | }) |
109 | } | 109 | } |
110 | 110 | ||
111 | loadMoreThreads () { | 111 | loadMoreThreads () { |
@@ -123,8 +123,8 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
123 | 'filter:api.video-watch.video-threads.list.result' | 123 | 'filter:api.video-watch.video-threads.list.result' |
124 | ) | 124 | ) |
125 | 125 | ||
126 | obs.subscribe( | 126 | obs.subscribe({ |
127 | res => { | 127 | next: res => { |
128 | this.comments = this.comments.concat(res.data) | 128 | this.comments = this.comments.concat(res.data) |
129 | this.componentPagination.totalItems = res.total | 129 | this.componentPagination.totalItems = res.total |
130 | this.totalNotDeletedComments = res.totalNotDeletedComments | 130 | this.totalNotDeletedComments = res.totalNotDeletedComments |
@@ -133,8 +133,8 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
133 | this.hooks.runAction('action:video-watch.video-threads.loaded', 'video-watch', { data: this.componentPagination }) | 133 | this.hooks.runAction('action:video-watch.video-threads.loaded', 'video-watch', { data: this.componentPagination }) |
134 | }, | 134 | }, |
135 | 135 | ||
136 | err => this.notifier.error(err.message) | 136 | error: err => this.notifier.error(err.message) |
137 | ) | 137 | }) |
138 | } | 138 | } |
139 | 139 | ||
140 | onCommentThreadCreated (comment: VideoComment) { | 140 | onCommentThreadCreated (comment: VideoComment) { |
@@ -181,8 +181,8 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
181 | if (res === false) return false | 181 | if (res === false) return false |
182 | 182 | ||
183 | this.videoCommentService.deleteVideoComment(commentToDelete.videoId, commentToDelete.id) | 183 | this.videoCommentService.deleteVideoComment(commentToDelete.videoId, commentToDelete.id) |
184 | .subscribe( | 184 | .subscribe({ |
185 | () => { | 185 | next: () => { |
186 | if (this.highlightedThread?.id === commentToDelete.id) { | 186 | if (this.highlightedThread?.id === commentToDelete.id) { |
187 | commentToDelete = this.comments.find(c => c.id === commentToDelete.id) | 187 | commentToDelete = this.comments.find(c => c.id === commentToDelete.id) |
188 | 188 | ||
@@ -193,8 +193,8 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy { | |||
193 | this.softDeleteComment(commentToDelete) | 193 | this.softDeleteComment(commentToDelete) |
194 | }, | 194 | }, |
195 | 195 | ||
196 | err => this.notifier.error(err.message) | 196 | error: err => this.notifier.error(err.message) |
197 | ) | 197 | }) |
198 | 198 | ||
199 | return true | 199 | return true |
200 | } | 200 | } |
diff --git a/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts b/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts index 870c7ae3f..e002b3c22 100644 --- a/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts +++ b/client/src/app/+videos/+video-watch/shared/metadata/video-description.component.ts | |||
@@ -50,8 +50,8 @@ export class VideoDescriptionComponent implements OnChanges { | |||
50 | this.descriptionLoading = true | 50 | this.descriptionLoading = true |
51 | 51 | ||
52 | this.videoService.loadCompleteDescription(this.video.descriptionPath) | 52 | this.videoService.loadCompleteDescription(this.video.descriptionPath) |
53 | .subscribe( | 53 | .subscribe({ |
54 | description => { | 54 | next: description => { |
55 | this.completeDescriptionShown = true | 55 | this.completeDescriptionShown = true |
56 | this.descriptionLoading = false | 56 | this.descriptionLoading = false |
57 | 57 | ||
@@ -61,11 +61,11 @@ export class VideoDescriptionComponent implements OnChanges { | |||
61 | this.updateVideoDescription(this.completeVideoDescription) | 61 | this.updateVideoDescription(this.completeVideoDescription) |
62 | }, | 62 | }, |
63 | 63 | ||
64 | error => { | 64 | error: err => { |
65 | this.descriptionLoading = false | 65 | this.descriptionLoading = false |
66 | this.notifier.error(error.message) | 66 | this.notifier.error(err.message) |
67 | } | 67 | } |
68 | ) | 68 | }) |
69 | } | 69 | } |
70 | 70 | ||
71 | onTimestampClicked (timestamp: number) { | 71 | onTimestampClicked (timestamp: number) { |
diff --git a/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts b/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts index 8b3ed4964..f0f7966b1 100644 --- a/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts +++ b/client/src/app/+videos/+video-watch/shared/playlist/video-watch-playlist.component.ts | |||
@@ -1,4 +1,3 @@ | |||
1 | |||
2 | import { Component, EventEmitter, Input, Output } from '@angular/core' | 1 | import { Component, EventEmitter, Input, Output } from '@angular/core' |
3 | import { Router } from '@angular/router' | 2 | import { Router } from '@angular/router' |
4 | import { AuthService, ComponentPagination, LocalStorageService, Notifier, SessionStorageService, UserService } from '@app/core' | 3 | import { AuthService, ComponentPagination, LocalStorageService, Notifier, SessionStorageService, UserService } from '@app/core' |
@@ -196,12 +195,14 @@ export class VideoWatchPlaylistComponent { | |||
196 | autoPlayNextVideoPlaylist: this.autoPlayNextVideoPlaylist | 195 | autoPlayNextVideoPlaylist: this.autoPlayNextVideoPlaylist |
197 | } | 196 | } |
198 | 197 | ||
199 | this.userService.updateMyProfile(details).subscribe( | 198 | this.userService.updateMyProfile(details) |
200 | () => { | 199 | .subscribe({ |
201 | this.auth.refreshUserInformation() | 200 | next: () => { |
202 | }, | 201 | this.auth.refreshUserInformation() |
203 | err => this.notifier.error(err.message) | 202 | }, |
204 | ) | 203 | |
204 | error: err => this.notifier.error(err.message) | ||
205 | }) | ||
205 | } | 206 | } |
206 | } | 207 | } |
207 | 208 | ||
diff --git a/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.ts b/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.ts index 89b9c01b6..7f3703c08 100644 --- a/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.ts +++ b/client/src/app/+videos/+video-watch/shared/recommendations/recommended-videos.component.ts | |||
@@ -84,12 +84,14 @@ export class RecommendedVideosComponent implements OnInit, OnChanges { | |||
84 | autoPlayNextVideo: this.autoPlayNextVideo | 84 | autoPlayNextVideo: this.autoPlayNextVideo |
85 | } | 85 | } |
86 | 86 | ||
87 | this.userService.updateMyProfile(details).subscribe( | 87 | this.userService.updateMyProfile(details) |
88 | () => { | 88 | .subscribe({ |
89 | this.authService.refreshUserInformation() | 89 | next: () => { |
90 | }, | 90 | this.authService.refreshUserInformation() |
91 | err => this.notifier.error(err.message) | 91 | }, |
92 | ) | 92 | |
93 | error: err => this.notifier.error(err.message) | ||
94 | }) | ||
93 | } | 95 | } |
94 | } | 96 | } |
95 | } | 97 | } |
diff --git a/client/src/app/+videos/+video-watch/video-watch.component.ts b/client/src/app/+videos/+video-watch/video-watch.component.ts index ccb9c5e71..85100b653 100644 --- a/client/src/app/+videos/+video-watch/video-watch.component.ts +++ b/client/src/app/+videos/+video-watch/video-watch.component.ts | |||
@@ -238,8 +238,8 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
238 | ) | 238 | ) |
239 | 239 | ||
240 | forkJoin([ videoObs, this.videoCaptionService.listCaptions(videoId)]) | 240 | forkJoin([ videoObs, this.videoCaptionService.listCaptions(videoId)]) |
241 | .subscribe( | 241 | .subscribe({ |
242 | ([ video, captionsResult ]) => { | 242 | next: ([ video, captionsResult ]) => { |
243 | const queryParams = this.route.snapshot.queryParams | 243 | const queryParams = this.route.snapshot.queryParams |
244 | 244 | ||
245 | const urlOptions = { | 245 | const urlOptions = { |
@@ -260,23 +260,23 @@ export class VideoWatchComponent implements OnInit, OnDestroy { | |||
260 | .catch(err => this.handleGlobalError(err)) | 260 | .catch(err => this.handleGlobalError(err)) |
261 | }, | 261 | }, |
262 | 262 | ||
263 | err => this.handleRequestError(err) | 263 | error: err => this.handleRequestError(err) |
264 | ) | 264 | }) |
265 | } | 265 | } |
266 | 266 | ||
267 | private loadPlaylist (playlistId: string) { | 267 | private loadPlaylist (playlistId: string) { |
268 | if (this.isSameElement(this.playlist, playlistId)) return | 268 | if (this.isSameElement(this.playlist, playlistId)) return |
269 | 269 | ||
270 | this.playlistService.getVideoPlaylist(playlistId) | 270 | this.playlistService.getVideoPlaylist(playlistId) |
271 | .subscribe( | 271 | .subscribe({ |
272 | playlist => { | 272 | next: playlist => { |
273 | this.playlist = playlist | 273 | this.playlist = playlist |
274 | 274 | ||
275 | this.videoWatchPlaylist.loadPlaylistElements(playlist, !this.playlistPosition, this.playlistPosition) | 275 | this.videoWatchPlaylist.loadPlaylistElements(playlist, !this.playlistPosition, this.playlistPosition) |
276 | }, | 276 | }, |
277 | 277 | ||
278 | err => this.handleRequestError(err) | 278 | error: err => this.handleRequestError(err) |
279 | ) | 279 | }) |
280 | } | 280 | } |
281 | 281 | ||
282 | private isSameElement (element: VideoDetails | VideoPlaylist, newId: string) { | 282 | private isSameElement (element: VideoDetails | VideoPlaylist, newId: string) { |
diff --git a/client/src/app/+videos/video-list/overview/video-overview.component.ts b/client/src/app/+videos/video-list/overview/video-overview.component.ts index 14532ca1e..b32e8f381 100644 --- a/client/src/app/+videos/video-list/overview/video-overview.component.ts +++ b/client/src/app/+videos/video-list/overview/video-overview.component.ts | |||
@@ -68,8 +68,8 @@ export class VideoOverviewComponent implements OnInit { | |||
68 | this.isLoading = true | 68 | this.isLoading = true |
69 | 69 | ||
70 | this.overviewService.getVideosOverview(this.currentPage) | 70 | this.overviewService.getVideosOverview(this.currentPage) |
71 | .subscribe( | 71 | .subscribe({ |
72 | overview => { | 72 | next: overview => { |
73 | this.isLoading = false | 73 | this.isLoading = false |
74 | 74 | ||
75 | if (overview.tags.length === 0 && overview.channels.length === 0 && overview.categories.length === 0) { | 75 | if (overview.tags.length === 0 && overview.channels.length === 0 && overview.categories.length === 0) { |
@@ -85,10 +85,10 @@ export class VideoOverviewComponent implements OnInit { | |||
85 | this.overviews.push(overview) | 85 | this.overviews.push(overview) |
86 | }, | 86 | }, |
87 | 87 | ||
88 | err => { | 88 | error: err => { |
89 | this.notifier.error(err.message) | 89 | this.notifier.error(err.message) |
90 | this.isLoading = false | 90 | this.isLoading = false |
91 | } | 91 | } |
92 | ) | 92 | }) |
93 | } | 93 | } |
94 | } | 94 | } |
diff --git a/client/src/app/+videos/video-list/video-user-subscriptions.component.ts b/client/src/app/+videos/video-list/video-user-subscriptions.component.ts index 6aabb93a5..a1498e797 100644 --- a/client/src/app/+videos/video-list/video-user-subscriptions.component.ts +++ b/client/src/app/+videos/video-list/video-user-subscriptions.component.ts | |||
@@ -56,8 +56,8 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement | |||
56 | 56 | ||
57 | this.authService.userInformationLoaded | 57 | this.authService.userInformationLoaded |
58 | .pipe(switchMap(() => this.scopedTokensService.getScopedTokens())) | 58 | .pipe(switchMap(() => this.scopedTokensService.getScopedTokens())) |
59 | .subscribe( | 59 | .subscribe({ |
60 | tokens => { | 60 | next: tokens => { |
61 | const feeds = this.videoService.getVideoSubscriptionFeedUrls(user.account.id, tokens.feedToken) | 61 | const feeds = this.videoService.getVideoSubscriptionFeedUrls(user.account.id, tokens.feedToken) |
62 | feedUrl = feedUrl + feeds.find(f => f.format === FeedFormat.RSS).url | 62 | feedUrl = feedUrl + feeds.find(f => f.format === FeedFormat.RSS).url |
63 | 63 | ||
@@ -74,10 +74,10 @@ export class VideoUserSubscriptionsComponent extends AbstractVideoList implement | |||
74 | }) | 74 | }) |
75 | }, | 75 | }, |
76 | 76 | ||
77 | err => { | 77 | error: err => { |
78 | this.notifier.error(err.message) | 78 | this.notifier.error(err.message) |
79 | } | 79 | } |
80 | ) | 80 | }) |
81 | } | 81 | } |
82 | 82 | ||
83 | ngOnDestroy () { | 83 | ngOnDestroy () { |