fix: enable "Add more..." unit hint for new users (#12565)

For new users, the `EnableRepoUnitHints` is set to false while I think that the original intent of #2221 was to set it to true (the migration set it to true for already existing users in `AddUserRepoUnitHintsSetting`).

This PR sets its to true upon user creation.

![screenshot showing the `Add more...` hint - from the original PR](https://codeberg.org/forgejo/forgejo/attachments/dc654ddd-e7cb-4667-b0d3-3fac39776be3)

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/12565
Reviewed-by: limiting-factor <limiting-factor@noreply.codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
This commit is contained in:
oliverpool 2026-05-27 20:44:44 +02:00 committed by 0ko
parent fd283c80b7
commit 68858a9de2
2 changed files with 5 additions and 0 deletions

View file

@ -761,6 +761,7 @@ func createUser(ctx context.Context, u *User, createdByAdmin bool, overwriteDefa
u.Theme = setting.UI.DefaultTheme
u.IsRestricted = setting.Service.DefaultUserIsRestricted
u.IsActive = !setting.Service.RegisterEmailConfirm && !setting.Service.RegisterManualConfirm
u.EnableRepoUnitHints = true
// Ensure consistency of the dates.
if u.UpdatedUnix < u.CreatedUnix {

View file

@ -36,6 +36,10 @@ func TestSignup(t *testing.T) {
// should be able to view new user's page
req = NewRequest(t, "GET", "/exampleUser")
MakeRequest(t, req, http.StatusOK)
// check default values
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{Name: "exampleUser"})
assert.True(t, user.EnableRepoUnitHints)
}
func TestSignupAsRestricted(t *testing.T) {