From ffcb2f755c2d20e62272212905c7d2ca795e4c3d Mon Sep 17 00:00:00 2001 From: mei23 Date: Sat, 25 Aug 2018 14:12:44 +0900 Subject: [PATCH] Send actor in CreateNote, Announce --- src/remote/activitypub/renderer/announce.ts | 1 + src/remote/activitypub/renderer/create.ts | 16 ++++++++++++---- src/services/note/create.ts | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/remote/activitypub/renderer/announce.ts b/src/remote/activitypub/renderer/announce.ts index 6d5a67b5c..f6276ade0 100644 --- a/src/remote/activitypub/renderer/announce.ts +++ b/src/remote/activitypub/renderer/announce.ts @@ -6,6 +6,7 @@ export default (object: any, note: INote) => { return { id: `${config.url}/notes/${note._id}`, + actor: `${config.url}/users/${note.userId}`, type: 'Announce', published: note.createdAt.toISOString(), to: ['https://www.w3.org/ns/activitystreams#Public'], diff --git a/src/remote/activitypub/renderer/create.ts b/src/remote/activitypub/renderer/create.ts index b8bf98a65..42b36195f 100644 --- a/src/remote/activitypub/renderer/create.ts +++ b/src/remote/activitypub/renderer/create.ts @@ -1,4 +1,12 @@ -export default (object: any) => ({ - type: 'Create', - object -}); +import config from '../../../config'; +import { INote } from '../../../models/note'; + +export default (object: any, note: INote) => { + return { + id: `${config.url}/notes/${note._id}/activity`, + actor: `${config.url}/users/${note.userId}`, + type: 'Create', + published: note.createdAt.toISOString(), + object + }; +}; diff --git a/src/services/note/create.ts b/src/services/note/create.ts index 268bfa5bb..63e355782 100644 --- a/src/services/note/create.ts +++ b/src/services/note/create.ts @@ -240,7 +240,7 @@ export default async (user: IUser, data: Option, silent = false) => new Promise< async function renderActivity(data: Option, note: INote) { const content = data.renote && data.text == null ? renderAnnounce(data.renote.uri ? data.renote.uri : `${config.url}/notes/${data.renote._id}`, note) - : renderCreate(await renderNote(note, false)); + : renderCreate(await renderNote(note, false), note); return packAp(content); }