From 848f499def54db2dd36437ef0dfb74dd5041c23b Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 15 Jan 2019 11:14:12 +0100 Subject: Prepare Dislike/Flag/View fixes For now we Create these activities, but we should just send them directly. This fix handles correctly direct Dislikes/Flags/Views, we'll implement the sending correctly these activities in the next peertube version --- shared/models/activitypub/activity.ts | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'shared/models/activitypub/activity.ts') diff --git a/shared/models/activitypub/activity.ts b/shared/models/activitypub/activity.ts index 44cb99efb..89994f665 100644 --- a/shared/models/activitypub/activity.ts +++ b/shared/models/activitypub/activity.ts @@ -5,12 +5,14 @@ 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' export type Activity = ActivityCreate | ActivityUpdate | ActivityDelete | ActivityFollow | ActivityAccept | ActivityAnnounce | - ActivityUndo | ActivityLike | ActivityReject + ActivityUndo | ActivityLike | ActivityReject | ActivityView | ActivityDislike | ActivityFlag -export type ActivityType = 'Create' | 'Update' | 'Delete' | 'Follow' | 'Accept' | 'Announce' | 'Undo' | 'Like' | 'Reject' +export type ActivityType = 'Create' | 'Update' | 'Delete' | 'Follow' | 'Accept' | 'Announce' | 'Undo' | 'Like' | 'Reject' | + 'View' | 'Dislike' | 'Flag' export interface ActivityAudience { to: string[] @@ -59,15 +61,34 @@ export interface ActivityReject extends BaseActivity { export interface ActivityAnnounce extends BaseActivity { type: 'Announce' - object: string | { id: string } + object: APObject } export interface ActivityUndo extends BaseActivity { type: 'Undo', - object: ActivityFollow | ActivityLike | ActivityCreate | ActivityAnnounce + object: ActivityFollow | ActivityLike | ActivityDislike | ActivityCreate | ActivityAnnounce } export interface ActivityLike extends BaseActivity { type: 'Like', - object: string + object: APObject +} + +export interface ActivityView extends BaseActivity { + type: 'View', + actor: string + object: APObject +} + +export interface ActivityDislike extends BaseActivity { + id: string + type: 'Dislike' + actor: string + object: APObject +} + +export interface ActivityFlag extends BaseActivity { + type: 'Flag', + content: string, + object: APObject } -- cgit v1.2.3