send out poll votes as separate create activities given that no other AP servers support multiple objects in a single activity (#3582)

This commit is contained in:
kim
2024-11-28 15:37:37 +00:00
committed by GitHub
parent 3cc50491c2
commit d9f67efae5
3 changed files with 75 additions and 48 deletions

View File

@@ -217,18 +217,23 @@ func (f *federate) CreatePollVote(ctx context.Context, poll *gtsmodel.Poll, vote
return err
}
// Convert vote to AS Create with vote choices as Objects.
create, err := f.converter.PollVoteToASCreate(ctx, vote)
// Convert vote to AS Creates with vote choices as Objects.
creates, err := f.converter.PollVoteToASCreates(ctx, vote)
if err != nil {
return gtserror.Newf("error converting to notes: %w", err)
}
// Send the Create via the Actor's outbox.
if _, err := f.FederatingActor().Send(ctx, outboxIRI, create); err != nil {
return gtserror.Newf("error sending Create activity via outbox %s: %w", outboxIRI, err)
var errs gtserror.MultiError
// Send each create activity.
actor := f.FederatingActor()
for _, create := range creates {
if _, err := actor.Send(ctx, outboxIRI, create); err != nil {
errs.Appendf("error sending Create activity via outbox %s: %w", outboxIRI, err)
}
}
return nil
return errs.Combine()
}
func (f *federate) DeleteStatus(ctx context.Context, status *gtsmodel.Status) error {