mirror of
https://github.com/superseriousbusiness/gotosocial
synced 2025-06-05 21:59:39 +02:00
[bugfix] Fix status fields in_reply_to_id
and in_reply_to_account_id
not being nullable (#798)
* make reply status fields nullable pointers * update tests
This commit is contained in:
@ -525,9 +525,6 @@ func (c *converter) StatusToAPIStatus(ctx context.Context, s *gtsmodel.Status, r
|
||||
}
|
||||
}
|
||||
|
||||
var apiCard *model.Card
|
||||
var apiPoll *model.Poll
|
||||
|
||||
statusInteractions := &statusInteractions{}
|
||||
si, err := c.interactionsWithStatusForAccount(ctx, s, requestingAccount)
|
||||
if err == nil {
|
||||
@ -537,8 +534,8 @@ func (c *converter) StatusToAPIStatus(ctx context.Context, s *gtsmodel.Status, r
|
||||
apiStatus := &model.Status{
|
||||
ID: s.ID,
|
||||
CreatedAt: util.FormatISO8601(s.CreatedAt),
|
||||
InReplyToID: s.InReplyToID,
|
||||
InReplyToAccountID: s.InReplyToAccountID,
|
||||
InReplyToID: nil,
|
||||
InReplyToAccountID: nil,
|
||||
Sensitive: *s.Sensitive,
|
||||
SpoilerText: s.ContentWarning,
|
||||
Visibility: c.VisToAPIVis(ctx, s.Visibility),
|
||||
@ -554,17 +551,29 @@ func (c *converter) StatusToAPIStatus(ctx context.Context, s *gtsmodel.Status, r
|
||||
Reblogged: statusInteractions.Reblogged,
|
||||
Pinned: *s.Pinned,
|
||||
Content: s.Content,
|
||||
Reblog: nil,
|
||||
Application: apiApplication,
|
||||
Account: apiAuthorAccount,
|
||||
MediaAttachments: apiAttachments,
|
||||
Mentions: apiMentions,
|
||||
Tags: apiTags,
|
||||
Emojis: apiEmojis,
|
||||
Card: apiCard, // TODO: implement cards
|
||||
Poll: apiPoll, // TODO: implement polls
|
||||
Card: nil, // TODO: implement cards
|
||||
Poll: nil, // TODO: implement polls
|
||||
Text: s.Text,
|
||||
}
|
||||
|
||||
// nullable fields
|
||||
if s.InReplyToID != "" {
|
||||
i := s.InReplyToID
|
||||
apiStatus.InReplyToID = &i
|
||||
}
|
||||
|
||||
if s.InReplyToAccountID != "" {
|
||||
i := s.InReplyToAccountID
|
||||
apiStatus.InReplyToAccountID = &i
|
||||
}
|
||||
|
||||
if apiRebloggedStatus != nil {
|
||||
apiStatus.Reblog = &model.StatusReblogged{Status: apiRebloggedStatus}
|
||||
}
|
||||
|
Reference in New Issue
Block a user