From e97bfe569603557473605c8ef3c8484016be78df Mon Sep 17 00:00:00 2001 From: MeiMei <30769358+mei23@users.noreply.github.com> Date: Thu, 30 Jan 2020 08:03:50 +0900 Subject: [PATCH] Handle EmojiReaction activitiy (#5492) * Handle some additional reaction activities * Revert "Handle some additional reaction activities" This reverts commit 1462ff12de08e8810023658e8ff7b5ee8bd7965b. * EmojiReaction --- src/remote/activitypub/kernel/like.ts | 2 +- src/remote/activitypub/kernel/undo/index.ts | 1 + src/remote/activitypub/type.ts | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/remote/activitypub/kernel/like.ts b/src/remote/activitypub/kernel/like.ts index 23b4aedd15..fa8983b38d 100644 --- a/src/remote/activitypub/kernel/like.ts +++ b/src/remote/activitypub/kernel/like.ts @@ -19,5 +19,5 @@ export default async (actor: IRemoteUser, activity: ILike) => { return; } - await create(actor, note, activity._misskey_reaction); + await create(actor, note, activity._misskey_reaction || activity.content || activity.name); }; diff --git a/src/remote/activitypub/kernel/undo/index.ts b/src/remote/activitypub/kernel/undo/index.ts index 4b23533058..81decd1256 100644 --- a/src/remote/activitypub/kernel/undo/index.ts +++ b/src/remote/activitypub/kernel/undo/index.ts @@ -33,6 +33,7 @@ export default async (actor: IRemoteUser, activity: IUndo): Promise => { unblock(actor, object as IBlock); break; case 'Like': + case 'EmojiReaction': undoLike(actor, object as ILike); break; case 'Announce': diff --git a/src/remote/activitypub/type.ts b/src/remote/activitypub/type.ts index a05ada69b6..6ee5349f20 100644 --- a/src/remote/activitypub/type.ts +++ b/src/remote/activitypub/type.ts @@ -171,7 +171,7 @@ export interface IRemove extends IActivity { } export interface ILike extends IActivity { - type: 'Like'; + type: 'Like' | 'EmojiReaction'; _misskey_reaction?: string; } @@ -193,6 +193,6 @@ export const isAccept = (object: IObject): object is IAccept => object.type === export const isReject = (object: IObject): object is IReject => object.type === 'Reject'; export const isAdd = (object: IObject): object is IAdd => object.type === 'Add'; export const isRemove = (object: IObject): object is IRemove => object.type === 'Remove'; -export const isLike = (object: IObject): object is ILike => object.type === 'Like'; +export const isLike = (object: IObject): object is ILike => object.type === 'Like' || object.type === 'EmojiReaction'; export const isAnnounce = (object: IObject): object is IAnnounce => object.type === 'Announce'; export const isBlock = (object: IObject): object is IBlock => object.type === 'Block';