diff options
| author | MeiMei <30769358+mei23@users.noreply.github.com> | 2020-02-08 21:40:06 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-02-08 21:40:06 +0900 |
| commit | aa573c00631181c2e974ef8b3c061678dc9571f1 (patch) | |
| tree | d14c64a51bfb680d058962a7eba64611af234b84 /src/remote/activitypub/kernel/create/index.ts | |
| parent | Fix defalut note visibility setting (#5881) (diff) | |
| download | misskey-aa573c00631181c2e974ef8b3c061678dc9571f1.tar.gz misskey-aa573c00631181c2e974ef8b3c061678dc9571f1.tar.bz2 misskey-aa573c00631181c2e974ef8b3c061678dc9571f1.zip | |
Create ActivityでattributedToの補完とaudienceのコピーを行うように (#5873)
* attributedTo
* Create
* copy audiences between activity <=> object
* やっぱり匿名GETのpublicは必要
* fix
Diffstat (limited to 'src/remote/activitypub/kernel/create/index.ts')
| -rw-r--r-- | src/remote/activitypub/kernel/create/index.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/remote/activitypub/kernel/create/index.ts b/src/remote/activitypub/kernel/create/index.ts index 5210afe28b..108cfedf41 100644 --- a/src/remote/activitypub/kernel/create/index.ts +++ b/src/remote/activitypub/kernel/create/index.ts @@ -3,6 +3,7 @@ import { IRemoteUser } from '../../../../models/entities/user'; import createNote from './note'; import { ICreate, getApId, validPost } from '../../type'; import { apLogger } from '../../logger'; +import { toArray, concat, unique } from '../../../../prelude/array'; const logger = apLogger; @@ -11,6 +12,22 @@ export default async (actor: IRemoteUser, activity: ICreate): Promise<void> => { logger.info(`Create: ${uri}`); + // copy audiences between activity <=> object. + if (typeof activity.object === 'object') { + const to = unique(concat([toArray(activity.to), toArray(activity.object.to)])); + const cc = unique(concat([toArray(activity.cc), toArray(activity.object.cc)])); + + activity.to = to; + activity.cc = cc; + activity.object.to = to; + activity.object.cc = cc; + } + + // If there is no attributedTo, use Activity actor. + if (typeof activity.object === 'object' && !activity.object.attributedTo) { + activity.object.attributedTo = activity.actor; + } + const resolver = new Resolver(); const object = await resolver.resolve(activity.object).catch(e => { |