diff options
| author | 2022-09-02 17:00:11 +0200 | |
|---|---|---|
| committer | 2022-09-02 17:00:11 +0200 | |
| commit | 4e13408fd48105d591c3f0f716641f1ef928817c (patch) | |
| tree | 70eda403e79ac7f5dca795ad212a2882c86e4684 /internal/api | |
| parent | [performance] cache recently allowed/denied domains to cut down on db calls (... (diff) | |
| download | gotosocial-4e13408fd48105d591c3f0f716641f1ef928817c.tar.xz | |
[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
Diffstat (limited to 'internal/api')
| -rw-r--r-- | internal/api/client/status/statuscreate_test.go | 4 | ||||
| -rw-r--r-- | internal/api/model/status.go | 12 | 
2 files changed, 10 insertions, 6 deletions
diff --git a/internal/api/client/status/statuscreate_test.go b/internal/api/client/status/statuscreate_test.go index 2a82ff8a5..78d025be1 100644 --- a/internal/api/client/status/statuscreate_test.go +++ b/internal/api/client/status/statuscreate_test.go @@ -331,8 +331,8 @@ func (suite *StatusCreateTestSuite) TestReplyToLocalStatus() {  	suite.Equal(fmt.Sprintf("<p>hello <span class=\"h-card\"><a href=\"http://localhost:8080/@%s\" class=\"u-url mention\" rel=\"nofollow noreferrer noopener\" target=\"_blank\">@<span>%s</span></a></span> this reply should work!</p>", testrig.NewTestAccounts()["local_account_2"].Username, testrig.NewTestAccounts()["local_account_2"].Username), statusReply.Content)  	suite.False(statusReply.Sensitive)  	suite.Equal(model.VisibilityPublic, statusReply.Visibility) -	suite.Equal(testrig.NewTestStatuses()["local_account_2_status_1"].ID, statusReply.InReplyToID) -	suite.Equal(testrig.NewTestAccounts()["local_account_2"].ID, statusReply.InReplyToAccountID) +	suite.Equal(testrig.NewTestStatuses()["local_account_2_status_1"].ID, *statusReply.InReplyToID) +	suite.Equal(testrig.NewTestAccounts()["local_account_2"].ID, *statusReply.InReplyToAccountID)  	suite.Len(statusReply.Mentions, 1)  } diff --git a/internal/api/model/status.go b/internal/api/model/status.go index d3c7a0e4f..b9ac99c44 100644 --- a/internal/api/model/status.go +++ b/internal/api/model/status.go @@ -30,10 +30,12 @@ type Status struct {  	CreatedAt string `json:"created_at"`  	// ID of the status being replied to.  	// example: 01FBVD42CQ3ZEEVMW180SBX03B -	InReplyToID string `json:"in_reply_to_id"` +	// nullable: true +	InReplyToID *string `json:"in_reply_to_id"`  	// ID of the account being replied to.  	// example: 01FBVD42CQ3ZEEVMW180SBX03B -	InReplyToAccountID string `json:"in_reply_to_account_id"` +	// nullable: true +	InReplyToAccountID *string `json:"in_reply_to_account_id"`  	// Status contains sensitive content.  	// example: false  	Sensitive bool `json:"sensitive"` @@ -75,7 +77,7 @@ type Status struct {  	// nullable: true  	Reblog *StatusReblogged `json:"reblog"`  	// The application used to post this status, if visible. -	Application *Application `json:"application"` +	Application *Application `json:"application,omitempty"`  	// The account that authored this status.  	Account *Account `json:"account"`  	// Media that is attached to this status. @@ -87,13 +89,15 @@ type Status struct {  	// Custom emoji to be used when rendering status content.  	Emojis []Emoji `json:"emojis"`  	// Preview card for links included within status content. +	// nullable: true  	Card *Card `json:"card"`  	// The poll attached to the status. +	// nullable: true  	Poll *Poll `json:"poll"`  	// Plain-text source of a status. Returned instead of content when status is deleted,  	// so the user may redraft from the source text without the client having to reverse-engineer  	// the original text from the HTML content. -	Text string `json:"text"` +	Text string `json:"text,omitempty"`  }  /*  | 
