ActivityPub-federated video streaming platform using P2P directly in your web browser
Fix NSFW policy on account/channel videos
Chocobozzz07f81d9deedf
diff --git a/client/src/app/+accounts/account-search/account-search.component.ts b/client/src/app/+accounts/account-search/account-search.component.tsindex 378aa78c45..dda4bf0c76 100644--- a/client/src/app/+accounts/account-search/account-search.component.ts+++ b/client/src/app/+accounts/account-search/account-search.component.ts@@ -1,4 +1,4 @@-import { Subscription } from 'rxjs'+import { forkJoin, Subscription } from 'rxjs'import { first, tap } from 'rxjs/operators'import { Component, ComponentFactoryResolver, OnDestroy, OnInit } from '@angular/core'import { ActivatedRoute, Router } from '@angular/router'@@ -16,6 +16,7 @@ import { VideoFilter } from '@shared/models'export class AccountSearchComponent extends AbstractVideoList implements OnInit, OnDestroy {titlePage: stringloadOnInit = false+ loadUserVideoPreferences = truesearch = ''filter: VideoFilter = null@@ -46,14 +47,14 @@ export class AccountSearchComponent extends AbstractVideoList implements OnInit,this.enableAllFilterIfPossible()// Parent get the account for us- this.accountSub = this.accountService.accountLoaded- .pipe(first())- .subscribe(account => {- this.account = account-- this.reloadVideos()- this.generateSyndicationList()- })+ this.accountSub = forkJoin([+ this.accountService.accountLoaded.pipe(first()),+ this.onUserLoadedSubject.pipe(first())+ ]).subscribe(([ account ]) => {+ this.account = account++ this.reloadVideos()+ })}ngOnDestroy () {diff --git a/client/src/app/+accounts/account-videos/account-videos.component.ts b/client/src/app/+accounts/account-videos/account-videos.component.tsindex da3903d2c7..484d60e25d 100644--- a/client/src/app/+accounts/account-videos/account-videos.component.ts+++ b/client/src/app/+accounts/account-videos/account-videos.component.ts@@ -1,4 +1,4 @@-import { Subscription } from 'rxjs'+import { forkJoin, Subscription } from 'rxjs'import { first, tap } from 'rxjs/operators'import { Component, ComponentFactoryResolver, OnDestroy, OnInit } from '@angular/core'import { ActivatedRoute, Router } from '@angular/router'@@ -18,6 +18,7 @@ import { VideoFilter } from '@shared/models'export class AccountVideosComponent extends AbstractVideoList implements OnInit, OnDestroy {titlePage: stringloadOnInit = false+ loadUserVideoPreferences = truefilter: VideoFilter = null@@ -47,14 +48,15 @@ export class AccountVideosComponent extends AbstractVideoList implements OnInit,this.enableAllFilterIfPossible()// Parent get the account for us- this.accountSub = this.accountService.accountLoaded- .pipe(first())- .subscribe(account => {- this.account = account+ this.accountSub = forkJoin([+ this.accountService.accountLoaded.pipe(first()),+ this.onUserLoadedSubject.pipe(first())+ ]).subscribe(([ account ]) => {+ this.account = account- this.reloadVideos()- this.generateSyndicationList()- })+ this.reloadVideos()+ this.generateSyndicationList()+ })}ngOnDestroy () {diff --git a/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts b/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.tsindex a49fd0d5dd..8036515058 100644--- a/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts+++ b/client/src/app/+video-channels/video-channel-videos/video-channel-videos.component.ts@@ -1,4 +1,4 @@-import { Subscription } from 'rxjs'+import { forkJoin, Subscription } from 'rxjs'import { first, tap } from 'rxjs/operators'import { Component, ComponentFactoryResolver, OnDestroy, OnInit } from '@angular/core'import { ActivatedRoute, Router } from '@angular/router'@@ -18,6 +18,7 @@ import { VideoFilter } from '@shared/models'export class VideoChannelVideosComponent extends AbstractVideoList implements OnInit, OnDestroy {titlePage: stringloadOnInit = false+ loadUserVideoPreferences = truefilter: VideoFilter = null@@ -53,14 +54,15 @@ export class VideoChannelVideosComponent extends AbstractVideoList implements Onthis.enableAllFilterIfPossible()// Parent get the video channel for us- this.videoChannelSub = this.videoChannelService.videoChannelLoaded- .pipe(first())- .subscribe(videoChannel => {- this.videoChannel = videoChannel-- this.reloadVideos()- this.generateSyndicationList()- })+ this.videoChannelSub = forkJoin([+ this.videoChannelService.videoChannelLoaded.pipe(first()),+ this.onUserLoadedSubject.pipe(first())+ ]).subscribe(([ videoChannel ]) => {+ this.videoChannel = videoChannel++ this.reloadVideos()+ this.generateSyndicationList()+ })}ngOnDestroy () {diff --git a/client/src/app/+videos/video-list/trending/video-trending.component.ts b/client/src/app/+videos/video-list/trending/video-trending.component.tsindex 6128c4acd5..c11f0da9d8 100644--- a/client/src/app/+videos/video-list/trending/video-trending.component.ts+++ b/client/src/app/+videos/video-list/trending/video-trending.component.ts@@ -19,7 +19,7 @@ export class VideoTrendingComponent extends AbstractVideoList implements OnInit,titlePage: stringdefaultSort: VideoSortField = '-trending'- useUserVideoPreferences = true+ loadUserVideoPreferences = trueprivate algorithmChangeSub: Subscriptiondiff --git a/client/src/app/+videos/video-list/video-local.component.ts b/client/src/app/+videos/video-list/video-local.component.tsindex af7eecff44..4be8cd6b5d 100644--- a/client/src/app/+videos/video-list/video-local.component.ts+++ b/client/src/app/+videos/video-list/video-local.component.ts@@ -17,7 +17,7 @@ export class VideoLocalComponent extends AbstractVideoList implements OnInit, Onsort = '-publishedAt' as VideoSortFieldfilter: VideoFilter = 'local'- useUserVideoPreferences = true+ loadUserVideoPreferences = trueconstructor (protected router: Router,diff --git a/client/src/app/+videos/video-list/video-recently-added.component.ts b/client/src/app/+videos/video-list/video-recently-added.component.tsindex 2f4908074d..506f92d25f 100644--- a/client/src/app/+videos/video-list/video-recently-added.component.ts+++ b/client/src/app/+videos/video-list/video-recently-added.component.ts@@ -17,7 +17,7 @@ export class VideoRecentlyAddedComponent extends AbstractVideoList implements Onsort: VideoSortField = '-publishedAt'groupByDate = true- useUserVideoPreferences = true+ loadUserVideoPreferences = trueconstructor (protected route: ActivatedRoute,diff --git a/client/src/app/shared/shared-video-miniature/abstract-video-list.ts b/client/src/app/shared/shared-video-miniature/abstract-video-list.tsindex 5361f6d6cf..f8abc1656d 100644--- a/client/src/app/shared/shared-video-miniature/abstract-video-list.ts+++ b/client/src/app/shared/shared-video-miniature/abstract-video-list.ts@@ -1,4 +1,4 @@-import { fromEvent, Observable, Subject, Subscription } from 'rxjs'+import { fromEvent, Observable, ReplaySubject, Subject, Subscription } from 'rxjs'import { debounceTime, switchMap, tap } from 'rxjs/operators'import {AfterContentInit,@@ -63,7 +63,8 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, AfterContesyndicationItems: Syndication[] = []loadOnInit = true- useUserVideoPreferences = false+ loadUserVideoPreferences = false+ownerDisplayType: OwnerDisplayType = 'account'displayModerationBlock = falsetitleTooltip: string@@ -98,6 +99,8 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, AfterConteuserMiniature: User+ protected onUserLoadedSubject = new ReplaySubject<void>(1)+protected serverConfig: ServerConfigprotected abstract notifier: Notifier@@ -149,10 +152,11 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, AfterContethis.calcPageSizes()const loadUserObservable = this.loadUserAndSettings()+ loadUserObservable.subscribe(() => {+ this.onUserLoadedSubject.next()- if (this.loadOnInit === true) {- loadUserObservable.subscribe(() => this.loadMoreVideos())- }+ if (this.loadOnInit === true) this.loadMoreVideos()+ })this.userService.listenAnonymousUpdate().pipe(switchMap(() => this.loadUserAndSettings()))@@ -374,7 +378,7 @@ export abstract class AbstractVideoList implements OnInit, OnDestroy, AfterConte.pipe(tap(user => {this.userMiniature = user- if (!this.useUserVideoPreferences) return+ if (!this.loadUserVideoPreferences) returnthis.languageOneOf = user.videoLanguagesthis.nsfwPolicy = user.nsfwPolicy