import * as debug from 'debug'
import truncate from 'lodash-es/truncate'
import { SortMeta } from 'primeng/api'
-import { buildVideoOrPlaylistEmbed } from 'src/assets/player/utils'
-import { environment } from 'src/environments/environment'
import { Component, Input, OnInit, ViewChild } from '@angular/core'
import { DomSanitizer } from '@angular/platform-browser'
import { ActivatedRoute, Router } from '@angular/router'
import { Account, Actor, DropdownAction, Video, VideoService } from '@app/shared/shared-main'
import { AbuseService, BlocklistService, VideoBlockService } from '@app/shared/shared-moderation'
import { VideoCommentService } from '@app/shared/shared-video-comment'
-import { buildVideoEmbedLink, decorateVideoLink } from '@shared/core-utils'
import { AbuseState, AdminAbuse } from '@shared/models'
import { AdvancedInputFilter } from '../shared-forms'
import { AbuseMessageModalComponent } from './abuse-message-modal.component'
inputFilters: AdvancedInputFilter[] = [
{
- queryParams: { 'search': 'state:pending' },
- label: $localize`Unsolved reports`
- },
- {
- queryParams: { 'search': 'state:accepted' },
- label: $localize`Accepted reports`
- },
- {
- queryParams: { 'search': 'state:rejected' },
- label: $localize`Refused reports`
- },
- {
- queryParams: { 'search': 'videoIs:blacklisted' },
- label: $localize`Reports with blocked videos`
- },
- {
- queryParams: { 'search': 'videoIs:deleted' },
- label: $localize`Reports with deleted videos`
+ title: $localize`Advanced filters`,
+ children: [
+ {
+ value: 'state:pending',
+ label: $localize`Unsolved reports`
+ },
+ {
+ value: 'state:accepted',
+ label: $localize`Accepted reports`
+ },
+ {
+ value: 'state:rejected',
+ label: $localize`Refused reports`
+ },
+ {
+ value: 'videoIs:blacklisted',
+ label: $localize`Reports with blocked videos`
+ },
+ {
+ value: 'videoIs:deleted',
+ label: $localize`Reports with deleted videos`
+ }
+ ]
}
]
return '/a/' + abuse.flaggedAccount.nameWithHost
}
- getVideoEmbed (abuse: AdminAbuse) {
- return buildVideoOrPlaylistEmbed(
- decorateVideoLink({
- url: buildVideoEmbedLink(abuse.video, environment.originServerUrl),
- title: false,
- warningTitle: false,
- startTime: abuse.video.startAt,
- stopTime: abuse.video.endAt
- }),
- abuse.video.name
- )
- }
-
async removeAbuse (abuse: AdminAbuse) {
const res = await this.confirmService.confirm($localize`Do you really want to delete this abuse report?`, $localize`Delete`)
if (res === false) return
}
if (abuse.video) {
- abuse.embedHtml = this.sanitizer.bypassSecurityTrustHtml(this.getVideoEmbed(abuse))
-
if (abuse.video.channel?.ownerAccount) {
abuse.video.channel.ownerAccount = new Account(abuse.video.channel.ownerAccount)
}
label: $localize`Block video`,
isDisplayed: abuse => abuse.video && !abuse.video.deleted && !abuse.video.blacklisted,
handler: abuse => {
- this.videoBlocklistService.blockVideo(abuse.video.id, undefined, abuse.video.channel.isLocal)
+ this.videoBlocklistService.blockVideo([ { videoId: abuse.video.id, unfederate: abuse.video.channel.isLocal } ])
.subscribe({
next: () => {
this.notifier.success($localize`Video blocked.`)