ActivityPub-federated video streaming platform using P2P directly in your web browser
Add mute indication for video blocks
Chocobozzz38c497997263
diff --git a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.html b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.htmlindex 336483aab3..2688574258 100644--- a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.html+++ b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.html@@ -9,6 +9,7 @@[inputFilters]="inputFilters"[bulkActions]="bulkActions"searchInput="true"+ (dataLoaded)="onDataLoaded()"><ng-template #totalTitle let-totalRecords><ng-container i18n>{ totalRecords, plural, =0 {No video} =1 {1 video} other {{{ totalRecords | myNumberFormatter }} videos}}</ng-container>@@ -16,7 +17,12 @@<ng-template #tableCells let-videoBlock><td>- <my-video-cell [video]="videoBlock.video" size="small">+ <my-video-cell+ [video]="videoBlock.video"+ [accountBlockBadges]="videoBlock.video.account ? accountBlocklist.get(videoBlock.video.account.id) : undefined"+ accountBlockBadgesPlatformOnly="true"+ size="small"+ ><div>@if (videoBlock.type === 2) {<span i18n-title title="The video was blocked due to automatic blocking of new videos" class="pt-badge badge-info badge-small" i18n>Auto block</span>diff --git a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.tsindex 5757c128bd..c3b7f2519a 100644--- a/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts+++ b/client/src/app/+admin/moderation/video-block-list/video-block-list.component.ts@@ -4,6 +4,8 @@ import { formatICU } from '@app/helpers'import { buildDropdownSimpleAndBulkActions } from '@app/shared/shared-main/buttons/action-dropdown-helpers'import { PTDatePipe } from '@app/shared/shared-main/common/date.pipe'import { VideoService } from '@app/shared/shared-main/video/video.service'+import { AccountBlockBadgeInput } from '@app/shared/shared-moderation/account-block-badges.component'+import { BlocklistService } from '@app/shared/shared-moderation/blocklist.service'import { VideoBlockService } from '@app/shared/shared-moderation/video-block.service'import { PrivacyBadgeComponent } from '@app/shared/shared-video/privacy-badge.component'import { buildVideoEmbedLink, decorateVideoLink } from '@peertube/peertube-core-utils'@@ -42,6 +44,7 @@ export class VideoBlockListComponent implements OnInit {private serverService = inject(ServerService)private confirmService = inject(ConfirmService)private videoBlocklistService = inject(VideoBlockService)+ private blocklistService = inject(BlocklistService)private markdownRenderer = inject(MarkdownService)private videoService = inject(VideoService)@@ -73,6 +76,9 @@ export class VideoBlockListComponent implements OnInit {{ id: 'createdAt', label: $localize`Date`, sortable: true }]+ // Key is account id+ accountBlocklist = new Map<number, AccountBlockBadgeInput>()+dataLoader: typeof this._dataLoaderconstructor () {@@ -240,6 +246,48 @@ export class VideoBlockListComponent implements OnInit {})}+ onDataLoaded () {+ this.loadBlockStatus()+ }++ loadBlockStatus () {+ const videos = this.table().data.map(entry => entry.video)++ const accounts = this.getUniqueAccounts(videos)+ const hosts = this.getUniqueHosts(accounts)++ this.blocklistService.getStatus({ accounts: accounts.map(a => a.name + '@' + a.host), hosts })+ .subscribe(status => {+ this.accountBlocklist = new Map()++ for (const a of accounts) {+ const handle = a.name + '@' + a.host++ this.accountBlocklist.set(a.id, {+ mutedByInstance: status.accounts[handle]?.blockedByServer ?? false,+ mutedServerByInstance: status.hosts[a.host]?.blockedByServer ?? false+ })+ }+ })+ }++ private getUniqueAccounts (videos: { account: { id: number, name: string, host: string } }[]) {+ const accountsDone = new Set<number>()++ return videos+ .map(video => {+ if (!video.account || accountsDone.has(video.account.id)) return null++ accountsDone.add(video.account.id)+ return video.account+ })+ .filter(a => !!a)+ }++ private getUniqueHosts (accounts: { host: string }[]) {+ return Array.from(new Set(accounts.map(a => a.host)))+ }+private _dataLoader (options: DataLoaderOptionsBase & { type?: VideoBlacklistType_Type }) {return this.videoBlocklistService.listBlocks(options).pipe(