[backend/core] Don't retry jobs with like/unlike note resolution failures

This commit is contained in:
Laura Hausmann 2024-10-15 17:19:42 +02:00
parent 300c7d661c
commit a951217664
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -601,7 +601,6 @@ public class NoteService(
var combinedAltText = data.Attachments?.Select(p => p.Comment).Where(c => c != null);
note.CombinedAltText = combinedAltText != null ? string.Join(' ', combinedAltText) : null;
}
var isPollEdited = false;
@ -949,7 +948,7 @@ public class NoteService(
var emoji = (await emojiSvc.ProcessEmojiAsync(note.Tags?.OfType<ASEmoji>().ToList(), actor.Host))
.Select(p => p.Id)
.ToList();
policySvc.CallRewriteHooks(note, actor, IRewritePolicy.HookLocationEnum.PostLogic);
return await CreateNoteAsync(new NoteCreationData
@ -1397,13 +1396,17 @@ public class NoteService(
public async Task LikeNoteAsync(ASNote note, User actor)
{
var dbNote = await ResolveNoteAsync(note) ?? throw new Exception("Cannot register like for unknown note");
var dbNote = await ResolveNoteAsync(note) ??
throw GracefulException.UnprocessableEntity("Cannot register like for unknown note");
await LikeNoteAsync(dbNote, actor);
}
public async Task UnlikeNoteAsync(ASNote note, User user)
{
var dbNote = await ResolveNoteAsync(note) ?? throw new Exception("Cannot unregister like for unknown note");
var dbNote = await ResolveNoteAsync(note) ??
throw GracefulException.UnprocessableEntity("Cannot unregister like for unknown note");
await UnlikeNoteAsync(dbNote, user);
}
@ -1619,4 +1622,4 @@ public class NoteService(
if (dbNote == null) return;
await RemoveReactionFromNoteAsync(dbNote, actor, name);
}
}
}