Fix fetching unlisted video in client

pull/5098/head
Chocobozzz 2022-06-24 14:47:32 +02:00
parent 978489b64c
commit 7c07259ae5
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
8 changed files with 19 additions and 19 deletions

View File

@ -78,7 +78,7 @@ export class VideoImportUrlComponent extends VideoSend implements OnInit, AfterV
.pipe( .pipe(
switchMap(res => { switchMap(res => {
return this.videoCaptionService return this.videoCaptionService
.listCaptions(res.video.id) .listCaptions(res.video.uuid)
.pipe( .pipe(
map(result => ({ video: res.video, videoCaptions: result.data })) map(result => ({ video: res.video, videoCaptions: result.data }))
) )

View File

@ -39,7 +39,7 @@ export class VideoUpdateResolver implements Resolve<any> {
listUserChannelsForSelect(this.authService), listUserChannelsForSelect(this.authService),
this.videoCaptionService this.videoCaptionService
.listCaptions(video.id) .listCaptions(video.uuid)
.pipe( .pipe(
map(result => result.data) map(result => result.data)
), ),

View File

@ -89,7 +89,7 @@ export class VideoRateComponent implements OnInit, OnChanges, OnDestroy {
// Unlogged users do not have ratings // Unlogged users do not have ratings
if (this.isUserLoggedIn === false) return if (this.isUserLoggedIn === false) return
this.videoService.getUserVideoRating(this.video.id) this.videoService.getUserVideoRating(this.video.uuid)
.subscribe({ .subscribe({
next: ratingObject => { next: ratingObject => {
if (!ratingObject) return if (!ratingObject) return
@ -103,13 +103,13 @@ export class VideoRateComponent implements OnInit, OnChanges, OnDestroy {
} }
private setRating (nextRating: UserVideoRateType) { private setRating (nextRating: UserVideoRateType) {
const ratingMethods: { [id in UserVideoRateType]: (id: number) => Observable<any> } = { const ratingMethods: { [id in UserVideoRateType]: (id: string) => Observable<any> } = {
like: this.videoService.setVideoLike, like: this.videoService.setVideoLike,
dislike: this.videoService.setVideoDislike, dislike: this.videoService.setVideoDislike,
none: this.videoService.unsetVideoLike none: this.videoService.unsetVideoLike
} }
ratingMethods[nextRating].call(this.videoService, this.video.id) ratingMethods[nextRating].call(this.videoService, this.video.uuid)
.subscribe({ .subscribe({
next: () => { next: () => {
// Update the video like attribute // Update the video like attribute

View File

@ -176,12 +176,12 @@ export class VideoCommentAddComponent extends FormReactive implements OnChanges,
private addCommentReply (commentCreate: VideoCommentCreate) { private addCommentReply (commentCreate: VideoCommentCreate) {
return this.videoCommentService return this.videoCommentService
.addCommentReply(this.video.id, this.parentComment.id, commentCreate) .addCommentReply(this.video.uuid, this.parentComment.id, commentCreate)
} }
private addCommentThread (commentCreate: VideoCommentCreate) { private addCommentThread (commentCreate: VideoCommentCreate) {
return this.videoCommentService return this.videoCommentService
.addCommentThread(this.video.id, commentCreate) .addCommentThread(this.video.uuid, commentCreate)
} }
private initTextValue () { private initTextValue () {

View File

@ -78,7 +78,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
this.threadLoading[commentId] = true this.threadLoading[commentId] = true
const params = { const params = {
videoId: this.video.id, videoId: this.video.uuid,
threadId: commentId threadId: commentId
} }
@ -110,7 +110,7 @@ export class VideoCommentsComponent implements OnInit, OnChanges, OnDestroy {
loadMoreThreads () { loadMoreThreads () {
const params = { const params = {
videoId: this.video.id, videoId: this.video.uuid,
componentPagination: this.componentPagination, componentPagination: this.componentPagination,
sort: this.sort sort: this.sort
} }

View File

@ -18,7 +18,7 @@ export class VideoCaptionService {
private restExtractor: RestExtractor private restExtractor: RestExtractor
) {} ) {}
listCaptions (videoId: number | string): Observable<ResultList<VideoCaption>> { listCaptions (videoId: string): Observable<ResultList<VideoCaption>> {
return this.authHttp.get<ResultList<VideoCaption>>(`${VideoService.BASE_VIDEO_URL}/${videoId}/captions`) return this.authHttp.get<ResultList<VideoCaption>>(`${VideoService.BASE_VIDEO_URL}/${videoId}/captions`)
.pipe( .pipe(
switchMap(captionsResult => { switchMap(captionsResult => {

View File

@ -338,19 +338,19 @@ export class VideoService {
) )
} }
setVideoLike (id: number) { setVideoLike (id: string) {
return this.setVideoRate(id, 'like') return this.setVideoRate(id, 'like')
} }
setVideoDislike (id: number) { setVideoDislike (id: string) {
return this.setVideoRate(id, 'dislike') return this.setVideoRate(id, 'dislike')
} }
unsetVideoLike (id: number) { unsetVideoLike (id: string) {
return this.setVideoRate(id, 'none') return this.setVideoRate(id, 'none')
} }
getUserVideoRating (id: number) { getUserVideoRating (id: string) {
const url = UserService.BASE_USERS_URL + 'me/videos/' + id + '/rating' const url = UserService.BASE_USERS_URL + 'me/videos/' + id + '/rating'
return this.authHttp.get<UserVideoRate>(url) return this.authHttp.get<UserVideoRate>(url)
@ -466,7 +466,7 @@ export class VideoService {
} }
} }
private setVideoRate (id: number, rateType: UserVideoRateType) { private setVideoRate (id: string, rateType: UserVideoRateType) {
const url = `${VideoService.BASE_VIDEO_URL}/${id}/rate` const url = `${VideoService.BASE_VIDEO_URL}/${id}/rate`
const body: UserVideoRateUpdate = { const body: UserVideoRateUpdate = {
rating: rateType rating: rateType

View File

@ -31,7 +31,7 @@ export class VideoCommentService {
private restService: RestService private restService: RestService
) {} ) {}
addCommentThread (videoId: number | string, comment: VideoCommentCreate) { addCommentThread (videoId: string, comment: VideoCommentCreate) {
const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comment-threads' const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comment-threads'
const normalizedComment = objectLineFeedToHtml(comment, 'text') const normalizedComment = objectLineFeedToHtml(comment, 'text')
@ -42,7 +42,7 @@ export class VideoCommentService {
) )
} }
addCommentReply (videoId: number | string, inReplyToCommentId: number, comment: VideoCommentCreate) { addCommentReply (videoId: string, inReplyToCommentId: number, comment: VideoCommentCreate) {
const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comments/' + inReplyToCommentId const url = VideoCommentService.BASE_VIDEO_URL + videoId + '/comments/' + inReplyToCommentId
const normalizedComment = objectLineFeedToHtml(comment, 'text') const normalizedComment = objectLineFeedToHtml(comment, 'text')
@ -75,7 +75,7 @@ export class VideoCommentService {
} }
getVideoCommentThreads (parameters: { getVideoCommentThreads (parameters: {
videoId: number | string videoId: string
componentPagination: ComponentPaginationLight componentPagination: ComponentPaginationLight
sort: string sort: string
}): Observable<ThreadsResultList<VideoComment>> { }): Observable<ThreadsResultList<VideoComment>> {
@ -95,7 +95,7 @@ export class VideoCommentService {
} }
getVideoThreadComments (parameters: { getVideoThreadComments (parameters: {
videoId: number | string videoId: string
threadId: number threadId: number
}): Observable<VideoCommentThreadTree> { }): Observable<VideoCommentThreadTree> {
const { videoId, threadId } = parameters const { videoId, threadId } = parameters