[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); var combinedAltText = data.Attachments?.Select(p => p.Comment).Where(c => c != null);
note.CombinedAltText = combinedAltText != null ? string.Join(' ', combinedAltText) : null; note.CombinedAltText = combinedAltText != null ? string.Join(' ', combinedAltText) : null;
} }
var isPollEdited = false; var isPollEdited = false;
@ -1397,13 +1396,17 @@ public class NoteService(
public async Task 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"); var dbNote = await ResolveNoteAsync(note) ??
throw GracefulException.UnprocessableEntity("Cannot register like for unknown note");
await LikeNoteAsync(dbNote, actor); await LikeNoteAsync(dbNote, actor);
} }
public async Task 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"); var dbNote = await ResolveNoteAsync(note) ??
throw GracefulException.UnprocessableEntity("Cannot unregister like for unknown note");
await UnlikeNoteAsync(dbNote, user); await UnlikeNoteAsync(dbNote, user);
} }