Skip to content

Commit

Permalink
[feature] Add image descriptions for default avatar + header; don't a…
Browse files Browse the repository at this point in the history
…llow editing default desc (#3473)
  • Loading branch information
tsmethurst authored Oct 21, 2024
1 parent e9299e1 commit 8a93300
Show file tree
Hide file tree
Showing 22 changed files with 198 additions and 25 deletions.
28 changes: 28 additions & 0 deletions docs/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,13 @@ definitions:
example: A cute drawing of a smiling sloth.
type: string
x-go-name: AvatarDescription
avatar_media_id:
description: |-
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
type: string
x-go-name: AvatarMediaID
avatar_static:
description: |-
Web location of a static version of the account's avatar.
Expand Down Expand Up @@ -277,6 +284,13 @@ definitions:
example: A sunlit field with purple flowers.
type: string
x-go-name: HeaderDescription
header_media_id:
description: |-
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
type: string
x-go-name: HeaderMediaID
header_static:
description: |-
Web location of a static version of the account's header.
Expand Down Expand Up @@ -2211,6 +2225,13 @@ definitions:
example: A cute drawing of a smiling sloth.
type: string
x-go-name: AvatarDescription
avatar_media_id:
description: |-
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
type: string
x-go-name: AvatarMediaID
avatar_static:
description: |-
Web location of a static version of the account's avatar.
Expand Down Expand Up @@ -2282,6 +2303,13 @@ definitions:
example: A sunlit field with purple flowers.
type: string
x-go-name: HeaderDescription
header_media_id:
description: |-
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
type: string
x-go-name: HeaderMediaID
header_static:
description: |-
Web location of a static version of the account's header.
Expand Down
11 changes: 11 additions & 0 deletions internal/api/client/admin/accountsgetv2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
13 changes: 13 additions & 0 deletions internal/api/client/admin/reportsget_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions internal/api/client/followrequests/get_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions internal/api/client/instance/instancepatch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion internal/api/client/mutes/mutesget_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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":"[email protected]","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":"[email protected]","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())
}
Expand Down
1 change: 1 addition & 0 deletions internal/api/client/reports/reportget_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 4 additions & 0 deletions internal/api/client/reports/reportsget_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
Loading

0 comments on commit 8a93300

Please sign in to comment.