Skip to content

ActivityPub-federated video streaming platform using P2P directly in your web browser

Correctly update playlists state

Chocobozzzbd11b153fb31
diff --git a/client/src/app/+accounts/routes.ts b/client/src/app/+accounts/routes.ts
index a5ea611155..de8d9bbc07 100644
--- a/client/src/app/+accounts/routes.ts
+++ b/client/src/app/+accounts/routes.ts
@@ -5,7 +5,6 @@ import { BulkService } from '@app/shared/shared-moderation/bulk.service'
import { VideoBlockService } from '@app/shared/shared-moderation/video-block.service'
import { UserSubscriptionService } from '@app/shared/shared-user-subscription/user-subscription.service'
import { UserAdminService } from '@app/shared/shared-users/user-admin.service'
-import { VideoPlaylistService } from '@app/shared/shared-video-playlist/video-playlist.service'
import { AccountVideoChannelsComponent } from './account-video-channels/account-video-channels.component'
import { AccountVideosComponent } from './account-videos/account-videos.component'
import { AccountsComponent } from './accounts.component'
@@ -21,7 +20,6 @@ export default [
providers: [
UserSubscriptionService,
BlocklistService,
- VideoPlaylistService,
VideoBlockService,
AbuseService,
UserAdminService,
diff --git a/client/src/app/+admin/routes.ts b/client/src/app/+admin/routes.ts
index 9e3f43915c..e864d96cc8 100644
--- a/client/src/app/+admin/routes.ts
+++ b/client/src/app/+admin/routes.ts
@@ -16,7 +16,6 @@ import { SearchService } from '@app/shared/shared-search/search.service'
import { TwoFactorService } from '@app/shared/shared-users/two-factor.service'
import { UserAdminService } from '@app/shared/shared-users/user-admin.service'
import { VideoCommentService } from '@app/shared/shared-video-comment/video-comment.service'
-import { VideoPlaylistService } from '@app/shared/shared-video-playlist/video-playlist.service'
import { WatchedWordsListService } from '@app/shared/standalone-watched-words/watched-words-list.service'
import { AdminModerationComponent } from './admin-moderation.component'
import { AdminOverviewComponent } from './admin-overview.component'
@@ -52,7 +51,6 @@ const commonConfig = {
DynamicElementService,
FindInBulkService,
SearchService,
- VideoPlaylistService,
WatchedWordsListService
]
}
diff --git a/client/src/app/+home/routes.ts b/client/src/app/+home/routes.ts
index e5b60dd0d8..df9a6d8ff0 100644
--- a/client/src/app/+home/routes.ts
+++ b/client/src/app/+home/routes.ts
@@ -7,7 +7,6 @@ import { BlocklistService } from '@app/shared/shared-moderation/blocklist.servic
import { VideoBlockService } from '@app/shared/shared-moderation/video-block.service'
import { FindInBulkService } from '@app/shared/shared-search/find-in-bulk.service'
import { SearchService } from '@app/shared/shared-search/search.service'
-import { VideoPlaylistService } from '@app/shared/shared-video-playlist/video-playlist.service'
import { AbuseService } from '@app/shared/shared-moderation/abuse.service'
export default [
@@ -18,7 +17,6 @@ export default [
CustomPageService,
FindInBulkService,
SearchService,
- VideoPlaylistService,
CustomMarkupService,
DynamicElementService,
BlocklistService,
diff --git a/client/src/app/+my-library/my-video-playlists/my-video-playlists.component.html b/client/src/app/+my-library/my-video-playlists/my-video-playlists.component.html
index 4968a2c3c8..63705404bc 100644
--- a/client/src/app/+my-library/my-video-playlists/my-video-playlists.component.html
+++ b/client/src/app/+my-library/my-video-playlists/my-video-playlists.component.html
@@ -79,7 +79,7 @@
<my-privacy-badge [playlist]="playlist"></my-privacy-badge>
</td>
- <td *ngIf="table.isColumnDisplayed('updated')">
+ <td *ngIf="table.isColumnDisplayed('updatedAt')">
{{ playlist.updatedAt | ptDate: 'short' }}
</td>
</ng-template>
diff --git a/client/src/app/+my-library/my-video-playlists/my-video-playlists.component.ts b/client/src/app/+my-library/my-video-playlists/my-video-playlists.component.ts
index 685137ebce..515d123624 100644
--- a/client/src/app/+my-library/my-video-playlists/my-video-playlists.component.ts
+++ b/client/src/app/+my-library/my-video-playlists/my-video-playlists.component.ts
@@ -25,7 +25,7 @@ import { VideoPlaylistMiniatureComponent } from '../../shared/shared-video-playl
import { PrivacyBadgeComponent } from '../../shared/shared-video/privacy-badge.component'
import { ChannelToggleComponent } from '../../shared/standalone-channels/channel-toggle.component'
-type ColumnName = 'videoChannelPosition' | 'videos' | 'name' | 'privacy' | 'updated'
+type ColumnName = 'videoChannelPosition' | 'videos' | 'name' | 'privacy' | 'updatedAt'
type QueryParams = TableQueryParams & {
channelName?: string
@@ -104,7 +104,7 @@ export class MyVideoPlaylistsComponent implements OnInit, OnDestroy {
{ id: 'videos', label: $localize`Videos`, selected: true, sortable: false },
{ id: 'name', label: $localize`Name`, selected: true, sortable: true },
{ id: 'privacy', label: $localize`Privacy`, selected: true, sortable: false },
- { id: 'updated', label: $localize`Updated`, selected: true, sortable: false }
+ { id: 'updatedAt', label: $localize`Updated`, selected: true, sortable: true }
]
}
diff --git a/client/src/app/+my-library/routes.ts b/client/src/app/+my-library/routes.ts
index 178b4e1516..ffcdcd87fa 100644
--- a/client/src/app/+my-library/routes.ts
+++ b/client/src/app/+my-library/routes.ts
@@ -7,7 +7,6 @@ import { VideoBlockService } from '@app/shared/shared-moderation/video-block.ser
import { UserSubscriptionService } from '@app/shared/shared-user-subscription/user-subscription.service'
import { VideoCommentService } from '@app/shared/shared-video-comment/video-comment.service'
import { LiveVideoService } from '@app/shared/shared-video-live/live-video.service'
-import { VideoPlaylistService } from '@app/shared/shared-video-playlist/video-playlist.service'
import { WatchedWordsListService } from '@app/shared/standalone-watched-words/watched-words-list.service'
import { LoginGuard } from '../core'
import { CommentsOnMyVideosComponent } from './comments-on-my-videos/comments-on-my-videos.component'
@@ -33,7 +32,6 @@ import { MyWatchedWordsListComponent } from './my-watched-words-list/my-watched-
const commonConfig = {
path: '',
providers: [
- VideoPlaylistService,
BlocklistService,
VideoBlockService,
AbuseService,
diff --git a/client/src/app/+remote-interaction/routes.ts b/client/src/app/+remote-interaction/routes.ts
index c428e45413..c4c1090f74 100644
--- a/client/src/app/+remote-interaction/routes.ts
+++ b/client/src/app/+remote-interaction/routes.ts
@@ -3,7 +3,6 @@ import { LoginGuard } from '@app/core'
import { RemoteInteractionComponent } from './remote-interaction.component'
import { FindInBulkService } from '@app/shared/shared-search/find-in-bulk.service'
import { SearchService } from '@app/shared/shared-search/search.service'
-import { VideoPlaylistService } from '@app/shared/shared-video-playlist/video-playlist.service'
export default [
{
@@ -11,8 +10,7 @@ export default [
component: RemoteInteractionComponent,
providers: [
FindInBulkService,
- SearchService,
- VideoPlaylistService
+ SearchService
],
canActivate: [ LoginGuard ],
data: {
diff --git a/client/src/app/+search/routes.ts b/client/src/app/+search/routes.ts
index 993ad3653d..84559a8fc0 100644
--- a/client/src/app/+search/routes.ts
+++ b/client/src/app/+search/routes.ts
@@ -3,7 +3,6 @@ import { SearchComponent } from './search.component'
import { ChannelLazyLoadResolver, PlaylistLazyLoadResolver, VideoLazyLoadResolver } from './shared'
import { UserSubscriptionService } from '../shared/shared-user-subscription/user-subscription.service'
import { SearchService } from '@app/shared/shared-search/search.service'
-import { VideoPlaylistService } from '@app/shared/shared-video-playlist/video-playlist.service'
import { VideoBlockService } from '@app/shared/shared-moderation/video-block.service'
import { BlocklistService } from '@app/shared/shared-moderation/blocklist.service'
import { AbuseService } from '@app/shared/shared-moderation/abuse.service'
@@ -19,7 +18,6 @@ export default [
},
providers: [
SearchService,
- VideoPlaylistService,
UserSubscriptionService,
BlocklistService,
VideoBlockService,
diff --git a/client/src/app/+video-channels/routes.ts b/client/src/app/+video-channels/routes.ts
index 3e23b4614c..6471dd5942 100644
--- a/client/src/app/+video-channels/routes.ts
+++ b/client/src/app/+video-channels/routes.ts
@@ -7,14 +7,12 @@ import { BlocklistService } from '@app/shared/shared-moderation/blocklist.servic
import { BulkService } from '@app/shared/shared-moderation/bulk.service'
import { VideoBlockService } from '@app/shared/shared-moderation/video-block.service'
import { UserSubscriptionService } from '@app/shared/shared-user-subscription/user-subscription.service'
-import { VideoPlaylistService } from '@app/shared/shared-video-playlist/video-playlist.service'
export default [
{
path: ':videoChannelName',
component: VideoChannelsComponent,
providers: [
- VideoPlaylistService,
UserSubscriptionService,
BlocklistService,
BulkService,
diff --git a/client/src/app/+video-list/routes.ts b/client/src/app/+video-list/routes.ts
index 445f2c3bac..32f72bcc98 100644
--- a/client/src/app/+video-list/routes.ts
+++ b/client/src/app/+video-list/routes.ts
@@ -5,10 +5,10 @@ import { AbuseService } from '@app/shared/shared-moderation/abuse.service'
import { BlocklistService } from '@app/shared/shared-moderation/blocklist.service'
import { VideoBlockService } from '@app/shared/shared-moderation/video-block.service'
import { UserSubscriptionService } from '@app/shared/shared-user-subscription/user-subscription.service'
-import { VideoPlaylistService } from '@app/shared/shared-video-playlist/video-playlist.service'
-import { OverviewService, VideosListAllComponent } from '.'
+import { OverviewService } from './overview'
import { VideoOverviewComponent } from './overview/video-overview.component'
import { VideoUserSubscriptionsComponent } from './video-user-subscriptions.component'
+import { VideosListAllComponent } from './videos-list-all.component'
export default [
{
@@ -16,7 +16,6 @@ export default [
providers: [
OverviewService,
UserSubscriptionService,
- VideoPlaylistService,
BlocklistService,
VideoBlockService,
AbuseService
diff --git a/client/src/app/+video-watch/routes.ts b/client/src/app/+video-watch/routes.ts
index 46fc604b3a..121aca8b69 100644
--- a/client/src/app/+video-watch/routes.ts
+++ b/client/src/app/+video-watch/routes.ts
@@ -8,7 +8,6 @@ import { UserSubscriptionService } from '@app/shared/shared-user-subscription/us
import { UserAdminService } from '@app/shared/shared-users/user-admin.service'
import { VideoCommentService } from '@app/shared/shared-video-comment/video-comment.service'
import { LiveVideoService } from '@app/shared/shared-video-live/live-video.service'
-import { VideoPlaylistService } from '@app/shared/shared-video-playlist/video-playlist.service'
import { PlayerSettingsService } from '@app/shared/shared-video/player-settings.service'
import { VideoStateMessageService } from '@app/shared/shared-video/video-state-message.service'
import { OverviewService } from '../+video-list'
@@ -21,7 +20,6 @@ export default [
providers: [
OverviewService,
UserSubscriptionService,
- VideoPlaylistService,
BlocklistService,
VideoBlockService,
LiveVideoService,
diff --git a/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts b/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts
index 410ed4098f..030926afb2 100644
--- a/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts
+++ b/client/src/app/shared/shared-video-playlist/video-add-to-playlist.component.ts
@@ -87,7 +87,8 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit,
private disabled = false
- private listenToPlaylistChangeSub: Subscription
+ private listenToVideoPlaylistChangeSub: Subscription
+ private listenToAccountPlaylistsChangeSub: Subscription
private playlistsData: CachedPlaylist[] = []
private pendingAddId: number
@@ -101,7 +102,7 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit,
displayName: VIDEO_PLAYLIST_DISPLAY_NAME_VALIDATOR
})
- this.videoPlaylistService.listenToMyAccountPlaylistsChange()
+ this.listenToAccountPlaylistsChangeSub = this.videoPlaylistService.listenToMyAccountPlaylistsChange()
.subscribe(result => {
this.playlistsData = result.data
@@ -121,6 +122,8 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit,
ngOnDestroy () {
this.unsubscribePlaylistChanges()
+
+ this.listenToAccountPlaylistsChangeSub?.unsubscribe()
}
disableForReuse () {
@@ -338,15 +341,15 @@ export class VideoAddToPlaylistComponent extends FormReactive implements OnInit,
private listenToVideoPlaylistChange () {
this.unsubscribePlaylistChanges()
- this.listenToPlaylistChangeSub = this.videoPlaylistService.listenToVideoPlaylistChange(this.video().id)
+ this.listenToVideoPlaylistChangeSub = this.videoPlaylistService.listenToVideoPlaylistChange(this.video().id)
.pipe(filter(() => this.disabled === false))
.subscribe(existResult => this.rebuildPlaylists(existResult))
}
private unsubscribePlaylistChanges () {
- if (this.listenToPlaylistChangeSub) {
- this.listenToPlaylistChangeSub.unsubscribe()
- this.listenToPlaylistChangeSub = undefined
+ if (this.listenToVideoPlaylistChangeSub) {
+ this.listenToVideoPlaylistChangeSub.unsubscribe()
+ this.listenToVideoPlaylistChangeSub = undefined
}
}
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 7df2c6c4ec..b1dfd92d23 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
@@ -33,7 +33,7 @@ const debugLogger = debug('peertube:playlists:VideoPlaylistService')
export type CachedPlaylist = VideoPlaylist | { id: number, displayName: string }
-@Injectable()
+@Injectable({ providedIn: 'root' })
export class VideoPlaylistService {
private authHttp = inject(HttpClient)
private auth = inject(AuthService)