summaryrefslogtreecommitdiff
path: root/internal/api/client
diff options
context:
space:
mode:
Diffstat (limited to 'internal/api/client')
-rw-r--r--internal/api/client/accounts/accountupdate.go11
-rw-r--r--internal/api/client/accounts/search_test.go8
-rw-r--r--internal/api/client/admin/accountsgetv2_test.go127
-rw-r--r--internal/api/client/instance/instancepatch_test.go24
-rw-r--r--internal/api/client/search/searchget_test.go4
5 files changed, 131 insertions, 43 deletions
diff --git a/internal/api/client/accounts/accountupdate.go b/internal/api/client/accounts/accountupdate.go
index 617031d79..50e6632f4 100644
--- a/internal/api/client/accounts/accountupdate.go
+++ b/internal/api/client/accounts/accountupdate.go
@@ -153,6 +153,14 @@ import (
// "none": show no posts on the web, not even Public ones.
// type: string
// -
+// name: web_layout
+// in: formData
+// description: |-
+// Layout to use for the web view of the account.
+// "microblog": default, classic microblog layout.
+// "gallery": gallery layout with media only.
+// type: string
+// -
// name: fields_attributes[0][name]
// in: formData
// description: Name of 1st profile field to be added to this account's profile.
@@ -351,7 +359,8 @@ func parseUpdateAccountForm(c *gin.Context) (*apimodel.UpdateCredentialsRequest,
form.CustomCSS == nil &&
form.EnableRSS == nil &&
form.HideCollections == nil &&
- form.WebVisibility == nil) {
+ form.WebVisibility == nil &&
+ form.WebLayout == nil) {
return nil, errors.New("empty form submitted")
}
diff --git a/internal/api/client/accounts/search_test.go b/internal/api/client/accounts/search_test.go
index 119900331..f5216d5b9 100644
--- a/internal/api/client/accounts/search_test.go
+++ b/internal/api/client/accounts/search_test.go
@@ -369,16 +369,16 @@ func (suite *AccountSearchTestSuite) TestSearchAFollowing() {
suite.FailNow(err.Error())
}
- if l := len(accounts); l != 5 {
- suite.FailNow("", "expected length %d got %d", 5, l)
+ if l := len(accounts); l != 6 {
+ suite.FailNow("", "expected length %d got %d", 6, l)
}
- usernames := make([]string, 0, 5)
+ usernames := make([]string, 0, 6)
for _, account := range accounts {
usernames = append(usernames, account.Username)
}
- suite.EqualValues([]string{"her_fuckin_maj", "foss_satan", "1happyturtle", "the_mighty_zork", "admin"}, usernames)
+ suite.EqualValues([]string{"her_fuckin_maj", "media_mogul", "foss_satan", "1happyturtle", "the_mighty_zork", "admin"}, usernames)
}
func (suite *AccountSearchTestSuite) TestSearchANotFollowing() {
diff --git a/internal/api/client/admin/accountsgetv2_test.go b/internal/api/client/admin/accountsgetv2_test.go
index 0e3eb95e1..339c97431 100644
--- a/internal/api/client/admin/accountsgetv2_test.go
+++ b/internal/api/client/admin/accountsgetv2_test.go
@@ -223,6 +223,69 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() {
}
},
{
+ "id": "01JPCMD83Y4WR901094YES3QC5",
+ "username": "media_mogul",
+ "domain": null,
+ "created_at": "2025-03-15T11:08:00.000Z",
+ "email": "media.mogul@example.org",
+ "ip": null,
+ "ips": [],
+ "locale": "en",
+ "invite_request": null,
+ "role": {
+ "id": "user",
+ "name": "user",
+ "color": "",
+ "permissions": "0",
+ "highlighted": false
+ },
+ "confirmed": true,
+ "approved": true,
+ "disabled": false,
+ "silenced": false,
+ "suspended": false,
+ "account": {
+ "id": "01JPCMD83Y4WR901094YES3QC5",
+ "username": "media_mogul",
+ "acct": "media_mogul",
+ "display_name": "",
+ "locked": false,
+ "discoverable": false,
+ "bot": false,
+ "created_at": "2025-03-15T11:08:00.000Z",
+ "note": "<p>I'm a test account that posts a shitload of media and I have my account rendered in \"gallery\" mode</p>",
+ "url": "http://localhost:8080/@media_mogul",
+ "avatar": "http://localhost:8080/fileserver/01JPCMD83Y4WR901094YES3QC5/avatar/original/01JPHQZ0ZHC2AXJK1JQNXRXQZN.jpeg",
+ "avatar_static": "http://localhost:8080/fileserver/01JPCMD83Y4WR901094YES3QC5/avatar/small/01JPHQZ0ZHC2AXJK1JQNXRXQZN.jpeg",
+ "avatar_description": "DESCRIPTION_GOES_HERE",
+ "avatar_media_id": "01JPHQZ0ZHC2AXJK1JQNXRXQZN",
+ "header": "http://localhost:8080/fileserver/01JPCMD83Y4WR901094YES3QC5/header/original/01JPHRB7F2RXPTEQFRYC85EPD9.png",
+ "header_static": "http://localhost:8080/fileserver/01JPCMD83Y4WR901094YES3QC5/header/small/01JPHRB7F2RXPTEQFRYC85EPD9.webp",
+ "header_description": "DESCRIPTION_GOES_HERE",
+ "header_media_id": "01JPHRB7F2RXPTEQFRYC85EPD9",
+ "followers_count": 0,
+ "following_count": 0,
+ "statuses_count": 2,
+ "last_status_at": "2025-03-15",
+ "emojis": [],
+ "fields": [
+ {
+ "name": "I'm going to post a lot of",
+ "value": "media!",
+ "verified_at": null
+ },
+ {
+ "name": "and there's nothing",
+ "value": "you can do about it",
+ "verified_at": null
+ }
+ ],
+ "enable_rss": true,
+ "group": false
+ },
+ "created_by_application_id": "01HT5P2YHDMPAAD500NDAY8JW1"
+ },
+ {
"id": "01F8MH1H7YV1Z7D2C8K2730QBF",
"username": "the_mighty_zork",
"domain": null,
@@ -547,18 +610,18 @@ func (suite *AccountsGetTestSuite) TestAccountsMinID() {
}
link := recorder.Header().Get("Link")
- suite.Equal(`<http://localhost:8080/api/v2/admin/accounts?limit=1&max_id=%2F%40localhost%3A8080>; rel="next", <http://localhost:8080/api/v2/admin/accounts?limit=1&min_id=%2F%40localhost%3A8080>; rel="prev"`, link)
+ suite.Equal(`<http://localhost:8080/api/v2/admin/accounts?limit=1&max_id=%2F%40media_mogul>; rel="next", <http://localhost:8080/api/v2/admin/accounts?limit=1&min_id=%2F%40media_mogul>; rel="prev"`, link)
suite.Equal(`[
{
- "id": "01AY6P665V14JJR0AFVRT7311Y",
- "username": "localhost:8080",
+ "id": "01JPCMD83Y4WR901094YES3QC5",
+ "username": "media_mogul",
"domain": null,
- "created_at": "2020-05-17T13:10:59.000Z",
- "email": "",
+ "created_at": "2025-03-15T11:08:00.000Z",
+ "email": "media.mogul@example.org",
"ip": null,
"ips": [],
- "locale": "",
+ "locale": "en",
"invite_request": null,
"role": {
"id": "user",
@@ -567,35 +630,51 @@ func (suite *AccountsGetTestSuite) TestAccountsMinID() {
"permissions": "0",
"highlighted": false
},
- "confirmed": false,
- "approved": false,
+ "confirmed": true,
+ "approved": true,
"disabled": false,
"silenced": false,
"suspended": false,
"account": {
- "id": "01AY6P665V14JJR0AFVRT7311Y",
- "username": "localhost:8080",
- "acct": "localhost:8080",
+ "id": "01JPCMD83Y4WR901094YES3QC5",
+ "username": "media_mogul",
+ "acct": "media_mogul",
"display_name": "",
"locked": false,
- "discoverable": true,
+ "discoverable": false,
"bot": false,
- "created_at": "2020-05-17T13:10:59.000Z",
- "note": "",
- "url": "http://localhost:8080/@localhost:8080",
- "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).",
+ "created_at": "2025-03-15T11:08:00.000Z",
+ "note": "<p>I'm a test account that posts a shitload of media and I have my account rendered in \"gallery\" mode</p>",
+ "url": "http://localhost:8080/@media_mogul",
+ "avatar": "http://localhost:8080/fileserver/01JPCMD83Y4WR901094YES3QC5/avatar/original/01JPHQZ0ZHC2AXJK1JQNXRXQZN.jpeg",
+ "avatar_static": "http://localhost:8080/fileserver/01JPCMD83Y4WR901094YES3QC5/avatar/small/01JPHQZ0ZHC2AXJK1JQNXRXQZN.jpeg",
+ "avatar_description": "DESCRIPTION_GOES_HERE",
+ "avatar_media_id": "01JPHQZ0ZHC2AXJK1JQNXRXQZN",
+ "header": "http://localhost:8080/fileserver/01JPCMD83Y4WR901094YES3QC5/header/original/01JPHRB7F2RXPTEQFRYC85EPD9.png",
+ "header_static": "http://localhost:8080/fileserver/01JPCMD83Y4WR901094YES3QC5/header/small/01JPHRB7F2RXPTEQFRYC85EPD9.webp",
+ "header_description": "DESCRIPTION_GOES_HERE",
+ "header_media_id": "01JPHRB7F2RXPTEQFRYC85EPD9",
"followers_count": 0,
"following_count": 0,
- "statuses_count": 0,
- "last_status_at": null,
+ "statuses_count": 2,
+ "last_status_at": "2025-03-15",
"emojis": [],
- "fields": [],
+ "fields": [
+ {
+ "name": "I'm going to post a lot of",
+ "value": "media!",
+ "verified_at": null
+ },
+ {
+ "name": "and there's nothing",
+ "value": "you can do about it",
+ "verified_at": null
+ }
+ ],
+ "enable_rss": true,
"group": false
- }
+ },
+ "created_by_application_id": "01HT5P2YHDMPAAD500NDAY8JW1"
}
]`, dst.String())
}
diff --git a/internal/api/client/instance/instancepatch_test.go b/internal/api/client/instance/instancepatch_test.go
index a63ca9e11..b0ce795f0 100644
--- a/internal/api/client/instance/instancepatch_test.go
+++ b/internal/api/client/instance/instancepatch_test.go
@@ -158,8 +158,8 @@ func (suite *InstancePatchTestSuite) TestInstancePatch1() {
},
"stats": {
"domain_count": 2,
- "status_count": 21,
- "user_count": 4
+ "status_count": 23,
+ "user_count": 5
},
"thumbnail": "http://localhost:8080/assets/logo.webp",
"contact_account": {
@@ -301,8 +301,8 @@ func (suite *InstancePatchTestSuite) TestInstancePatch2() {
},
"stats": {
"domain_count": 2,
- "status_count": 21,
- "user_count": 4
+ "status_count": 23,
+ "user_count": 5
},
"thumbnail": "http://localhost:8080/assets/logo.webp",
"contact_account": {
@@ -444,8 +444,8 @@ func (suite *InstancePatchTestSuite) TestInstancePatch3() {
},
"stats": {
"domain_count": 2,
- "status_count": 21,
- "user_count": 4
+ "status_count": 23,
+ "user_count": 5
},
"thumbnail": "http://localhost:8080/assets/logo.webp",
"contact_account": {
@@ -638,8 +638,8 @@ func (suite *InstancePatchTestSuite) TestInstancePatch6() {
},
"stats": {
"domain_count": 2,
- "status_count": 21,
- "user_count": 4
+ "status_count": 23,
+ "user_count": 5
},
"thumbnail": "http://localhost:8080/assets/logo.webp",
"contact_account": {
@@ -803,8 +803,8 @@ func (suite *InstancePatchTestSuite) TestInstancePatch8() {
},
"stats": {
"domain_count": 2,
- "status_count": 21,
- "user_count": 4
+ "status_count": 23,
+ "user_count": 5
},
"thumbnail": "http://localhost:8080/fileserver/01AY6P665V14JJR0AFVRT7311Y/attachment/original/`+instanceAccount.AvatarMediaAttachment.ID+`.gif",`+`
"thumbnail_type": "image/gif",
@@ -987,8 +987,8 @@ func (suite *InstancePatchTestSuite) TestInstancePatch9() {
},
"stats": {
"domain_count": 2,
- "status_count": 21,
- "user_count": 4
+ "status_count": 23,
+ "user_count": 5
},
"thumbnail": "http://localhost:8080/assets/logo.webp",
"contact_account": {
diff --git a/internal/api/client/search/searchget_test.go b/internal/api/client/search/searchget_test.go
index 318010387..53f0a993c 100644
--- a/internal/api/client/search/searchget_test.go
+++ b/internal/api/client/search/searchget_test.go
@@ -915,7 +915,7 @@ func (suite *SearchGetTestSuite) TestSearchAAny() {
suite.FailNow(err.Error())
}
- suite.Len(searchResult.Accounts, 5)
+ suite.Len(searchResult.Accounts, 6)
suite.Len(searchResult.Statuses, 9)
suite.Len(searchResult.Hashtags, 0)
}
@@ -1130,7 +1130,7 @@ func (suite *SearchGetTestSuite) TestSearchAAccounts() {
suite.FailNow(err.Error())
}
- suite.Len(searchResult.Accounts, 5)
+ suite.Len(searchResult.Accounts, 6)
suite.Len(searchResult.Statuses, 0)
suite.Len(searchResult.Hashtags, 0)
}