From d95d15598847c7f020aa056e7e6e0c02d2bbf732 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 1 Jul 2020 16:05:30 +0200 Subject: Use 3 tables to represent abuses --- shared/models/activitypub/activity.ts | 10 +++++----- shared/models/activitypub/objects/abuse-object.ts | 12 ++++++++++++ shared/models/activitypub/objects/common-objects.ts | 4 ++-- shared/models/activitypub/objects/index.ts | 4 ++-- shared/models/activitypub/objects/video-abuse-object.ts | 10 ---------- 5 files changed, 21 insertions(+), 19 deletions(-) create mode 100644 shared/models/activitypub/objects/abuse-object.ts delete mode 100644 shared/models/activitypub/objects/video-abuse-object.ts (limited to 'shared/models/activitypub') diff --git a/shared/models/activitypub/activity.ts b/shared/models/activitypub/activity.ts index 31b9e4673..5b4ce214a 100644 --- a/shared/models/activitypub/activity.ts +++ b/shared/models/activitypub/activity.ts @@ -1,12 +1,12 @@ import { ActivityPubActor } from './activitypub-actor' import { ActivityPubSignature } from './activitypub-signature' -import { CacheFileObject, VideoTorrentObject, ActivityFlagReasonObject } from './objects' +import { ActivityFlagReasonObject, CacheFileObject, VideoTorrentObject } from './objects' +import { AbuseObject } from './objects/abuse-object' import { DislikeObject } from './objects/dislike-object' -import { VideoAbuseObject } from './objects/video-abuse-object' -import { VideoCommentObject } from './objects/video-comment-object' -import { ViewObject } from './objects/view-object' import { APObject } from './objects/object.model' import { PlaylistObject } from './objects/playlist-object' +import { VideoCommentObject } from './objects/video-comment-object' +import { ViewObject } from './objects/view-object' export type Activity = ActivityCreate | @@ -53,7 +53,7 @@ export interface BaseActivity { export interface ActivityCreate extends BaseActivity { type: 'Create' - object: VideoTorrentObject | VideoAbuseObject | ViewObject | DislikeObject | VideoCommentObject | CacheFileObject | PlaylistObject + object: VideoTorrentObject | AbuseObject | ViewObject | DislikeObject | VideoCommentObject | CacheFileObject | PlaylistObject } export interface ActivityUpdate extends BaseActivity { diff --git a/shared/models/activitypub/objects/abuse-object.ts b/shared/models/activitypub/objects/abuse-object.ts new file mode 100644 index 000000000..ad45cc064 --- /dev/null +++ b/shared/models/activitypub/objects/abuse-object.ts @@ -0,0 +1,12 @@ +import { ActivityFlagReasonObject } from './common-objects' + +export interface AbuseObject { + type: 'Flag' + content: string + object: string | string[] + + tag?: ActivityFlagReasonObject[] + + startAt?: number + endAt?: number +} diff --git a/shared/models/activitypub/objects/common-objects.ts b/shared/models/activitypub/objects/common-objects.ts index 096d422ea..711ce45f4 100644 --- a/shared/models/activitypub/objects/common-objects.ts +++ b/shared/models/activitypub/objects/common-objects.ts @@ -1,4 +1,4 @@ -import { VideoAbusePredefinedReasonsString } from '@shared/models/videos' +import { AbusePredefinedReasonsString } from '@shared/models' export interface ActivityIdentifierObject { identifier: string @@ -85,7 +85,7 @@ export interface ActivityMentionObject { export interface ActivityFlagReasonObject { type: 'Hashtag' - name: VideoAbusePredefinedReasonsString + name: AbusePredefinedReasonsString } export type ActivityTagObject = diff --git a/shared/models/activitypub/objects/index.ts b/shared/models/activitypub/objects/index.ts index fba61e12f..a6a20e87a 100644 --- a/shared/models/activitypub/objects/index.ts +++ b/shared/models/activitypub/objects/index.ts @@ -1,6 +1,6 @@ +export * from './abuse-object' export * from './cache-file-object' export * from './common-objects' -export * from './video-abuse-object' +export * from './dislike-object' export * from './video-torrent-object' export * from './view-object' -export * from './dislike-object' diff --git a/shared/models/activitypub/objects/video-abuse-object.ts b/shared/models/activitypub/objects/video-abuse-object.ts deleted file mode 100644 index 73add8ef4..000000000 --- a/shared/models/activitypub/objects/video-abuse-object.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { ActivityFlagReasonObject } from './common-objects' - -export interface VideoAbuseObject { - type: 'Flag' - content: string - object: string | string[] - tag?: ActivityFlagReasonObject[] - startAt?: number - endAt?: number -} -- cgit v1.2.3