diff options
author | 2024-10-21 14:04:50 +0200 | |
---|---|---|
committer | 2024-10-21 14:04:50 +0200 | |
commit | 8a93300ac43ffd70ca687d71ee8eefdb755e6a58 (patch) | |
tree | 4f091a3e8ad082738f65f5ab47a1be910bc94933 /internal/api | |
parent | [chore]: Bump github.com/prometheus/client_golang from 1.20.4 to 1.20.5 (#3469) (diff) | |
download | gotosocial-8a93300ac43ffd70ca687d71ee8eefdb755e6a58.tar.xz |
[feature] Add image descriptions for default avatar + header; don't allow editing default desc (#3473)v0.17.1
Diffstat (limited to 'internal/api')
-rw-r--r-- | internal/api/client/admin/accountsgetv2_test.go | 11 | ||||
-rw-r--r-- | internal/api/client/admin/reportsget_test.go | 13 | ||||
-rw-r--r-- | internal/api/client/followrequests/get_test.go | 1 | ||||
-rw-r--r-- | internal/api/client/instance/instancepatch_test.go | 6 | ||||
-rw-r--r-- | internal/api/client/mutes/mutesget_test.go | 2 | ||||
-rw-r--r-- | internal/api/client/reports/reportget_test.go | 1 | ||||
-rw-r--r-- | internal/api/client/reports/reportsget_test.go | 4 | ||||
-rw-r--r-- | internal/api/client/statuses/statushistory_test.go | 2 | ||||
-rw-r--r-- | internal/api/client/statuses/statusmute_test.go | 4 | ||||
-rw-r--r-- | internal/api/model/account.go | 8 |
10 files changed, 51 insertions, 1 deletions
diff --git a/internal/api/client/admin/accountsgetv2_test.go b/internal/api/client/admin/accountsgetv2_test.go index 64c76cc1a..77ca135eb 100644 --- a/internal/api/client/admin/accountsgetv2_test.go +++ b/internal/api/client/admin/accountsgetv2_test.go @@ -96,6 +96,7 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 1, "following_count": 1, "statuses_count": 8, @@ -154,6 +155,7 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 1, "following_count": 1, "statuses_count": 4, @@ -208,6 +210,7 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 0, "following_count": 0, "statuses_count": 0, @@ -252,9 +255,11 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "avatar": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/original/01F8MH58A357CV5K7R7TJMSH6S.jpg", "avatar_static": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/small/01F8MH58A357CV5K7R7TJMSH6S.webp", "avatar_description": "a green goblin looking nasty", + "avatar_media_id": "01F8MH58A357CV5K7R7TJMSH6S", "header": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/original/01PFPMWK2FF0D9WMHEJHR07C3Q.jpg", "header_static": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/small/01PFPMWK2FF0D9WMHEJHR07C3Q.webp", "header_description": "A very old-school screenshot of the original team fortress mod for quake", + "header_media_id": "01PFPMWK2FF0D9WMHEJHR07C3Q", "followers_count": 2, "following_count": 2, "statuses_count": 8, @@ -302,6 +307,7 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 0, "following_count": 0, "statuses_count": 0, @@ -348,6 +354,7 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 0, "following_count": 0, "statuses_count": 1, @@ -393,6 +400,7 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 0, "following_count": 0, "statuses_count": 3, @@ -439,6 +447,7 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "header": "http://localhost:8080/fileserver/062G5WYKY35KKD12EMSM3F8PJ8/header/original/01PFPMWK2FF0D9WMHEJHR07C3R.jpg", "header_static": "http://localhost:8080/fileserver/062G5WYKY35KKD12EMSM3F8PJ8/header/small/01PFPMWK2FF0D9WMHEJHR07C3R.webp", "header_description": "tweet from thoughts of dog: i drank. all the water. in my bowl. earlier. but just now. i returned. to the same bowl. and it was. full again.. the bowl. is haunted", + "header_media_id": "01PFPMWK2FF0D9WMHEJHR07C3R", "followers_count": 0, "following_count": 0, "statuses_count": 0, @@ -484,6 +493,7 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 0, "following_count": 0, "statuses_count": 0, @@ -568,6 +578,7 @@ func (suite *AccountsGetTestSuite) TestAccountsMinID() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 0, "following_count": 0, "statuses_count": 0, diff --git a/internal/api/client/admin/reportsget_test.go b/internal/api/client/admin/reportsget_test.go index e3d0a535d..12a307836 100644 --- a/internal/api/client/admin/reportsget_test.go +++ b/internal/api/client/admin/reportsget_test.go @@ -183,6 +183,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 0, "following_count": 0, "statuses_count": 3, @@ -228,6 +229,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 1, "following_count": 1, "statuses_count": 8, @@ -286,6 +288,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 1, "following_count": 1, "statuses_count": 4, @@ -340,6 +343,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 1, "following_count": 1, "statuses_count": 4, @@ -407,6 +411,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 1, "following_count": 1, "statuses_count": 8, @@ -465,6 +470,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 0, "following_count": 0, "statuses_count": 3, @@ -512,6 +518,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 0, "following_count": 0, "statuses_count": 3, @@ -657,6 +664,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetCreatedByAccount() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 1, "following_count": 1, "statuses_count": 8, @@ -715,6 +723,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetCreatedByAccount() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 0, "following_count": 0, "statuses_count": 3, @@ -762,6 +771,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetCreatedByAccount() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 0, "following_count": 0, "statuses_count": 3, @@ -907,6 +917,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetTargetAccount() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 1, "following_count": 1, "statuses_count": 8, @@ -965,6 +976,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetTargetAccount() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 0, "following_count": 0, "statuses_count": 3, @@ -1012,6 +1024,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetTargetAccount() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 0, "following_count": 0, "statuses_count": 3, diff --git a/internal/api/client/followrequests/get_test.go b/internal/api/client/followrequests/get_test.go index 07383a319..c36253876 100644 --- a/internal/api/client/followrequests/get_test.go +++ b/internal/api/client/followrequests/get_test.go @@ -97,6 +97,7 @@ func (suite *GetTestSuite) TestGet() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 0, "following_count": 0, "statuses_count": 1, diff --git a/internal/api/client/instance/instancepatch_test.go b/internal/api/client/instance/instancepatch_test.go index 5eb15820e..0b6b02356 100644 --- a/internal/api/client/instance/instancepatch_test.go +++ b/internal/api/client/instance/instancepatch_test.go @@ -174,6 +174,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch1() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 1, "following_count": 1, "statuses_count": 4, @@ -314,6 +315,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch2() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 1, "following_count": 1, "statuses_count": 4, @@ -454,6 +456,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch3() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 1, "following_count": 1, "statuses_count": 4, @@ -645,6 +648,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch6() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 1, "following_count": 1, "statuses_count": 4, @@ -811,6 +815,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch8() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 1, "following_count": 1, "statuses_count": 4, @@ -988,6 +993,7 @@ func (suite *InstancePatchTestSuite) TestInstancePatch9() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 1, "following_count": 1, "statuses_count": 4, diff --git a/internal/api/client/mutes/mutesget_test.go b/internal/api/client/mutes/mutesget_test.go index abe5b1135..fa52c9aa9 100644 --- a/internal/api/client/mutes/mutesget_test.go +++ b/internal/api/client/mutes/mutesget_test.go @@ -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-11","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","header_description":"Flat gray background (default header).","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()) } diff --git a/internal/api/client/reports/reportget_test.go b/internal/api/client/reports/reportget_test.go index a5ed14dcd..8c9dfa1e5 100644 --- a/internal/api/client/reports/reportget_test.go +++ b/internal/api/client/reports/reportget_test.go @@ -127,6 +127,7 @@ func (suite *ReportGetTestSuite) TestGetReport1() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 0, "following_count": 0, "statuses_count": 3, diff --git a/internal/api/client/reports/reportsget_test.go b/internal/api/client/reports/reportsget_test.go index ccede98ca..0eb66e778 100644 --- a/internal/api/client/reports/reportsget_test.go +++ b/internal/api/client/reports/reportsget_test.go @@ -153,6 +153,7 @@ func (suite *ReportsGetTestSuite) TestGetReports() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 0, "following_count": 0, "statuses_count": 3, @@ -243,6 +244,7 @@ func (suite *ReportsGetTestSuite) TestGetReports4() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 0, "following_count": 0, "statuses_count": 3, @@ -317,6 +319,7 @@ func (suite *ReportsGetTestSuite) TestGetReports6() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 0, "following_count": 0, "statuses_count": 3, @@ -375,6 +378,7 @@ func (suite *ReportsGetTestSuite) TestGetReports7() { "avatar_static": "", "header": "http://localhost:8080/assets/default_header.webp", "header_static": "http://localhost:8080/assets/default_header.webp", + "header_description": "Flat gray background (default header).", "followers_count": 0, "following_count": 0, "statuses_count": 3, diff --git a/internal/api/client/statuses/statushistory_test.go b/internal/api/client/statuses/statushistory_test.go index 983da241c..aea666dbb 100644 --- a/internal/api/client/statuses/statushistory_test.go +++ b/internal/api/client/statuses/statushistory_test.go @@ -109,9 +109,11 @@ func (suite *StatusHistoryTestSuite) TestGetHistory() { "avatar": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/original/01F8MH58A357CV5K7R7TJMSH6S.jpg", "avatar_static": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/small/01F8MH58A357CV5K7R7TJMSH6S.webp", "avatar_description": "a green goblin looking nasty", + "avatar_media_id": "01F8MH58A357CV5K7R7TJMSH6S", "header": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/original/01PFPMWK2FF0D9WMHEJHR07C3Q.jpg", "header_static": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/small/01PFPMWK2FF0D9WMHEJHR07C3Q.webp", "header_description": "A very old-school screenshot of the original team fortress mod for quake", + "header_media_id": "01PFPMWK2FF0D9WMHEJHR07C3Q", "followers_count": 2, "following_count": 2, "statuses_count": 8, diff --git a/internal/api/client/statuses/statusmute_test.go b/internal/api/client/statuses/statusmute_test.go index e8b6d80f2..384761fc6 100644 --- a/internal/api/client/statuses/statusmute_test.go +++ b/internal/api/client/statuses/statusmute_test.go @@ -127,9 +127,11 @@ func (suite *StatusMuteTestSuite) TestMuteUnmuteStatus() { "avatar": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/original/01F8MH58A357CV5K7R7TJMSH6S.jpg", "avatar_static": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/small/01F8MH58A357CV5K7R7TJMSH6S.webp", "avatar_description": "a green goblin looking nasty", + "avatar_media_id": "01F8MH58A357CV5K7R7TJMSH6S", "header": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/original/01PFPMWK2FF0D9WMHEJHR07C3Q.jpg", "header_static": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/small/01PFPMWK2FF0D9WMHEJHR07C3Q.webp", "header_description": "A very old-school screenshot of the original team fortress mod for quake", + "header_media_id": "01PFPMWK2FF0D9WMHEJHR07C3Q", "followers_count": 2, "following_count": 2, "statuses_count": 8, @@ -212,9 +214,11 @@ func (suite *StatusMuteTestSuite) TestMuteUnmuteStatus() { "avatar": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/original/01F8MH58A357CV5K7R7TJMSH6S.jpg", "avatar_static": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/small/01F8MH58A357CV5K7R7TJMSH6S.webp", "avatar_description": "a green goblin looking nasty", + "avatar_media_id": "01F8MH58A357CV5K7R7TJMSH6S", "header": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/original/01PFPMWK2FF0D9WMHEJHR07C3Q.jpg", "header_static": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/small/01PFPMWK2FF0D9WMHEJHR07C3Q.webp", "header_description": "A very old-school screenshot of the original team fortress mod for quake", + "header_media_id": "01PFPMWK2FF0D9WMHEJHR07C3Q", "followers_count": 2, "following_count": 2, "statuses_count": 8, diff --git a/internal/api/model/account.go b/internal/api/model/account.go index 3ad5d5399..a27033d5d 100644 --- a/internal/api/model/account.go +++ b/internal/api/model/account.go @@ -68,6 +68,10 @@ type Account struct { // Description of this account's avatar, for alt text. // example: A cute drawing of a smiling sloth. AvatarDescription string `json:"avatar_description,omitempty"` + // Database ID of the media attachment for this account's avatar image. + // Omitted if no avatar uploaded for this account (ie., default avatar). + // example: 01JAJ3XCD66K3T99JZESCR137W + AvatarMediaID string `json:"avatar_media_id,omitempty"` // Web location of the account's header image. // example: https://example.org/media/some_user/header/original/header.jpeg Header string `json:"header"` @@ -78,6 +82,10 @@ type Account struct { // Description of this account's header, for alt text. // example: A sunlit field with purple flowers. HeaderDescription string `json:"header_description,omitempty"` + // Database ID of the media attachment for this account's header image. + // Omitted if no header uploaded for this account (ie., default header). + // example: 01JAJ3XCD66K3T99JZESCR137W + HeaderMediaID string `json:"header_media_id,omitempty"` // Number of accounts following this account, according to our instance. FollowersCount int `json:"followers_count"` // Number of account's followed by this account, according to our instance. |