Fix Announce Activity

This commit is contained in:
mei23
2018-08-17 06:40:08 +09:00
parent 7a8d252f63
commit a89c206572
3 changed files with 20 additions and 8 deletions

View File

@ -1,5 +1,15 @@
export default (id: string, object: any) => ({
type: 'Announce',
id,
object
});
import config from '../../../config';
import { INote } from '../../../models/note';
export default (object: any, note: INote) => {
const attributedTo = `${config.url}/users/${note.userId}`;
return {
id: `${config.url}/notes/${note._id}`,
type: 'Announce',
published: note.createdAt.toISOString(),
to: ['https://www.w3.org/ns/activitystreams#Public'],
cc: [attributedTo, `${attributedTo}/followers`],
object
};
};