From 96f11e757cd28ad3e6ce6ad243ee8bd459d3b124 Mon Sep 17 00:00:00 2001 From: David Baker Date: Sun, 13 Nov 2022 20:38:01 +0000 Subject: [bugfix] Fix login on Mastodon iOS app for users with no statuses (#1042) * Fix login on Mastodon iOS app for users with no statuses Mastodon for iOS can't cope with an empty string for a date and expect a JSON `null` instead. Fixes https://github.com/superseriousbusiness/gotosocial/issues/1010 * Fix expected values in tests to match --- internal/api/client/followrequest/get_test.go | 2 +- internal/api/model/account.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'internal/api') diff --git a/internal/api/client/followrequest/get_test.go b/internal/api/client/followrequest/get_test.go index adf55c8b6..01c9cc300 100644 --- a/internal/api/client/followrequest/get_test.go +++ b/internal/api/client/followrequest/get_test.go @@ -70,7 +70,7 @@ func (suite *GetTestSuite) TestGet() { b, err := ioutil.ReadAll(result.Body) assert.NoError(suite.T(), err) - suite.Equal(`[{"id":"01FHMQX3GAABWSM0S2VZEC2SWC","username":"some_user","acct":"some_user@example.org","display_name":"some user","locked":true,"bot":false,"created_at":"2020-08-10T12:13:28.000Z","note":"i'm a real son of a gun","url":"http://example.org/@some_user","avatar":"","avatar_static":"","header":"http://localhost:8080/assets/default_header.png","header_static":"http://localhost:8080/assets/default_header.png","followers_count":0,"following_count":0,"statuses_count":0,"last_status_at":"","emojis":[],"fields":[]}]`, string(b)) + suite.Equal(`[{"id":"01FHMQX3GAABWSM0S2VZEC2SWC","username":"some_user","acct":"some_user@example.org","display_name":"some user","locked":true,"bot":false,"created_at":"2020-08-10T12:13:28.000Z","note":"i'm a real son of a gun","url":"http://example.org/@some_user","avatar":"","avatar_static":"","header":"http://localhost:8080/assets/default_header.png","header_static":"http://localhost:8080/assets/default_header.png","followers_count":0,"following_count":0,"statuses_count":0,"last_status_at":null,"emojis":[],"fields":[]}]`, string(b)) } func TestGetTestSuite(t *testing.T) { diff --git a/internal/api/model/account.go b/internal/api/model/account.go index f8bb4f4a0..fb781d61f 100644 --- a/internal/api/model/account.go +++ b/internal/api/model/account.go @@ -78,7 +78,7 @@ type Account struct { StatusesCount int `json:"statuses_count"` // When the account's most recent status was posted (ISO 8601 Datetime). // example: 2021-07-30T09:20:25+00:00 - LastStatusAt string `json:"last_status_at"` + LastStatusAt *string `json:"last_status_at"` // Array of custom emojis used in this account's note or display name. Emojis []Emoji `json:"emojis"` // Additional metadata attached to this account's profile. -- cgit v1.2.3