[backend/federation] Don't register misskey reactions as likes
This commit is contained in:
parent
40296b02f0
commit
7529ebea72
2 changed files with 10 additions and 8 deletions
|
@ -145,9 +145,10 @@ public class ActivityHandlerService(
|
|||
await UnfollowAsync(followee, resolvedActor);
|
||||
return;
|
||||
case ASLike { Object: ASNote note } like:
|
||||
var dbNote = await noteSvc.UnlikeNoteAsync(note, resolvedActor);
|
||||
if (like.MisskeyReaction != null)
|
||||
await noteSvc.RemoveReactionFromNoteAsync(dbNote, resolvedActor, like.MisskeyReaction);
|
||||
await noteSvc.RemoveReactionFromNoteAsync(note, resolvedActor, like.MisskeyReaction);
|
||||
else
|
||||
await noteSvc.UnlikeNoteAsync(note, resolvedActor);
|
||||
return;
|
||||
case ASAnnounce { Object: ASNote note }:
|
||||
await noteSvc.UndoAnnounceAsync(note, resolvedActor);
|
||||
|
@ -167,12 +168,15 @@ public class ActivityHandlerService(
|
|||
{
|
||||
if (activity.Object is not ASNote note)
|
||||
throw GracefulException.UnprocessableEntity("Like activity object is invalid");
|
||||
var dbNote = await noteSvc.LikeNoteAsync(note, resolvedActor);
|
||||
|
||||
if (like.MisskeyReaction != null)
|
||||
{
|
||||
await emojiSvc.ProcessEmojiAsync(like.Tags?.OfType<ASEmoji>().ToList(), resolvedActor.Host);
|
||||
await noteSvc.ReactToNoteAsync(dbNote, resolvedActor, like.MisskeyReaction);
|
||||
await noteSvc.ReactToNoteAsync(note, resolvedActor, like.MisskeyReaction);
|
||||
}
|
||||
else
|
||||
{
|
||||
await noteSvc.LikeNoteAsync(note, resolvedActor);
|
||||
}
|
||||
|
||||
return;
|
||||
|
|
|
@ -1135,18 +1135,16 @@ public class NoteService(
|
|||
return true;
|
||||
}
|
||||
|
||||
public async Task<Note> LikeNoteAsync(ASNote note, User actor)
|
||||
public async Task LikeNoteAsync(ASNote note, User actor)
|
||||
{
|
||||
var dbNote = await ResolveNoteAsync(note) ?? throw new Exception("Cannot register like for unknown note");
|
||||
await LikeNoteAsync(dbNote, actor);
|
||||
return dbNote;
|
||||
}
|
||||
|
||||
public async Task<Note> UnlikeNoteAsync(ASNote note, User user)
|
||||
public async Task UnlikeNoteAsync(ASNote note, User user)
|
||||
{
|
||||
var dbNote = await ResolveNoteAsync(note) ?? throw new Exception("Cannot unregister like for unknown note");
|
||||
await UnlikeNoteAsync(dbNote, user);
|
||||
return dbNote;
|
||||
}
|
||||
|
||||
public async Task BookmarkNoteAsync(Note note, User user)
|
||||
|
|
Loading…
Add table
Reference in a new issue