summaryrefslogtreecommitdiff
path: root/internal/api
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-05-28 19:59:55 +0200
committerLibravatar GitHub <noreply@github.com>2022-05-28 18:59:55 +0100
commitae5402ada6aa794a69de455f745934b27e030d3d (patch)
tree93d228443da821b0b38cc1417742e65e92e5edec /internal/api
parent[frontend] Reduce width of profile img with screen width (#615) (diff)
downloadgotosocial-ae5402ada6aa794a69de455f745934b27e030d3d.tar.xz
[chore] Mastodon api fixups (#617)
* don't omitempty on description * don't omitempty on any fields * add ms to timestamp format * don't omitempty on text_url * rearrange attachment fields a bit * just give URL again as attachment text url * update tests * fix accidental replace
Diffstat (limited to 'internal/api')
-rw-r--r--internal/api/client/followrequest/get_test.go2
-rw-r--r--internal/api/client/instance/instancepatch_test.go2
-rw-r--r--internal/api/model/attachment.go12
-rw-r--r--internal/api/model/status.go8
4 files changed, 12 insertions, 12 deletions
diff --git a/internal/api/client/followrequest/get_test.go b/internal/api/client/followrequest/get_test.go
index c482c6932..63e4d0818 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:28Z","note":"i'm a real son of a gun","url":"http://example.org/@some_user","avatar":"","avatar_static":"","header":"","header_static":"","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.00Z","note":"i'm a real son of a gun","url":"http://example.org/@some_user","avatar":"","avatar_static":"","header":"","header_static":"","followers_count":0,"following_count":0,"statuses_count":0,"last_status_at":"","emojis":[],"fields":[]}]`, string(b))
}
func TestGetTestSuite(t *testing.T) {
diff --git a/internal/api/client/instance/instancepatch_test.go b/internal/api/client/instance/instancepatch_test.go
index 5577cbbcc..68243ded8 100644
--- a/internal/api/client/instance/instancepatch_test.go
+++ b/internal/api/client/instance/instancepatch_test.go
@@ -62,7 +62,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch1() {
b, err := io.ReadAll(result.Body)
suite.NoError(err)
- suite.Equal(`{"uri":"http://localhost:8080","title":"Example Instance","description":"","short_description":"","email":"someone@example.org","version":"","registrations":true,"approval_required":true,"invites_enabled":false,"urls":{"streaming_api":"wss://localhost:8080"},"stats":{"domain_count":0,"status_count":16,"user_count":4},"thumbnail":"","contact_account":{"id":"01F8MH17FWEB39HZJ76B6VXSKF","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"created_at":"2022-05-17T13:10:59Z","note":"","url":"http://localhost:8080/@admin","avatar":"","avatar_static":"","header":"","header_static":"","followers_count":1,"following_count":1,"statuses_count":4,"last_status_at":"2021-10-20T10:41:37Z","emojis":[],"fields":[]},"max_toot_chars":5000}`, string(b))
+ suite.Equal(`{"uri":"http://localhost:8080","title":"Example Instance","description":"","short_description":"","email":"someone@example.org","version":"","registrations":true,"approval_required":true,"invites_enabled":false,"urls":{"streaming_api":"wss://localhost:8080"},"stats":{"domain_count":0,"status_count":16,"user_count":4},"thumbnail":"","contact_account":{"id":"01F8MH17FWEB39HZJ76B6VXSKF","username":"admin","acct":"admin","display_name":"","locked":false,"bot":false,"created_at":"2022-05-17T13:10:59.00Z","note":"","url":"http://localhost:8080/@admin","avatar":"","avatar_static":"","header":"","header_static":"","followers_count":1,"following_count":1,"statuses_count":4,"last_status_at":"2021-10-20T10:41:37.00Z","emojis":[],"fields":[]},"max_toot_chars":5000}`, string(b))
}
func (suite *InstancePatchTestSuite) TestInstancePatch2() {
diff --git a/internal/api/model/attachment.go b/internal/api/model/attachment.go
index 061d7918e..3ab29d2fb 100644
--- a/internal/api/model/attachment.go
+++ b/internal/api/model/attachment.go
@@ -69,25 +69,25 @@ type Attachment struct {
// The location of the original full-size attachment.
// example: https://example.org/fileserver/some_id/attachments/some_id/original/attachment.jpeg
URL string `json:"url"`
+ // A shorter URL for the attachment.
+ // In our case, we just give the URL again since we don't create smaller URLs.
+ TextURL string `json:"text_url"`
// The location of a scaled-down preview of the attachment.
// example: https://example.org/fileserver/some_id/attachments/some_id/small/attachment.jpeg
PreviewURL string `json:"preview_url"`
// The location of the full-size original attachment on the remote server.
// Only defined for instances other than our own.
// example: https://some-other-server.org/attachments/original/ahhhhh.jpeg
- RemoteURL string `json:"remote_url,omitempty"`
+ RemoteURL string `json:"remote_url"`
// The location of a scaled-down preview of the attachment on the remote server.
// Only defined for instances other than our own.
// example: https://some-other-server.org/attachments/small/ahhhhh.jpeg
- PreviewRemoteURL string `json:"preview_remote_url,omitempty"`
- // A shorter URL for the attachment.
- // Not currently used.
- TextURL string `json:"text_url,omitempty"`
+ PreviewRemoteURL string `json:"preview_remote_url"`
// Metadata for this attachment.
Meta MediaMeta `json:"meta,omitempty"`
// Alt text that describes what is in the media attachment.
// example: This is a picture of a kitten.
- Description string `json:"description,omitempty"`
+ Description string `json:"description"`
// A hash computed by the BlurHash algorithm, for generating colorful preview thumbnails when media has not been downloaded yet.
// See https://github.com/woltapp/blurhash
Blurhash string `json:"blurhash,omitempty"`
diff --git a/internal/api/model/status.go b/internal/api/model/status.go
index fade58a49..6e25f787a 100644
--- a/internal/api/model/status.go
+++ b/internal/api/model/status.go
@@ -30,10 +30,10 @@ type Status struct {
CreatedAt string `json:"created_at"`
// ID of the status being replied to.
// example: 01FBVD42CQ3ZEEVMW180SBX03B
- InReplyToID string `json:"in_reply_to_id,omitempty"`
+ InReplyToID string `json:"in_reply_to_id"`
// ID of the account being replied to.
// example: 01FBVD42CQ3ZEEVMW180SBX03B
- InReplyToAccountID string `json:"in_reply_to_account_id,omitempty"`
+ InReplyToAccountID string `json:"in_reply_to_account_id"`
// Status contains sensitive content.
// example: false
Sensitive bool `json:"sensitive"`
@@ -67,13 +67,13 @@ type Status struct {
// This status has been bookmarked by the account viewing it.
Bookmarked bool `json:"bookmarked"`
// This status has been pinned by the account viewing it (only relevant for your own statuses).
- Pinned bool `json:"pinned,omitempty"`
+ Pinned bool `json:"pinned"`
// The content of this status. Should be HTML, but might also be plaintext in some cases.
// example: <p>Hey this is a status!</p>
Content string `json:"content"`
// The status that this status reblogs/boosts.
// nullable: true
- Reblog *StatusReblogged `json:"reblog,omitempty"`
+ Reblog *StatusReblogged `json:"reblog"`
// The application used to post this status, if visible.
Application *Application `json:"application"`
// The account that authored this status.