[bugfix] Account.last_status_at is a date, not datetime (#3419)

* [bugfix] Account.last_status_at is a date, not datetime

Fix #3418

* update swagger
This commit is contained in:
Markus Unterwaditzer 2024-10-12 10:02:26 +02:00 committed by GitHub
parent 77d755e330
commit 95a316236e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 86 additions and 79 deletions

View file

@ -296,8 +296,8 @@ definitions:
type: string
x-go-name: ID
last_status_at:
description: When the account's most recent status was posted (ISO 8601 Datetime).
example: "2021-07-30T09:20:25+00:00"
description: When the account's most recent status was posted (ISO 8601 Date).
example: "2021-07-30"
type: string
x-go-name: LastStatusAt
locked:
@ -2301,8 +2301,8 @@ definitions:
type: string
x-go-name: ID
last_status_at:
description: When the account's most recent status was posted (ISO 8601 Datetime).
example: "2021-07-30T09:20:25+00:00"
description: When the account's most recent status was posted (ISO 8601 Date).
example: "2021-07-30"
type: string
x-go-name: LastStatusAt
locked:

View file

@ -99,7 +99,7 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 8,
"last_status_at": "2021-07-28T08:40:37.000Z",
"last_status_at": "2021-07-28",
"emojis": [],
"fields": [
{
@ -157,7 +157,7 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 4,
"last_status_at": "2021-10-20T10:41:37.000Z",
"last_status_at": "2021-10-20",
"emojis": [],
"fields": [],
"enable_rss": true,
@ -258,7 +258,7 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() {
"followers_count": 2,
"following_count": 2,
"statuses_count": 8,
"last_status_at": "2024-01-10T09:24:00.000Z",
"last_status_at": "2024-01-10",
"emojis": [],
"fields": [],
"enable_rss": true
@ -351,7 +351,7 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() {
"followers_count": 0,
"following_count": 0,
"statuses_count": 1,
"last_status_at": "2023-11-02T10:44:25.000Z",
"last_status_at": "2023-11-02",
"emojis": [],
"fields": []
}
@ -396,7 +396,7 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() {
"followers_count": 0,
"following_count": 0,
"statuses_count": 3,
"last_status_at": "2021-09-11T09:40:37.000Z",
"last_status_at": "2021-09-11",
"emojis": [],
"fields": []
}

View file

@ -186,7 +186,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() {
"followers_count": 0,
"following_count": 0,
"statuses_count": 3,
"last_status_at": "2021-09-11T09:40:37.000Z",
"last_status_at": "2021-09-11",
"emojis": [],
"fields": []
}
@ -231,7 +231,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 8,
"last_status_at": "2021-07-28T08:40:37.000Z",
"last_status_at": "2021-07-28",
"emojis": [],
"fields": [
{
@ -289,7 +289,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 4,
"last_status_at": "2021-10-20T10:41:37.000Z",
"last_status_at": "2021-10-20",
"emojis": [],
"fields": [],
"enable_rss": true,
@ -343,7 +343,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 4,
"last_status_at": "2021-10-20T10:41:37.000Z",
"last_status_at": "2021-10-20",
"emojis": [],
"fields": [],
"enable_rss": true,
@ -410,7 +410,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 8,
"last_status_at": "2021-07-28T08:40:37.000Z",
"last_status_at": "2021-07-28",
"emojis": [],
"fields": [
{
@ -468,7 +468,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() {
"followers_count": 0,
"following_count": 0,
"statuses_count": 3,
"last_status_at": "2021-09-11T09:40:37.000Z",
"last_status_at": "2021-09-11",
"emojis": [],
"fields": []
}
@ -515,7 +515,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() {
"followers_count": 0,
"following_count": 0,
"statuses_count": 3,
"last_status_at": "2021-09-11T09:40:37.000Z",
"last_status_at": "2021-09-11",
"emojis": [],
"fields": []
},
@ -660,7 +660,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetCreatedByAccount() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 8,
"last_status_at": "2021-07-28T08:40:37.000Z",
"last_status_at": "2021-07-28",
"emojis": [],
"fields": [
{
@ -718,7 +718,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetCreatedByAccount() {
"followers_count": 0,
"following_count": 0,
"statuses_count": 3,
"last_status_at": "2021-09-11T09:40:37.000Z",
"last_status_at": "2021-09-11",
"emojis": [],
"fields": []
}
@ -765,7 +765,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetCreatedByAccount() {
"followers_count": 0,
"following_count": 0,
"statuses_count": 3,
"last_status_at": "2021-09-11T09:40:37.000Z",
"last_status_at": "2021-09-11",
"emojis": [],
"fields": []
},
@ -910,7 +910,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetTargetAccount() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 8,
"last_status_at": "2021-07-28T08:40:37.000Z",
"last_status_at": "2021-07-28",
"emojis": [],
"fields": [
{
@ -968,7 +968,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetTargetAccount() {
"followers_count": 0,
"following_count": 0,
"statuses_count": 3,
"last_status_at": "2021-09-11T09:40:37.000Z",
"last_status_at": "2021-09-11",
"emojis": [],
"fields": []
}
@ -1015,7 +1015,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetTargetAccount() {
"followers_count": 0,
"following_count": 0,
"statuses_count": 3,
"last_status_at": "2021-09-11T09:40:37.000Z",
"last_status_at": "2021-09-11",
"emojis": [],
"fields": []
},

View file

@ -100,7 +100,7 @@ func (suite *GetTestSuite) TestGet() {
"followers_count": 0,
"following_count": 0,
"statuses_count": 1,
"last_status_at": "2023-11-02T10:44:25.000Z",
"last_status_at": "2023-11-02",
"emojis": [],
"fields": []
}

View file

@ -177,7 +177,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch1() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 4,
"last_status_at": "2021-10-20T10:41:37.000Z",
"last_status_at": "2021-10-20",
"emojis": [],
"fields": [],
"enable_rss": true,
@ -317,7 +317,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch2() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 4,
"last_status_at": "2021-10-20T10:41:37.000Z",
"last_status_at": "2021-10-20",
"emojis": [],
"fields": [],
"enable_rss": true,
@ -457,7 +457,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch3() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 4,
"last_status_at": "2021-10-20T10:41:37.000Z",
"last_status_at": "2021-10-20",
"emojis": [],
"fields": [],
"enable_rss": true,
@ -648,7 +648,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch6() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 4,
"last_status_at": "2021-10-20T10:41:37.000Z",
"last_status_at": "2021-10-20",
"emojis": [],
"fields": [],
"enable_rss": true,
@ -814,7 +814,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch8() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 4,
"last_status_at": "2021-10-20T10:41:37.000Z",
"last_status_at": "2021-10-20",
"emojis": [],
"fields": [],
"enable_rss": true,
@ -991,7 +991,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch9() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 4,
"last_status_at": "2021-10-20T10:41:37.000Z",
"last_status_at": "2021-10-20",
"emojis": [],
"fields": [],
"enable_rss": true,

View file

@ -148,7 +148,7 @@ func (suite *MutesTestSuite) TestIndefinitelyMutedAccountSerializesMuteExpiratio
// Fetch all muted accounts for the logged-in account.
// The expected body contains `"mute_expires_at":null`.
_, err = suite.getMutedAccounts(http.StatusOK, `[{"id":"01F8MH5ZK5VRH73AKHQM6Y9VNX","username":"foss_satan","acct":"foss_satan@fossbros-anonymous.io","display_name":"big gerald","locked":false,"discoverable":true,"bot":false,"created_at":"2021-09-26T10:52:36.000Z","note":"i post about like, i dunno, stuff, or whatever!!!!","url":"http://fossbros-anonymous.io/@foss_satan","avatar":"","avatar_static":"","header":"http://localhost:8080/assets/default_header.webp","header_static":"http://localhost:8080/assets/default_header.webp","followers_count":0,"following_count":0,"statuses_count":3,"last_status_at":"2021-09-11T09:40:37.000Z","emojis":[],"fields":[],"mute_expires_at":null}]`)
_, err = suite.getMutedAccounts(http.StatusOK, `[{"id":"01F8MH5ZK5VRH73AKHQM6Y9VNX","username":"foss_satan","acct":"foss_satan@fossbros-anonymous.io","display_name":"big gerald","locked":false,"discoverable":true,"bot":false,"created_at":"2021-09-26T10:52:36.000Z","note":"i post about like, i dunno, stuff, or whatever!!!!","url":"http://fossbros-anonymous.io/@foss_satan","avatar":"","avatar_static":"","header":"http://localhost:8080/assets/default_header.webp","header_static":"http://localhost:8080/assets/default_header.webp","followers_count":0,"following_count":0,"statuses_count":3,"last_status_at":"2021-09-11","emojis":[],"fields":[],"mute_expires_at":null}]`)
if err != nil {
suite.FailNow(err.Error())
}

View file

@ -130,7 +130,7 @@ func (suite *ReportGetTestSuite) TestGetReport1() {
"followers_count": 0,
"following_count": 0,
"statuses_count": 3,
"last_status_at": "2021-09-11T09:40:37.000Z",
"last_status_at": "2021-09-11",
"emojis": [],
"fields": []
}

View file

@ -156,7 +156,7 @@ func (suite *ReportsGetTestSuite) TestGetReports() {
"followers_count": 0,
"following_count": 0,
"statuses_count": 3,
"last_status_at": "2021-09-11T09:40:37.000Z",
"last_status_at": "2021-09-11",
"emojis": [],
"fields": []
}
@ -246,7 +246,7 @@ func (suite *ReportsGetTestSuite) TestGetReports4() {
"followers_count": 0,
"following_count": 0,
"statuses_count": 3,
"last_status_at": "2021-09-11T09:40:37.000Z",
"last_status_at": "2021-09-11",
"emojis": [],
"fields": []
}
@ -320,7 +320,7 @@ func (suite *ReportsGetTestSuite) TestGetReports6() {
"followers_count": 0,
"following_count": 0,
"statuses_count": 3,
"last_status_at": "2021-09-11T09:40:37.000Z",
"last_status_at": "2021-09-11",
"emojis": [],
"fields": []
}
@ -378,7 +378,7 @@ func (suite *ReportsGetTestSuite) TestGetReports7() {
"followers_count": 0,
"following_count": 0,
"statuses_count": 3,
"last_status_at": "2021-09-11T09:40:37.000Z",
"last_status_at": "2021-09-11",
"emojis": [],
"fields": []
}

View file

@ -115,7 +115,7 @@ func (suite *StatusHistoryTestSuite) TestGetHistory() {
"followers_count": 2,
"following_count": 2,
"statuses_count": 8,
"last_status_at": "2024-01-10T09:24:00.000Z",
"last_status_at": "2024-01-10",
"emojis": [],
"fields": [],
"enable_rss": true

View file

@ -133,7 +133,7 @@ func (suite *StatusMuteTestSuite) TestMuteUnmuteStatus() {
"followers_count": 2,
"following_count": 2,
"statuses_count": 8,
"last_status_at": "2024-01-10T09:24:00.000Z",
"last_status_at": "2024-01-10",
"emojis": [],
"fields": [],
"enable_rss": true
@ -218,7 +218,7 @@ func (suite *StatusMuteTestSuite) TestMuteUnmuteStatus() {
"followers_count": 2,
"following_count": 2,
"statuses_count": 8,
"last_status_at": "2024-01-10T09:24:00.000Z",
"last_status_at": "2024-01-10",
"emojis": [],
"fields": [],
"enable_rss": true

View file

@ -84,8 +84,8 @@ type Account struct {
FollowingCount int `json:"following_count"`
// Number of statuses posted by this account, according to our instance.
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
// When the account's most recent status was posted (ISO 8601 Date).
// example: 2021-07-30
LastStatusAt *string `json:"last_status_at"`
// Array of custom emojis used in this account's note or display name.
// Empty for blocked accounts.

View file

@ -79,7 +79,7 @@ func (suite *NotificationTestSuite) TestStreamNotification() {
"followers_count": 0,
"following_count": 0,
"statuses_count": 3,
"last_status_at": "2021-09-11T09:40:37.000Z",
"last_status_at": "2021-09-11",
"emojis": [],
"fields": []
}

View file

@ -90,7 +90,7 @@ func (suite *StatusUpdateTestSuite) TestStreamNotification() {
"followers_count": 0,
"following_count": 0,
"statuses_count": 3,
"last_status_at": "2021-09-11T09:40:37.000Z",
"last_status_at": "2021-09-11",
"emojis": [],
"fields": []
},

View file

@ -259,7 +259,7 @@ func (c *Converter) accountToAPIAccountPublic(ctx context.Context, a *gtsmodel.A
if a.Stats.LastStatusAt.IsZero() {
return nil
}
return util.Ptr(util.FormatISO8601(a.Stats.LastStatusAt))
return util.Ptr(util.FormatISO8601Date(a.Stats.LastStatusAt))
}()
)

View file

@ -66,7 +66,7 @@ func (suite *InternalToFrontendTestSuite) TestAccountToFrontend() {
"followers_count": 2,
"following_count": 2,
"statuses_count": 8,
"last_status_at": "2024-01-10T09:24:00.000Z",
"last_status_at": "2024-01-10",
"emojis": [],
"fields": [],
"enable_rss": true
@ -116,7 +116,7 @@ func (suite *InternalToFrontendTestSuite) TestAccountToFrontendAliasedAndMoved()
"followers_count": 2,
"following_count": 2,
"statuses_count": 8,
"last_status_at": "2024-01-10T09:24:00.000Z",
"last_status_at": "2024-01-10",
"emojis": [],
"fields": [],
"source": {
@ -158,7 +158,7 @@ func (suite *InternalToFrontendTestSuite) TestAccountToFrontendAliasedAndMoved()
"followers_count": 1,
"following_count": 1,
"statuses_count": 8,
"last_status_at": "2021-07-28T08:40:37.000Z",
"last_status_at": "2021-07-28",
"emojis": [],
"fields": [
{
@ -211,7 +211,7 @@ func (suite *InternalToFrontendTestSuite) TestAccountToFrontendWithEmojiStruct()
"followers_count": 2,
"following_count": 2,
"statuses_count": 8,
"last_status_at": "2024-01-10T09:24:00.000Z",
"last_status_at": "2024-01-10",
"emojis": [
{
"shortcode": "rainbow",
@ -258,7 +258,7 @@ func (suite *InternalToFrontendTestSuite) TestAccountToFrontendWithEmojiIDs() {
"followers_count": 2,
"following_count": 2,
"statuses_count": 8,
"last_status_at": "2024-01-10T09:24:00.000Z",
"last_status_at": "2024-01-10",
"emojis": [
{
"shortcode": "rainbow",
@ -301,7 +301,7 @@ func (suite *InternalToFrontendTestSuite) TestAccountToFrontendSensitive() {
"followers_count": 2,
"following_count": 2,
"statuses_count": 8,
"last_status_at": "2024-01-10T09:24:00.000Z",
"last_status_at": "2024-01-10",
"emojis": [],
"fields": [],
"source": {
@ -489,7 +489,7 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontend() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 4,
"last_status_at": "2021-10-20T10:41:37.000Z",
"last_status_at": "2021-10-20",
"emojis": [],
"fields": [],
"enable_rss": true,
@ -666,7 +666,7 @@ func (suite *InternalToFrontendTestSuite) TestWarnFilteredStatusToFrontend() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 4,
"last_status_at": "2021-10-20T10:41:37.000Z",
"last_status_at": "2021-10-20",
"emojis": [],
"fields": [],
"enable_rss": true,
@ -853,7 +853,7 @@ func (suite *InternalToFrontendTestSuite) TestWarnFilteredBoostToFrontend() {
"followers_count": 2,
"following_count": 2,
"statuses_count": 8,
"last_status_at": "2024-01-10T09:24:00.000Z",
"last_status_at": "2024-01-10",
"emojis": [],
"fields": [],
"enable_rss": true
@ -980,7 +980,7 @@ func (suite *InternalToFrontendTestSuite) TestWarnFilteredBoostToFrontend() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 4,
"last_status_at": "2021-10-20T10:41:37.000Z",
"last_status_at": "2021-10-20",
"emojis": [],
"fields": [],
"enable_rss": true,
@ -1235,7 +1235,7 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontendUnknownAttachments
"followers_count": 0,
"following_count": 0,
"statuses_count": 1,
"last_status_at": "2023-11-02T10:44:25.000Z",
"last_status_at": "2023-11-02",
"emojis": [],
"fields": []
},
@ -1398,7 +1398,7 @@ func (suite *InternalToFrontendTestSuite) TestStatusToWebStatus() {
"followers_count": 0,
"following_count": 0,
"statuses_count": 1,
"last_status_at": "2023-11-02T10:44:25.000Z",
"last_status_at": "2023-11-02",
"emojis": [],
"fields": []
},
@ -1530,7 +1530,7 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontendUnknownLanguage()
"followers_count": 1,
"following_count": 1,
"statuses_count": 4,
"last_status_at": "2021-10-20T10:41:37.000Z",
"last_status_at": "2021-10-20",
"emojis": [],
"fields": [],
"enable_rss": true,
@ -1674,7 +1674,7 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontendPartialInteraction
"followers_count": 2,
"following_count": 2,
"statuses_count": 8,
"last_status_at": "2024-01-10T09:24:00.000Z",
"last_status_at": "2024-01-10",
"emojis": [],
"fields": [],
"enable_rss": true
@ -1780,7 +1780,7 @@ func (suite *InternalToFrontendTestSuite) TestStatusToAPIStatusPendingApproval()
"followers_count": 1,
"following_count": 1,
"statuses_count": 4,
"last_status_at": "2021-10-20T10:41:37.000Z",
"last_status_at": "2021-10-20",
"emojis": [],
"fields": [],
"enable_rss": true,
@ -1990,7 +1990,7 @@ func (suite *InternalToFrontendTestSuite) TestInstanceV1ToFrontend() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 4,
"last_status_at": "2021-10-20T10:41:37.000Z",
"last_status_at": "2021-10-20",
"emojis": [],
"fields": [],
"enable_rss": true,
@ -2130,7 +2130,7 @@ func (suite *InternalToFrontendTestSuite) TestInstanceV2ToFrontend() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 4,
"last_status_at": "2021-10-20T10:41:37.000Z",
"last_status_at": "2021-10-20",
"emojis": [],
"fields": [],
"enable_rss": true,
@ -2250,7 +2250,7 @@ func (suite *InternalToFrontendTestSuite) TestReportToFrontend1() {
"followers_count": 0,
"following_count": 0,
"statuses_count": 3,
"last_status_at": "2021-09-11T09:40:37.000Z",
"last_status_at": "2021-09-11",
"emojis": [],
"fields": []
}
@ -2293,7 +2293,7 @@ func (suite *InternalToFrontendTestSuite) TestReportToFrontend2() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 8,
"last_status_at": "2021-07-28T08:40:37.000Z",
"last_status_at": "2021-07-28",
"emojis": [],
"fields": [
{
@ -2369,7 +2369,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontend1() {
"followers_count": 0,
"following_count": 0,
"statuses_count": 3,
"last_status_at": "2021-09-11T09:40:37.000Z",
"last_status_at": "2021-09-11",
"emojis": [],
"fields": []
}
@ -2414,7 +2414,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontend1() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 8,
"last_status_at": "2021-07-28T08:40:37.000Z",
"last_status_at": "2021-07-28",
"emojis": [],
"fields": [
{
@ -2472,7 +2472,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontend1() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 4,
"last_status_at": "2021-10-20T10:41:37.000Z",
"last_status_at": "2021-10-20",
"emojis": [],
"fields": [],
"enable_rss": true,
@ -2526,7 +2526,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontend1() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 4,
"last_status_at": "2021-10-20T10:41:37.000Z",
"last_status_at": "2021-10-20",
"emojis": [],
"fields": [],
"enable_rss": true,
@ -2603,7 +2603,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontend2() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 8,
"last_status_at": "2021-07-28T08:40:37.000Z",
"last_status_at": "2021-07-28",
"emojis": [],
"fields": [
{
@ -2661,7 +2661,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontend2() {
"followers_count": 0,
"following_count": 0,
"statuses_count": 3,
"last_status_at": "2021-09-11T09:40:37.000Z",
"last_status_at": "2021-09-11",
"emojis": [],
"fields": []
}
@ -2708,7 +2708,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontend2() {
"followers_count": 0,
"following_count": 0,
"statuses_count": 3,
"last_status_at": "2021-09-11T09:40:37.000Z",
"last_status_at": "2021-09-11",
"emojis": [],
"fields": []
},
@ -2866,7 +2866,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontendSuspendedLoca
"followers_count": 0,
"following_count": 0,
"statuses_count": 3,
"last_status_at": "2021-09-11T09:40:37.000Z",
"last_status_at": "2021-09-11",
"emojis": [],
"fields": []
}
@ -2958,7 +2958,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontendSuspendedLoca
"followers_count": 1,
"following_count": 1,
"statuses_count": 4,
"last_status_at": "2021-10-20T10:41:37.000Z",
"last_status_at": "2021-10-20",
"emojis": [],
"fields": [],
"enable_rss": true,
@ -3012,7 +3012,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontendSuspendedLoca
"followers_count": 1,
"following_count": 1,
"statuses_count": 4,
"last_status_at": "2021-10-20T10:41:37.000Z",
"last_status_at": "2021-10-20",
"emojis": [],
"fields": [],
"enable_rss": true,
@ -3158,7 +3158,7 @@ func (suite *InternalToFrontendTestSuite) TestIntReqToAPI() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 4,
"last_status_at": "2021-10-20T10:41:37.000Z",
"last_status_at": "2021-10-20",
"emojis": [],
"fields": [],
"enable_rss": true,
@ -3213,7 +3213,7 @@ func (suite *InternalToFrontendTestSuite) TestIntReqToAPI() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 8,
"last_status_at": "2021-07-28T08:40:37.000Z",
"last_status_at": "2021-07-28",
"emojis": [],
"fields": [
{
@ -3305,7 +3305,7 @@ func (suite *InternalToFrontendTestSuite) TestIntReqToAPI() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 4,
"last_status_at": "2021-10-20T10:41:37.000Z",
"last_status_at": "2021-10-20",
"emojis": [],
"fields": [],
"enable_rss": true,
@ -3420,7 +3420,7 @@ func (suite *InternalToFrontendTestSuite) TestConversationToAPISelfConvo() {
"followers_count": 2,
"following_count": 2,
"statuses_count": 8,
"last_status_at": "2024-01-10T09:24:00.000Z",
"last_status_at": "2024-01-10",
"emojis": [],
"fields": [],
"enable_rss": true
@ -3471,7 +3471,7 @@ func (suite *InternalToFrontendTestSuite) TestConversationToAPISelfConvo() {
"followers_count": 2,
"following_count": 2,
"statuses_count": 8,
"last_status_at": "2024-01-10T09:24:00.000Z",
"last_status_at": "2024-01-10",
"emojis": [],
"fields": [],
"enable_rss": true
@ -3572,7 +3572,7 @@ func (suite *InternalToFrontendTestSuite) TestConversationToAPI() {
"followers_count": 1,
"following_count": 1,
"statuses_count": 8,
"last_status_at": "2021-07-28T08:40:37.000Z",
"last_status_at": "2021-07-28",
"emojis": [],
"fields": [
{
@ -3634,7 +3634,7 @@ func (suite *InternalToFrontendTestSuite) TestConversationToAPI() {
"followers_count": 2,
"following_count": 2,
"statuses_count": 8,
"last_status_at": "2024-01-10T09:24:00.000Z",
"last_status_at": "2024-01-10",
"emojis": [],
"fields": [],
"enable_rss": true

View file

@ -21,6 +21,7 @@
// ISO8601 is a formatter for serializing times that forces ISO8601 behavior.
const ISO8601 = "2006-01-02T15:04:05.000Z"
const ISO8601Date = "2006-01-02"
// FormatISO8601 converts the given time to UTC and then formats it
// using the ISO8601 const, which the Mastodon API is able to understand.
@ -28,6 +29,12 @@ func FormatISO8601(t time.Time) string {
return t.UTC().Format(ISO8601)
}
// Mastodon returns UTC dates (without time) for last_status_at/LastStatusAt as
// a special case, but most of the time you want to use FormatISO8601 instead.
func FormatISO8601Date(t time.Time) string {
return t.UTC().Format(ISO8601Date)
}
// ParseISO8601 parses the given time string according to the ISO8601 const.
func ParseISO8601(in string) (time.Time, error) {
return time.Parse(ISO8601, in)