mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-12-09 14:38:07 -06:00
[Frontend] Settings for profile fields (#1885)
* get max emoji size from instance settings * expose (hardcoded) max amount of profile fields in instance api * basic profile field setting * fix profile field hook structure for updates * *twirls mustache* fix ze tests --------- Co-authored-by: tsmethurst <tobi.smethurst@protonmail.com>
This commit is contained in:
parent
4990099fde
commit
8fb5a7e7f8
15 changed files with 261 additions and 52 deletions
|
|
@ -118,7 +118,8 @@ func (suite *InstancePatchTestSuite) TestInstancePatch1() {
|
|||
},
|
||||
"accounts": {
|
||||
"allow_custom_css": true,
|
||||
"max_featured_tags": 10
|
||||
"max_featured_tags": 10,
|
||||
"max_profile_fields": 6
|
||||
},
|
||||
"emojis": {
|
||||
"emoji_size_limit": 51200
|
||||
|
|
@ -221,7 +222,8 @@ func (suite *InstancePatchTestSuite) TestInstancePatch2() {
|
|||
},
|
||||
"accounts": {
|
||||
"allow_custom_css": true,
|
||||
"max_featured_tags": 10
|
||||
"max_featured_tags": 10,
|
||||
"max_profile_fields": 6
|
||||
},
|
||||
"emojis": {
|
||||
"emoji_size_limit": 51200
|
||||
|
|
@ -324,7 +326,8 @@ func (suite *InstancePatchTestSuite) TestInstancePatch3() {
|
|||
},
|
||||
"accounts": {
|
||||
"allow_custom_css": true,
|
||||
"max_featured_tags": 10
|
||||
"max_featured_tags": 10,
|
||||
"max_profile_fields": 6
|
||||
},
|
||||
"emojis": {
|
||||
"emoji_size_limit": 51200
|
||||
|
|
@ -478,7 +481,8 @@ func (suite *InstancePatchTestSuite) TestInstancePatch6() {
|
|||
},
|
||||
"accounts": {
|
||||
"allow_custom_css": true,
|
||||
"max_featured_tags": 10
|
||||
"max_featured_tags": 10,
|
||||
"max_profile_fields": 6
|
||||
},
|
||||
"emojis": {
|
||||
"emoji_size_limit": 51200
|
||||
|
|
@ -603,7 +607,8 @@ func (suite *InstancePatchTestSuite) TestInstancePatch8() {
|
|||
},
|
||||
"accounts": {
|
||||
"allow_custom_css": true,
|
||||
"max_featured_tags": 10
|
||||
"max_featured_tags": 10,
|
||||
"max_profile_fields": 6
|
||||
},
|
||||
"emojis": {
|
||||
"emoji_size_limit": 51200
|
||||
|
|
@ -743,7 +748,8 @@ func (suite *InstancePatchTestSuite) TestInstancePatch9() {
|
|||
},
|
||||
"accounts": {
|
||||
"allow_custom_css": true,
|
||||
"max_featured_tags": 10
|
||||
"max_featured_tags": 10,
|
||||
"max_profile_fields": 6
|
||||
},
|
||||
"emojis": {
|
||||
"emoji_size_limit": 51200
|
||||
|
|
|
|||
|
|
@ -54,6 +54,9 @@ type InstanceConfigurationAccounts struct {
|
|||
// The maximum number of featured tags allowed for each account.
|
||||
// Currently not implemented, so this is hardcoded to 10.
|
||||
MaxFeaturedTags int `json:"max_featured_tags"`
|
||||
// The maximum number of profile fields allowed for each account.
|
||||
// Currently not configurable, so this is hardcoded to 6. (https://github.com/superseriousbusiness/gotosocial/issues/1876)
|
||||
MaxProfileFields int `json:"max_profile_fields"`
|
||||
}
|
||||
|
||||
// InstanceConfigurationStatuses models instance status config parameters.
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ const (
|
|||
instancePollsMinExpiration = 300 // seconds
|
||||
instancePollsMaxExpiration = 2629746 // seconds
|
||||
instanceAccountsMaxFeaturedTags = 10
|
||||
instanceAccountsMaxProfileFields = 6 // FIXME: https://github.com/superseriousbusiness/gotosocial/issues/1876
|
||||
instanceSourceURL = "https://github.com/superseriousbusiness/gotosocial"
|
||||
)
|
||||
|
||||
|
|
@ -756,6 +757,7 @@ func (c *converter) InstanceToAPIV1Instance(ctx context.Context, i *gtsmodel.Ins
|
|||
instance.Configuration.Polls.MaxExpiration = instancePollsMaxExpiration
|
||||
instance.Configuration.Accounts.AllowCustomCSS = config.GetAccountsAllowCustomCSS()
|
||||
instance.Configuration.Accounts.MaxFeaturedTags = instanceAccountsMaxFeaturedTags
|
||||
instance.Configuration.Accounts.MaxProfileFields = instanceAccountsMaxProfileFields
|
||||
instance.Configuration.Emojis.EmojiSizeLimit = int(config.GetMediaEmojiLocalMaxSize())
|
||||
|
||||
// URLs
|
||||
|
|
@ -882,6 +884,7 @@ func (c *converter) InstanceToAPIV2Instance(ctx context.Context, i *gtsmodel.Ins
|
|||
instance.Configuration.Polls.MaxExpiration = instancePollsMaxExpiration
|
||||
instance.Configuration.Accounts.AllowCustomCSS = config.GetAccountsAllowCustomCSS()
|
||||
instance.Configuration.Accounts.MaxFeaturedTags = instanceAccountsMaxFeaturedTags
|
||||
instance.Configuration.Accounts.MaxProfileFields = instanceAccountsMaxProfileFields
|
||||
instance.Configuration.Emojis.EmojiSizeLimit = int(config.GetMediaEmojiLocalMaxSize())
|
||||
|
||||
// registrations
|
||||
|
|
|
|||
|
|
@ -647,7 +647,8 @@ func (suite *InternalToFrontendTestSuite) TestInstanceV1ToFrontend() {
|
|||
},
|
||||
"accounts": {
|
||||
"allow_custom_css": true,
|
||||
"max_featured_tags": 10
|
||||
"max_featured_tags": 10,
|
||||
"max_profile_fields": 6
|
||||
},
|
||||
"emojis": {
|
||||
"emoji_size_limit": 51200
|
||||
|
|
@ -730,7 +731,8 @@ func (suite *InternalToFrontendTestSuite) TestInstanceV2ToFrontend() {
|
|||
},
|
||||
"accounts": {
|
||||
"allow_custom_css": true,
|
||||
"max_featured_tags": 10
|
||||
"max_featured_tags": 10,
|
||||
"max_profile_fields": 6
|
||||
},
|
||||
"statuses": {
|
||||
"max_characters": 5000,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue