ActivityPub-federated video streaming platform using P2P directly in your web browser
Fix listing channels of a playlist
Chocobozzza0473148c806
diff --git a/client/src/app/+my-library/my-video-playlists/my-video-playlist-update.component.ts b/client/src/app/+my-library/my-video-playlists/my-video-playlist-update.component.tsindex 97701f2f7a..0815acb13f 100644--- a/client/src/app/+my-library/my-video-playlists/my-video-playlist-update.component.ts+++ b/client/src/app/+my-library/my-video-playlists/my-video-playlist-update.component.ts@@ -12,7 +12,7 @@ import {} from '@app/shared/form-validators/video-playlist-validators'import { FormReactiveService } from '@app/shared/shared-forms/form-reactive.service'import { PeertubeCheckboxComponent } from '@app/shared/shared-forms/peertube-checkbox.component'-import { listChannelsForSelect } from '@app/shared/shared-forms/select/channel/select-channel-helpers'+import { isSameOwnerForAccountId, listChannelsForSelect } from '@app/shared/shared-forms/select/channel/select-channel-helpers'import { SelectChannelUserComponent } from '@app/shared/shared-forms/select/channel/select-channel-user.component'import { AlertComponent } from '@app/shared/shared-main/common/alert.component'import { VideoPlaylistService } from '@app/shared/shared-video-playlist/video-playlist.service'@@ -94,7 +94,16 @@ export class MyVideoPlaylistUpdateComponent extends MyVideoPlaylistEdit implemennext: ([ { videoPlaylist, channels }, videoPlaylistPrivacies ]) => {this.videoPlaylistToUpdate = videoPlaylistthis.videoPlaylistPrivacies = videoPlaylistPrivacies- this.channels = channels.filter(c => c.ownerAccountId === this.videoPlaylistToUpdate.ownerAccount.id)++ const user = this.authService.getUser()++ this.channels = channels.filter(c => {+ return isSameOwnerForAccountId({+ user,+ channel: c,+ accountId: this.videoPlaylistToUpdate.ownerAccount.id+ })+ })this.hydrateFormFromPlaylist()},diff --git a/client/src/app/shared/shared-forms/select/channel/select-channel-helpers.ts b/client/src/app/shared/shared-forms/select/channel/select-channel-helpers.tsindex 0f0cf5f4d5..1ef281b8a0 100644--- a/client/src/app/shared/shared-forms/select/channel/select-channel-helpers.ts+++ b/client/src/app/shared/shared-forms/select/channel/select-channel-helpers.ts@@ -58,6 +58,8 @@ export function formatChannelForSelect (channel: UserVideoChannel, options: {imageUrl: getAvatarFileUrl(channel),displayName: channel.displayName,++ // Not filled for owned channelsownerAccountId: channel.ownerAccountId,ownerAccountName: channel.ownerAccountName,@@ -65,6 +67,19 @@ export function formatChannelForSelect (channel: UserVideoChannel, options: {}}+export function isSameOwnerForAccountId (options: {+ user: { account: { id: number } }+ channel: Pick<SelectChannelItem, 'owner' | 'ownerAccountId'>+ accountId: number+}) {+ const { user, channel, accountId } = options++ // ownerAccountId is not filled for owned channels+ if (channel.owner) return user.account.id === accountId++ return channel.ownerAccountId && channel.ownerAccountId === accountId+}+// ---------------------------------------------------------------------------// Private// ---------------------------------------------------------------------------