diff --git a/models/forgejo_migrations/migrate.go b/models/forgejo_migrations/migrate.go index da417cc08c..39c8c8a142 100644 --- a/models/forgejo_migrations/migrate.go +++ b/models/forgejo_migrations/migrate.go @@ -50,6 +50,8 @@ var migrations = []*Migration{ NewMigration("create the forgejo_repo_flag table", forgejo_v1_22.CreateRepoFlagTable), // v5 -> v6 NewMigration("Add wiki_branch to repository", forgejo_v1_22.AddWikiBranchToRepository), + // v6 -> v7 + NewMigration("Add enable_repo_unit_hints to the user table", forgejo_v1_22.AddUserRepoUnitHintsSetting), } // GetCurrentDBVersion returns the current Forgejo database version. diff --git a/models/forgejo_migrations/v1_22/v7.go b/models/forgejo_migrations/v1_22/v7.go new file mode 100644 index 0000000000..9e237d2c06 --- /dev/null +++ b/models/forgejo_migrations/v1_22/v7.go @@ -0,0 +1,17 @@ +// Copyright 2024 The Forgejo Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package v1_22 //nolint + +import ( + "xorm.io/xorm" +) + +func AddUserRepoUnitHintsSetting(x *xorm.Engine) error { + type User struct { + ID int64 + EnableRepoUnitHints bool `xorm:"NOT NULL DEFAULT true"` + } + + return x.Sync(&User{}) +} diff --git a/models/user/user.go b/models/user/user.go index d37463895d..4aef30ca56 100644 --- a/models/user/user.go +++ b/models/user/user.go @@ -146,6 +146,7 @@ type User struct { DiffViewStyle string `xorm:"NOT NULL DEFAULT ''"` Theme string `xorm:"NOT NULL DEFAULT ''"` KeepActivityPrivate bool `xorm:"NOT NULL DEFAULT false"` + EnableRepoUnitHints bool `xorm:"NOT NULL DEFAULT true"` } func init() { diff --git a/modules/structs/user.go b/modules/structs/user.go index 0df67894b0..4e13669ad2 100644 --- a/modules/structs/user.go +++ b/modules/structs/user.go @@ -67,13 +67,14 @@ func (u User) MarshalJSON() ([]byte, error) { // UserSettings represents user settings // swagger:model type UserSettings struct { - FullName string `json:"full_name"` - Website string `json:"website"` - Description string `json:"description"` - Location string `json:"location"` - Language string `json:"language"` - Theme string `json:"theme"` - DiffViewStyle string `json:"diff_view_style"` + FullName string `json:"full_name"` + Website string `json:"website"` + Description string `json:"description"` + Location string `json:"location"` + Language string `json:"language"` + Theme string `json:"theme"` + DiffViewStyle string `json:"diff_view_style"` + EnableRepoUnitHints bool `json:"enable_repo_unit_hints"` // Privacy HideEmail bool `json:"hide_email"` HideActivity bool `json:"hide_activity"` @@ -82,13 +83,14 @@ type UserSettings struct { // UserSettingsOptions represents options to change user settings // swagger:model type UserSettingsOptions struct { - FullName *string `json:"full_name" binding:"MaxSize(100)"` - Website *string `json:"website" binding:"OmitEmpty;ValidUrl;MaxSize(255)"` - Description *string `json:"description" binding:"MaxSize(255)"` - Location *string `json:"location" binding:"MaxSize(50)"` - Language *string `json:"language"` - Theme *string `json:"theme"` - DiffViewStyle *string `json:"diff_view_style"` + FullName *string `json:"full_name" binding:"MaxSize(100)"` + Website *string `json:"website" binding:"OmitEmpty;ValidUrl;MaxSize(255)"` + Description *string `json:"description" binding:"MaxSize(255)"` + Location *string `json:"location" binding:"MaxSize(50)"` + Language *string `json:"language"` + Theme *string `json:"theme"` + DiffViewStyle *string `json:"diff_view_style"` + EnableRepoUnitHints *bool `json:"enable_repo_unit_hints"` // Privacy HideEmail *bool `json:"hide_email"` HideActivity *bool `json:"hide_activity"` diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 940f2ec9f7..79f757ee66 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -711,6 +711,11 @@ continue = Continue cancel = Cancel language = Language ui = Theme +hints = Hints +additional_repo_units_hint_description = Display an "Add more units..." button for repositories that do not have all available units enabled. +additional_repo_units_hint = Encourage enabling additional repository units +update_hints = Update hints +update_hints_success = Hints have been updated. hidden_comment_types = Hidden comment types hidden_comment_types_description = Comment types checked here will not be shown inside issue pages. Checking "Label" for example removes all " added/removed