[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
This commit is contained in:
David Baker
2022-11-13 20:38:01 +00:00
committed by GitHub
parent e8c733da3f
commit 96f11e757c
4 changed files with 6 additions and 5 deletions

View File

@ -105,10 +105,11 @@ func (c *converter) AccountToAPIAccountPublic(ctx context.Context, a *gtsmodel.A
}
// check when the last status was
var lastStatusAt string
var lastStatusAt *string
lastPosted, err := c.db.GetAccountLastPosted(ctx, a.ID, false)
if err == nil && !lastPosted.IsZero() {
lastStatusAt = util.FormatISO8601(lastPosted)
lastStatusAtTemp := util.FormatISO8601(lastPosted)
lastStatusAt = &lastStatusAtTemp
}
// set account avatar fields if available