iceshrimp/src/remote/activitypub/kernel/like.ts
MeiMei 08144dfce4 Custom reaction (#4517)
* Custom reaction

* increase limit of reactions/delete

* リアクションの場合は OS標準の絵文字を使用 を迂回する

* カスタムリアクションを無効にする設定

* fix

* disableCustomReaction --> enableEmojiReaction

* Avoid MFM rendering

* 🎨

* 🎨

* Auto accept

* custom emoji reaction

* Improve usability

* Extract emojiRegex

* Fix

* Clean up

* 🎨

* 🎨

* toDbReaction で reaction は必須に

あとフォールバックは like に

* Clean up

* Make required

* 3eb08748fe (r266241728)

* Refactor

* Allow null
2019-03-18 00:03:57 +09:00

21 lines
650 B
TypeScript

import * as mongo from 'mongodb';
import Note from '../../../models/note';
import { IRemoteUser } from '../../../models/user';
import { ILike } from '../type';
import create from '../../../services/note/reaction/create';
export default async (actor: IRemoteUser, activity: ILike) => {
const id = typeof activity.object == 'string' ? activity.object : activity.object.id;
// Transform:
// https://misskey.ex/notes/xxxx to
// xxxx
const noteId = new mongo.ObjectID(id.split('/').pop());
const note = await Note.findOne({ _id: noteId });
if (note === null) {
throw new Error();
}
await create(actor, note, activity._misskey_reaction);
};