From 8a93300ac43ffd70ca687d71ee8eefdb755e6a58 Mon Sep 17 00:00:00 2001 From: tobi <31960611+tsmethurst@users.noreply.github.com> Date: Mon, 21 Oct 2024 14:04:50 +0200 Subject: [PATCH] [feature] Add image descriptions for default avatar + header; don't allow editing default desc (#3473) --- docs/api/swagger.yaml | 28 +++++++++++ .../api/client/admin/accountsgetv2_test.go | 11 ++++ internal/api/client/admin/reportsget_test.go | 13 +++++ .../api/client/followrequests/get_test.go | 1 + .../api/client/instance/instancepatch_test.go | 6 +++ internal/api/client/mutes/mutesget_test.go | 2 +- internal/api/client/reports/reportget_test.go | 1 + .../api/client/reports/reportsget_test.go | 4 ++ .../api/client/statuses/statushistory_test.go | 2 + .../api/client/statuses/statusmute_test.go | 4 ++ internal/api/model/account.go | 8 +++ .../processing/stream/notification_test.go | 1 + .../processing/stream/statusupdate_test.go | 1 + internal/typeutils/defaulticons.go | 6 +++ internal/typeutils/internaltofrontend.go | 6 +++ internal/typeutils/internaltofrontend_test.go | 50 +++++++++++++++++++ .../settings/components/user-logout-card.tsx | 27 ++++++---- web/source/settings/lib/query/oauth/index.ts | 3 +- web/source/settings/lib/types/account.ts | 6 ++- web/source/settings/style.css | 5 ++ .../settings/views/user/posts/index.tsx | 8 ++- web/source/settings/views/user/profile.tsx | 30 +++++++---- 22 files changed, 198 insertions(+), 25 deletions(-) diff --git a/docs/api/swagger.yaml b/docs/api/swagger.yaml index ee2fb5974..2370cc36c 100644 --- a/docs/api/swagger.yaml +++ b/docs/api/swagger.yaml @@ -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. @@ -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. @@ -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. @@ -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. 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. diff --git a/internal/processing/stream/notification_test.go b/internal/processing/stream/notification_test.go index 1f04d5103..169e4f5ce 100644 --- a/internal/processing/stream/notification_test.go +++ b/internal/processing/stream/notification_test.go @@ -76,6 +76,7 @@ func (suite *NotificationTestSuite) TestStreamNotification() { "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/processing/stream/statusupdate_test.go b/internal/processing/stream/statusupdate_test.go index 97e056175..b61a9c623 100644 --- a/internal/processing/stream/statusupdate_test.go +++ b/internal/processing/stream/statusupdate_test.go @@ -87,6 +87,7 @@ func (suite *StatusUpdateTestSuite) TestStreamNotification() { "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/typeutils/defaulticons.go b/internal/typeutils/defaulticons.go index 88785879c..1076d3476 100644 --- a/internal/typeutils/defaulticons.go +++ b/internal/typeutils/defaulticons.go @@ -117,6 +117,9 @@ func (c *Converter) ensureAvatar(account *apimodel.Account) { account.Avatar = avatar account.AvatarStatic = avatar + + const defaultAviDesc = "Grayed-out line drawing of a cute sloth (default avatar)." + account.AvatarDescription = defaultAviDesc } // ensureHeader ensures that the given account has a value set @@ -134,4 +137,7 @@ func (c *Converter) ensureHeader(account *apimodel.Account) { h := config.GetProtocol() + "://" + config.GetHost() + defaultHeaderPath account.Header = h account.HeaderStatic = h + + const defaultHeaderDesc = "Flat gray background (default header)." + account.HeaderDescription = defaultHeaderDesc } diff --git a/internal/typeutils/internaltofrontend.go b/internal/typeutils/internaltofrontend.go index 1e20455c3..11bc73dc3 100644 --- a/internal/typeutils/internaltofrontend.go +++ b/internal/typeutils/internaltofrontend.go @@ -270,21 +270,25 @@ func (c *Converter) accountToAPIAccountPublic(ctx context.Context, a *gtsmodel.A // - Emojis var ( + aviID string aviURL string aviURLStatic string aviDesc string + headerID string headerURL string headerURLStatic string headerDesc string ) if a.AvatarMediaAttachment != nil { + aviID = a.AvatarMediaAttachmentID aviURL = a.AvatarMediaAttachment.URL aviURLStatic = a.AvatarMediaAttachment.Thumbnail.URL aviDesc = a.AvatarMediaAttachment.Description } if a.HeaderMediaAttachment != nil { + headerID = a.HeaderMediaAttachmentID headerURL = a.HeaderMediaAttachment.URL headerURLStatic = a.HeaderMediaAttachment.Thumbnail.URL headerDesc = a.HeaderMediaAttachment.Description @@ -367,9 +371,11 @@ func (c *Converter) accountToAPIAccountPublic(ctx context.Context, a *gtsmodel.A Avatar: aviURL, AvatarStatic: aviURLStatic, AvatarDescription: aviDesc, + AvatarMediaID: aviID, Header: headerURL, HeaderStatic: headerURLStatic, HeaderDescription: headerDesc, + HeaderMediaID: headerID, FollowersCount: followersCount, FollowingCount: followingCount, StatusesCount: statusesCount, diff --git a/internal/typeutils/internaltofrontend_test.go b/internal/typeutils/internaltofrontend_test.go index e0671ed79..cfb28bdf9 100644 --- a/internal/typeutils/internaltofrontend_test.go +++ b/internal/typeutils/internaltofrontend_test.go @@ -60,9 +60,11 @@ func (suite *InternalToFrontendTestSuite) TestAccountToFrontend() { "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, @@ -110,9 +112,11 @@ func (suite *InternalToFrontendTestSuite) TestAccountToFrontendAliasedAndMoved() "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, @@ -155,6 +159,7 @@ func (suite *InternalToFrontendTestSuite) TestAccountToFrontendAliasedAndMoved() "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, @@ -205,9 +210,11 @@ func (suite *InternalToFrontendTestSuite) TestAccountToFrontendWithEmojiStruct() "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, @@ -252,9 +259,11 @@ func (suite *InternalToFrontendTestSuite) TestAccountToFrontendWithEmojiIDs() { "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, @@ -295,9 +304,11 @@ func (suite *InternalToFrontendTestSuite) TestAccountToFrontendSensitive() { "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, @@ -352,6 +363,7 @@ func (suite *InternalToFrontendTestSuite) TestAccountToFrontendPublicPunycode() "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, @@ -390,6 +402,7 @@ func (suite *InternalToFrontendTestSuite) TestLocalInstanceAccountToFrontendPubl "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, @@ -428,6 +441,7 @@ func (suite *InternalToFrontendTestSuite) TestLocalInstanceAccountToFrontendBloc "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, @@ -486,6 +500,7 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontend() { "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, @@ -663,6 +678,7 @@ func (suite *InternalToFrontendTestSuite) TestWarnFilteredStatusToFrontend() { "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, @@ -847,9 +863,11 @@ func (suite *InternalToFrontendTestSuite) TestWarnFilteredBoostToFrontend() { "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, @@ -977,6 +995,7 @@ func (suite *InternalToFrontendTestSuite) TestWarnFilteredBoostToFrontend() { "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, @@ -1232,6 +1251,7 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontendUnknownAttachments "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, @@ -1395,6 +1415,7 @@ func (suite *InternalToFrontendTestSuite) TestStatusToWebStatus() { "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, @@ -1527,6 +1548,7 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontendUnknownLanguage() "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, @@ -1668,9 +1690,11 @@ func (suite *InternalToFrontendTestSuite) TestStatusToFrontendPartialInteraction "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, @@ -1777,6 +1801,7 @@ func (suite *InternalToFrontendTestSuite) TestStatusToAPIStatusPendingApproval() "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, @@ -1987,6 +2012,7 @@ func (suite *InternalToFrontendTestSuite) TestInstanceV1ToFrontend() { "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, @@ -2127,6 +2153,7 @@ func (suite *InternalToFrontendTestSuite) TestInstanceV2ToFrontend() { "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, @@ -2247,6 +2274,7 @@ func (suite *InternalToFrontendTestSuite) TestReportToFrontend1() { "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, @@ -2290,6 +2318,7 @@ func (suite *InternalToFrontendTestSuite) TestReportToFrontend2() { "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, @@ -2366,6 +2395,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontend1() { "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, @@ -2411,6 +2441,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontend1() { "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, @@ -2469,6 +2500,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontend1() { "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, @@ -2523,6 +2555,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontend1() { "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, @@ -2600,6 +2633,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontend2() { "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, @@ -2658,6 +2692,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontend2() { "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, @@ -2705,6 +2740,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontend2() { "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, @@ -2863,6 +2899,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontendSuspendedLoca "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, @@ -2908,6 +2945,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontendSuspendedLoca "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, @@ -2955,6 +2993,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontendSuspendedLoca "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, @@ -3009,6 +3048,7 @@ func (suite *InternalToFrontendTestSuite) TestAdminReportToFrontendSuspendedLoca "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, @@ -3155,6 +3195,7 @@ func (suite *InternalToFrontendTestSuite) TestIntReqToAPI() { "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, @@ -3210,6 +3251,7 @@ func (suite *InternalToFrontendTestSuite) TestIntReqToAPI() { "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, @@ -3302,6 +3344,7 @@ func (suite *InternalToFrontendTestSuite) TestIntReqToAPI() { "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, @@ -3414,9 +3457,11 @@ func (suite *InternalToFrontendTestSuite) TestConversationToAPISelfConvo() { "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, @@ -3465,9 +3510,11 @@ func (suite *InternalToFrontendTestSuite) TestConversationToAPISelfConvo() { "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, @@ -3569,6 +3616,7 @@ func (suite *InternalToFrontendTestSuite) TestConversationToAPI() { "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, @@ -3628,9 +3676,11 @@ func (suite *InternalToFrontendTestSuite) TestConversationToAPI() { "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/web/source/settings/components/user-logout-card.tsx b/web/source/settings/components/user-logout-card.tsx index f8eeaf63c..f9acc9698 100644 --- a/web/source/settings/components/user-logout-card.tsx +++ b/web/source/settings/components/user-logout-card.tsx @@ -19,6 +19,7 @@ import React from "react"; import Loading from "./loading"; +import { Error as ErrorC } from "./error"; import { useVerifyCredentialsQuery, useLogoutMutation } from "../lib/query/oauth"; import { useInstanceV1Query } from "../lib/query/gts-api"; @@ -29,16 +30,20 @@ export default function UserLogoutCard() { if (isLoading) { return ; - } else { - return ( -
- -

{profile.display_name?.length > 0 ? profile.display_name : profile.acct}

- @{profile.username}@{instance?.account_domain} - -