mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 19:42:24 +02:00
predefined report reasons & improved reporter UI (#2842)
- added `startAt` and `endAt` optional timestamps to help pin down reported sections of a video - added predefined report reasons - added video player with report modal
This commit is contained in:
parent
07aea1a264
commit
1ebddadd07
35 changed files with 658 additions and 96 deletions
|
@ -1,4 +1,9 @@
|
|||
import { ActivityCreate, ActivityFlag, VideoAbuseState } from '../../../../shared'
|
||||
import {
|
||||
ActivityCreate,
|
||||
ActivityFlag,
|
||||
VideoAbuseState,
|
||||
videoAbusePredefinedReasonsMap
|
||||
} from '../../../../shared'
|
||||
import { VideoAbuseObject } from '../../../../shared/models/activitypub/objects'
|
||||
import { retryTransactionWrapper } from '../../../helpers/database-utils'
|
||||
import { logger } from '../../../helpers/logger'
|
||||
|
@ -38,13 +43,21 @@ async function processCreateVideoAbuse (activity: ActivityCreate | ActivityFlag,
|
|||
|
||||
const { video } = await getOrCreateVideoAndAccountAndChannel({ videoObject: object })
|
||||
const reporterAccount = await sequelizeTypescript.transaction(async t => AccountModel.load(account.id, t))
|
||||
const tags = Array.isArray(flag.tag) ? flag.tag : []
|
||||
const predefinedReasons = tags.map(tag => videoAbusePredefinedReasonsMap[tag.name])
|
||||
.filter(v => !isNaN(v))
|
||||
const startAt = flag.startAt
|
||||
const endAt = flag.endAt
|
||||
|
||||
const videoAbuseInstance = await sequelizeTypescript.transaction(async t => {
|
||||
const videoAbuseData = {
|
||||
reporterAccountId: account.id,
|
||||
reason: flag.content,
|
||||
videoId: video.id,
|
||||
state: VideoAbuseState.PENDING
|
||||
state: VideoAbuseState.PENDING,
|
||||
predefinedReasons,
|
||||
startAt,
|
||||
endAt
|
||||
}
|
||||
|
||||
const videoAbuseInstance: MVideoAbuseAccountVideo = await VideoAbuseModel.create(videoAbuseData, { transaction: t })
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue