[backend/federation] Fix acceptance of poll vote activities without publishedAt

This commit is contained in:
Laura Hausmann 2024-05-16 18:51:46 +02:00
parent 2108f91bcf
commit 1fae913a32
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -678,8 +678,6 @@ public class NoteService(
throw GracefulException.UnprocessableEntity("Note.Id schema is invalid");
if (note.Url?.Link != null && !note.Url.Link.StartsWith("https://"))
throw GracefulException.UnprocessableEntity("Note.Url schema is invalid");
if (note.PublishedAt is null or { Year: < 2007 } || note.PublishedAt > DateTime.Now + TimeSpan.FromDays(3))
throw GracefulException.UnprocessableEntity("Note.PublishedAt is nonsensical");
if (actor.IsSuspended)
throw GracefulException.Forbidden("User is suspended");
if (await fedCtrlSvc.ShouldBlockAsync(note.Id, actor.Host))
@ -720,6 +718,9 @@ public class NoteService(
return null;
}
if (note.PublishedAt is null or { Year: < 2007 } || note.PublishedAt > DateTime.Now + TimeSpan.FromDays(3))
throw GracefulException.UnprocessableEntity("Note.PublishedAt is nonsensical");
if (replyUri != null)
{