diff options
| author | MeiMei <30769358+mei23@users.noreply.github.com> | 2019-03-07 21:19:32 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2019-03-07 21:19:32 +0900 |
| commit | 7325d66c52365104b6b5d6343324a258470ad2a8 (patch) | |
| tree | 2e34ad9e592d64ab1a672877b33d384bc67e3d90 /src/remote/activitypub/kernel/update | |
| parent | Update README.md [AUTOGEN] (#4441) (diff) | |
| download | misskey-7325d66c52365104b6b5d6343324a258470ad2a8.tar.gz misskey-7325d66c52365104b6b5d6343324a258470ad2a8.tar.bz2 misskey-7325d66c52365104b6b5d6343324a258470ad2a8.zip | |
Implement Update Question (#4435)
* Update remote votes count
* save updatedAt
* deliver Update
* use renderNote
* use id
* fix typeof
Diffstat (limited to 'src/remote/activitypub/kernel/update')
| -rw-r--r-- | src/remote/activitypub/kernel/update/index.ts | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/remote/activitypub/kernel/update/index.ts b/src/remote/activitypub/kernel/update/index.ts new file mode 100644 index 0000000000..49b730391a --- /dev/null +++ b/src/remote/activitypub/kernel/update/index.ts @@ -0,0 +1,28 @@ +import { IRemoteUser } from '../../../../models/user'; +import { IUpdate, IObject } from '../../type'; +import { apLogger } from '../../logger'; +import { updateQuestion } from '../../models/question'; + +/** + * Updateアクティビティを捌きます + */ +export default async (actor: IRemoteUser, activity: IUpdate): Promise<void> => { + if ('actor' in activity && actor.uri !== activity.actor) { + throw new Error('invalid actor'); + } + + apLogger.debug('Update'); + + const object = activity.object as IObject; + + switch (object.type) { + case 'Question': + apLogger.debug('Question'); + await updateQuestion(object).catch(e => console.log(e)); + break; + + default: + apLogger.warn(`Unknown type: ${object.type}`); + break; + } +}; |