mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 15:02:25 -05:00
[feature] Allow user to choose "gallery" style layout for web view of profile (#3917)
* [feature] Allow user to choose "gallery" style web layout * find a bug and squish it up and all day long you'll have good luck * just a sec * [performance] reindex public timeline + tinker with query a bit * fiddling * should be good now * last bit of finagling, i'm done now i prommy * panic normally
This commit is contained in:
parent
f46e490c30
commit
b6e481d63e
82 changed files with 2921 additions and 1171 deletions
|
|
@ -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")
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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() {
|
||||
|
|
|
|||
|
|
@ -222,6 +222,69 @@ func (suite *AccountsGetTestSuite) TestAccountsGetFromTop() {
|
|||
"group": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"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",
|
||||
|
|
@ -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())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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": {
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -149,6 +149,9 @@ type WebAccount struct {
|
|||
// Only set if this account had a header set
|
||||
// (and not just the default "blank" image.)
|
||||
HeaderAttachment *WebAttachment `json:"-"`
|
||||
|
||||
// Layout for this account (microblog, gallery).
|
||||
WebLayout string `json:"-"`
|
||||
}
|
||||
|
||||
// MutedAccount extends Account with a field used only by the muted user list.
|
||||
|
|
@ -240,6 +243,10 @@ type UpdateCredentialsRequest struct {
|
|||
// Visibility of statuses to show via the web view.
|
||||
// "none", "public" (default), or "unlisted" (which includes public as well).
|
||||
WebVisibility *string `form:"web_visibility" json:"web_visibility"`
|
||||
// Layout to use for the web view of the account.
|
||||
// "microblog": default, classic microblog layout.
|
||||
// "gallery": gallery layout with media only.
|
||||
WebLayout *string `form:"web_layout" json:"web_layout"`
|
||||
}
|
||||
|
||||
// UpdateSource is to be used specifically in an UpdateCredentialsRequest.
|
||||
|
|
|
|||
|
|
@ -136,6 +136,10 @@ type WebAttachment struct {
|
|||
// MIME type of
|
||||
// the thumbnail.
|
||||
PreviewMIMEType string
|
||||
|
||||
// Link to the URL of the parent
|
||||
// status of this attachment.
|
||||
ParentStatusLink string
|
||||
}
|
||||
|
||||
// MediaMeta models media metadata.
|
||||
|
|
|
|||
|
|
@ -31,6 +31,10 @@ type Source struct {
|
|||
// "unlisted" = show Public *and* Unlisted visibility posts on the web.
|
||||
// "none" = show no posts on the web, not even Public ones.
|
||||
WebVisibility Visibility `json:"web_visibility"`
|
||||
// Layout to use for the web view of the account.
|
||||
// "microblog": default, classic microblog layout.
|
||||
// "gallery": gallery layout with media only.
|
||||
WebLayout string `json:"web_layout"`
|
||||
// Whether new statuses should be marked sensitive by default.
|
||||
Sensitive bool `json:"sensitive"`
|
||||
// The default posting language for new statuses.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue