summaryrefslogtreecommitdiff
path: root/internal/api
diff options
context:
space:
mode:
Diffstat (limited to 'internal/api')
-rw-r--r--internal/api/client/accounts/accountupdate.go14
-rw-r--r--internal/api/client/admin/accountsgetv2_test.go3
-rw-r--r--internal/api/client/statuses/statushistory_test.go2
-rw-r--r--internal/api/client/statuses/statusmute_test.go4
-rw-r--r--internal/api/model/account.go21
5 files changed, 44 insertions, 0 deletions
diff --git a/internal/api/client/accounts/accountupdate.go b/internal/api/client/accounts/accountupdate.go
index cd8ee35f4..f81f54db0 100644
--- a/internal/api/client/accounts/accountupdate.go
+++ b/internal/api/client/accounts/accountupdate.go
@@ -78,11 +78,23 @@ import (
// description: Avatar of the user.
// type: file
// -
+// name: avatar_description
+// in: formData
+// description: Description of avatar image, for alt-text.
+// type: string
+// allowEmptyValue: true
+// -
// name: header
// in: formData
// description: Header of the user.
// type: file
// -
+// name: header_description
+// in: formData
+// description: Description of header image, for alt-text.
+// type: string
+// allowEmptyValue: true
+// -
// name: locked
// in: formData
// description: Require manual approval of follow requests.
@@ -315,7 +327,9 @@ func parseUpdateAccountForm(c *gin.Context) (*apimodel.UpdateCredentialsRequest,
form.DisplayName == nil &&
form.Note == nil &&
form.Avatar == nil &&
+ form.AvatarDescription == nil &&
form.Header == nil &&
+ form.HeaderDescription == nil &&
form.Locked == nil &&
form.Source.Privacy == nil &&
form.Source.Sensitive == nil &&
diff --git a/internal/api/client/admin/accountsgetv2_test.go b/internal/api/client/admin/accountsgetv2_test.go
index fdd6c6c30..85d58cce8 100644
--- a/internal/api/client/admin/accountsgetv2_test.go
+++ b/internal/api/client/admin/accountsgetv2_test.go
@@ -234,8 +234,10 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() {
"url": "http://localhost:8080/@the_mighty_zork",
"avatar": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/original/01F8MH58A357CV5K7R7TJMSH6S.jpg",
"avatar_static": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/small/01F8MH58A357CV5K7R7TJMSH6S.jpg",
+ "avatar_description": "a green goblin looking nasty",
"header": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/original/01PFPMWK2FF0D9WMHEJHR07C3Q.jpg",
"header_static": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/small/01PFPMWK2FF0D9WMHEJHR07C3Q.jpg",
+ "header_description": "A very old-school screenshot of the original team fortress mod for quake",
"followers_count": 2,
"following_count": 2,
"statuses_count": 7,
@@ -409,6 +411,7 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() {
"avatar_static": "",
"header": "http://localhost:8080/fileserver/062G5WYKY35KKD12EMSM3F8PJ8/header/original/01PFPMWK2FF0D9WMHEJHR07C3R.jpg",
"header_static": "http://localhost:8080/fileserver/062G5WYKY35KKD12EMSM3F8PJ8/header/small/01PFPMWK2FF0D9WMHEJHR07C3R.jpg",
+ "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",
"followers_count": 0,
"following_count": 0,
"statuses_count": 0,
diff --git a/internal/api/client/statuses/statushistory_test.go b/internal/api/client/statuses/statushistory_test.go
index a0cb3d482..a88abdb8f 100644
--- a/internal/api/client/statuses/statushistory_test.go
+++ b/internal/api/client/statuses/statushistory_test.go
@@ -108,8 +108,10 @@ func (suite *StatusHistoryTestSuite) TestGetHistory() {
"url": "http://localhost:8080/@the_mighty_zork",
"avatar": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/original/01F8MH58A357CV5K7R7TJMSH6S.jpg",
"avatar_static": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/small/01F8MH58A357CV5K7R7TJMSH6S.jpg",
+ "avatar_description": "a green goblin looking nasty",
"header": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/original/01PFPMWK2FF0D9WMHEJHR07C3Q.jpg",
"header_static": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/small/01PFPMWK2FF0D9WMHEJHR07C3Q.jpg",
+ "header_description": "A very old-school screenshot of the original team fortress mod for quake",
"followers_count": 2,
"following_count": 2,
"statuses_count": 7,
diff --git a/internal/api/client/statuses/statusmute_test.go b/internal/api/client/statuses/statusmute_test.go
index a83720a20..83effd0c2 100644
--- a/internal/api/client/statuses/statusmute_test.go
+++ b/internal/api/client/statuses/statusmute_test.go
@@ -126,8 +126,10 @@ func (suite *StatusMuteTestSuite) TestMuteUnmuteStatus() {
"url": "http://localhost:8080/@the_mighty_zork",
"avatar": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/original/01F8MH58A357CV5K7R7TJMSH6S.jpg",
"avatar_static": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/small/01F8MH58A357CV5K7R7TJMSH6S.jpg",
+ "avatar_description": "a green goblin looking nasty",
"header": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/original/01PFPMWK2FF0D9WMHEJHR07C3Q.jpg",
"header_static": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/small/01PFPMWK2FF0D9WMHEJHR07C3Q.jpg",
+ "header_description": "A very old-school screenshot of the original team fortress mod for quake",
"followers_count": 2,
"following_count": 2,
"statuses_count": 7,
@@ -189,8 +191,10 @@ func (suite *StatusMuteTestSuite) TestMuteUnmuteStatus() {
"url": "http://localhost:8080/@the_mighty_zork",
"avatar": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/original/01F8MH58A357CV5K7R7TJMSH6S.jpg",
"avatar_static": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/avatar/small/01F8MH58A357CV5K7R7TJMSH6S.jpg",
+ "avatar_description": "a green goblin looking nasty",
"header": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/original/01PFPMWK2FF0D9WMHEJHR07C3Q.jpg",
"header_static": "http://localhost:8080/fileserver/01F8MH1H7YV1Z7D2C8K2730QBF/header/small/01PFPMWK2FF0D9WMHEJHR07C3Q.jpg",
+ "header_description": "A very old-school screenshot of the original team fortress mod for quake",
"followers_count": 2,
"following_count": 2,
"statuses_count": 7,
diff --git a/internal/api/model/account.go b/internal/api/model/account.go
index b3a92d36f..cf39dd08e 100644
--- a/internal/api/model/account.go
+++ b/internal/api/model/account.go
@@ -62,6 +62,9 @@ type Account struct {
// Only relevant when the account's main avatar is a video or a gif.
// example: https://example.org/media/some_user/avatar/static/avatar.png
AvatarStatic string `json:"avatar_static"`
+ // Description of this account's avatar, for alt text.
+ // example: A cute drawing of a smiling sloth.
+ AvatarDescription string `json:"avatar_description,omitempty"`
// Web location of the account's header image.
// example: https://example.org/media/some_user/header/original/header.jpeg
Header string `json:"header"`
@@ -69,6 +72,9 @@ type Account struct {
// Only relevant when the account's main header is a video or a gif.
// example: https://example.org/media/some_user/header/static/header.png
HeaderStatic string `json:"header_static"`
+ // Description of this account's header, for alt text.
+ // example: A sunlit field with purple flowers.
+ HeaderDescription string `json:"header_description,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.
@@ -104,6 +110,17 @@ type Account struct {
// If set, indicates that this account is currently inactive, and has migrated to the given account.
// Key/value omitted for accounts that haven't moved, and for suspended accounts.
Moved *Account `json:"moved,omitempty"`
+
+ // Additional fields not exposed via JSON
+ // (used only internally for templating etc).
+
+ // Proper attachment model for the avatar.
+ //
+ // Only set if this model was converted via
+ // AccountToWebAccount, AND this account had
+ // an avatar set (and not just the default
+ // "blank" avatar image.)
+ AvatarAttachment *Attachment `json:"-"`
}
// MutedAccount extends Account with a field used only by the muted user list.
@@ -168,8 +185,12 @@ type UpdateCredentialsRequest struct {
Note *string `form:"note" json:"note"`
// Avatar image encoded using multipart/form-data.
Avatar *multipart.FileHeader `form:"avatar" json:"-"`
+ // Description of the avatar image, for alt-text.
+ AvatarDescription *string `form:"avatar_description" json:"avatar_description"`
// Header image encoded using multipart/form-data
Header *multipart.FileHeader `form:"header" json:"-"`
+ // Description of the header image, for alt-text.
+ HeaderDescription *string `form:"header_description" json:"header_description"`
// Require manual approval of follow requests.
Locked *bool `form:"locked" json:"locked"`
// New Source values for this account.