diff options
author | 2024-04-02 11:42:24 +0200 | |
---|---|---|
committer | 2024-04-02 10:42:24 +0100 | |
commit | f05874be3095d3fb3cefd1a92b3c35fe3ae3bf28 (patch) | |
tree | 52f1616259b51d0a8a94a786278b9c0aa5ab2298 /internal/api | |
parent | [feature] Add `enable` command to mirror existing `disable` command; update d... (diff) | |
download | gotosocial-f05874be3095d3fb3cefd1a92b3c35fe3ae3bf28.tar.xz |
[feature] Option to hide followers/following (#2788)
Diffstat (limited to 'internal/api')
-rw-r--r-- | internal/api/client/accounts/accountupdate.go | 16 | ||||
-rw-r--r-- | internal/api/client/accounts/followers.go | 2 | ||||
-rw-r--r-- | internal/api/client/accounts/following.go | 2 | ||||
-rw-r--r-- | internal/api/client/admin/reportsget_test.go | 4 | ||||
-rw-r--r-- | internal/api/model/account.go | 10 |
5 files changed, 31 insertions, 3 deletions
diff --git a/internal/api/client/accounts/accountupdate.go b/internal/api/client/accounts/accountupdate.go index 905d11479..cd8ee35f4 100644 --- a/internal/api/client/accounts/accountupdate.go +++ b/internal/api/client/accounts/accountupdate.go @@ -108,6 +108,14 @@ import ( // description: Default content type to use for authored statuses (text/plain or text/markdown). // type: string // - +// name: theme +// in: formData +// description: >- +// FileName of the theme to use when rendering this account's profile or statuses. +// The theme must exist on this server, as indicated by /api/v1/accounts/themes. +// Empty string unsets theme and returns to the default GoToSocial theme. +// type: string +// - // name: custom_css // in: formData // description: >- @@ -120,6 +128,11 @@ import ( // description: Enable RSS feed for this account's Public posts at `/[username]/feed.rss` // type: boolean // - +// name: hide_collections +// in: formData +// description: Hide the account's following/followers collections. +// type: boolean +// - // name: fields_attributes[0][name] // in: formData // description: Name of 1st profile field to be added to this account's profile. @@ -311,7 +324,8 @@ func parseUpdateAccountForm(c *gin.Context) (*apimodel.UpdateCredentialsRequest, form.FieldsAttributes == nil && form.Theme == nil && form.CustomCSS == nil && - form.EnableRSS == nil) { + form.EnableRSS == nil && + form.HideCollections == nil) { return nil, errors.New("empty form submitted") } diff --git a/internal/api/client/accounts/followers.go b/internal/api/client/accounts/followers.go index d54fd6084..332788c3a 100644 --- a/internal/api/client/accounts/followers.go +++ b/internal/api/client/accounts/followers.go @@ -39,6 +39,8 @@ import ( // <https://example.org/api/v1/accounts/0657WMDEC3KQDTD6NZ4XJZBK4M/followers?limit=80&max_id=01FC0SKA48HNSVR6YKZCQGS2V8>; rel="next", <https://example.org/api/v1/accounts/0657WMDEC3KQDTD6NZ4XJZBK4M/followers?limit=80&min_id=01FC0SKW5JK2Q4EVAV2B462YY0>; rel="prev" // ```` // +// If account `hide_collections` is true, and requesting account != target account, no results will be returned. +// // --- // tags: // - accounts diff --git a/internal/api/client/accounts/following.go b/internal/api/client/accounts/following.go index 1503eddbf..bdd9ff3de 100644 --- a/internal/api/client/accounts/following.go +++ b/internal/api/client/accounts/following.go @@ -39,6 +39,8 @@ import ( // <https://example.org/api/v1/accounts/0657WMDEC3KQDTD6NZ4XJZBK4M/following?limit=80&max_id=01FC0SKA48HNSVR6YKZCQGS2V8>; rel="next", <https://example.org/api/v1/accounts/0657WMDEC3KQDTD6NZ4XJZBK4M/following?limit=80&min_id=01FC0SKW5JK2Q4EVAV2B462YY0>; rel="prev" // ```` // +// If account `hide_collections` is true, and requesting account != target account, no results will be returned. +// // --- // tags: // - accounts diff --git a/internal/api/client/admin/reportsget_test.go b/internal/api/client/admin/reportsget_test.go index 18f10e489..f2b6ff62a 100644 --- a/internal/api/client/admin/reportsget_test.go +++ b/internal/api/client/admin/reportsget_test.go @@ -236,6 +236,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() { "verified_at": null } ], + "hide_collections": true, "role": { "name": "user" } @@ -397,6 +398,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetAll() { "verified_at": null } ], + "hide_collections": true, "role": { "name": "user" } @@ -618,6 +620,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetCreatedByAccount() { "verified_at": null } ], + "hide_collections": true, "role": { "name": "user" } @@ -839,6 +842,7 @@ func (suite *ReportsGetTestSuite) TestReportsGetTargetAccount() { "verified_at": null } ], + "hide_collections": true, "role": { "name": "user" } diff --git a/internal/api/model/account.go b/internal/api/model/account.go index af2a394af..de850637e 100644 --- a/internal/api/model/account.go +++ b/internal/api/model/account.go @@ -94,12 +94,16 @@ type Account struct { // CustomCSS to include when rendering this account's profile or statuses. CustomCSS string `json:"custom_css,omitempty"` // Account has enabled RSS feed. + // Key/value omitted if false. EnableRSS bool `json:"enable_rss,omitempty"` + // Account has opted to hide their followers/following collections. + // Key/value omitted if false. + HideCollections bool `json:"hide_collections,omitempty"` // Role of the account on this instance. - // Omitted for remote accounts. + // Key/value omitted for remote accounts. Role *AccountRole `json:"role,omitempty"` // If set, indicates that this account is currently inactive, and has migrated to the given account. - // Omitted for accounts that haven't moved, and for suspended accounts. + // Key/value omitted for accounts that haven't moved, and for suspended accounts. Moved *Account `json:"moved,omitempty"` } @@ -172,6 +176,8 @@ type UpdateCredentialsRequest struct { CustomCSS *string `form:"custom_css" json:"custom_css"` // Enable RSS feed of public toots for this account at /@[username]/feed.rss EnableRSS *bool `form:"enable_rss" json:"enable_rss"` + // Hide this account's following/followers collections. + HideCollections *bool `form:"hide_collections" json:"hide_collections"` } // UpdateSource is to be used specifically in an UpdateCredentialsRequest. |