他のMisskeyインスタンスにリアクション情報を伝えるように
This commit is contained in:
@@ -3,6 +3,7 @@ import Note from '../../../models/note';
|
||||
import { IRemoteUser } from '../../../models/user';
|
||||
import { ILike } from '../type';
|
||||
import create from '../../../services/note/reaction/create';
|
||||
import { validateReaction } from '../../../models/note-reaction';
|
||||
|
||||
export default async (actor: IRemoteUser, activity: ILike) => {
|
||||
const id = typeof activity.object == 'string' ? activity.object : activity.object.id;
|
||||
@@ -17,5 +18,14 @@ export default async (actor: IRemoteUser, activity: ILike) => {
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
await create(actor, note, 'pudding');
|
||||
let reaction = 'pudding';
|
||||
|
||||
// 他のMisskeyインスタンスからのリアクション
|
||||
if (activity._misskey_reaction) {
|
||||
if (validateReaction.ok(activity._misskey_reaction)) {
|
||||
reaction = activity._misskey_reaction;
|
||||
}
|
||||
}
|
||||
|
||||
await create(actor, note, reaction);
|
||||
};
|
||||
|
@@ -1,8 +1,9 @@
|
||||
import config from '../../../config';
|
||||
import { ILocalUser } from '../../../models/user';
|
||||
|
||||
export default (user: ILocalUser, note) => ({
|
||||
export default (user: ILocalUser, note, reaction: string) => ({
|
||||
type: 'Like',
|
||||
actor: `${config.url}/users/${user._id}`,
|
||||
object: note.uri ? note.uri : `${config.url}/notes/${note._id}`
|
||||
object: note.uri ? note.uri : `${config.url}/notes/${note._id}`,
|
||||
_misskey_reaction: reaction
|
||||
});
|
||||
|
@@ -82,6 +82,7 @@ export interface IAccept extends IActivity {
|
||||
|
||||
export interface ILike extends IActivity {
|
||||
type: 'Like';
|
||||
_misskey_reaction: string;
|
||||
}
|
||||
|
||||
export interface IAnnounce extends IActivity {
|
||||
|
Reference in New Issue
Block a user