diff --git a/go.mod b/go.mod index 1602f1ef19..70db6ef875 100644 --- a/go.mod +++ b/go.mod @@ -42,7 +42,7 @@ require ( github.com/go-ap/activitypub v0.0.0-20231114162308-e219254dc5c9 github.com/go-ap/jsonld v0.0.0-20221030091449-f2a191312c73 github.com/go-chi/chi/v5 v5.2.2 - github.com/go-chi/cors v1.2.2 + github.com/go-chi/cors v1.2.1 github.com/go-co-op/gocron v1.37.0 github.com/go-enry/go-enry/v2 v2.9.2 github.com/go-git/go-git/v5 v5.13.2 diff --git a/go.sum b/go.sum index 1aa2380161..e9cf6413cd 100644 --- a/go.sum +++ b/go.sum @@ -215,8 +215,8 @@ github.com/go-asn1-ber/asn1-ber v1.5.5/go.mod h1:hEBeB/ic+5LoWskz+yKT7vGhhPYkPro github.com/go-chi/chi/v5 v5.0.1/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-chi/chi/v5 v5.2.2 h1:CMwsvRVTbXVytCk1Wd72Zy1LAsAh9GxMmSNWLHCG618= github.com/go-chi/chi/v5 v5.2.2/go.mod h1:L2yAIGWB3H+phAw1NxKwWM+7eUH/lU8pOMm5hHcoops= -github.com/go-chi/cors v1.2.2 h1:Jmey33TE+b+rB7fT8MUy1u0I4L+NARQlK6LhzKPSyQE= -github.com/go-chi/cors v1.2.2/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58= +github.com/go-chi/cors v1.2.1 h1:xEC8UT3Rlp2QuWNEr4Fs/c2EAGVKBwy/1vHx3bppil4= +github.com/go-chi/cors v1.2.1/go.mod h1:sSbTewc+6wYHBBCW7ytsFSn836hqM7JxpglAy2Vzc58= github.com/go-co-op/gocron v1.37.0 h1:ZYDJGtQ4OMhTLKOKMIch+/CY70Brbb1dGdooLEhh7b0= github.com/go-co-op/gocron v1.37.0/go.mod h1:3L/n6BkO7ABj+TrfSVXLRzsP26zmikL4ISkLQ0O8iNY= github.com/go-enry/go-enry/v2 v2.9.2 h1:giOQAtCgBX08kosrX818DCQJTCNtKwoPBGu0qb6nKTY= diff --git a/models/fixtures/TestActivateUserEmail/email_address.yml b/models/fixtures/TestActivateUserEmail/email_address.yml deleted file mode 100644 index cf41ff8241..0000000000 --- a/models/fixtures/TestActivateUserEmail/email_address.yml +++ /dev/null @@ -1,7 +0,0 @@ -- - id: 1001 - uid: 1001 - email: AnotherTestUserWithUpperCaseEmail@otto.splvs.net - lower_email: anothertestuserwithuppercaseemail@otto.splvs.net - is_activated: false - is_primary: true diff --git a/models/fixtures/TestActivateUserEmail/user.yml b/models/fixtures/TestActivateUserEmail/user.yml deleted file mode 100644 index 0a68e70a4a..0000000000 --- a/models/fixtures/TestActivateUserEmail/user.yml +++ /dev/null @@ -1,12 +0,0 @@ -- - id: 1001 - lower_name: user1001 - name: user1001 - full_name: User That loves Upper Cases - email: AnotherTestUserWithUpperCaseEmail@otto.splvs.net - passwd: ZogKvWdyEx:password - passwd_hash_algo: dummy - avatar: '' - avatar_email: anothertestuserwithuppercaseemail@otto.splvs.net - login_name: user1 - created_unix: 1672578000 diff --git a/models/user/email_address_test.go b/models/user/email_address_test.go index 85f5b16c65..1801f57a23 100644 --- a/models/user/email_address_test.go +++ b/models/user/email_address_test.go @@ -181,20 +181,3 @@ func TestDeletePrimaryEmailAddressOfUser(t *testing.T) { assert.True(t, user_model.IsErrEmailAddressNotExist(err)) assert.Nil(t, email) } - -func TestActivateUserEmail(t *testing.T) { - defer unittest.OverrideFixtures("models/fixtures/TestActivateUserEmail")() - require.NoError(t, unittest.PrepareTestDatabase()) - - t.Run("Activate email", func(t *testing.T) { - require.NoError(t, user_model.ActivateUserEmail(t.Context(), 1001, "AnotherTestUserWithUpperCaseEmail@otto.splvs.net", true)) - - unittest.AssertExistsAndLoadBean(t, &user_model.EmailAddress{UID: 1001}, "is_activated = true") - }) - - t.Run("Deactivate email", func(t *testing.T) { - require.NoError(t, user_model.ActivateUserEmail(t.Context(), 1001, "AnotherTestUserWithUpperCaseEmail@otto.splvs.net", false)) - - unittest.AssertExistsAndLoadBean(t, &user_model.EmailAddress{UID: 1001}, "is_activated = false") - }) -} diff --git a/models/user/user.go b/models/user/user.go index b124572bb6..eedd1db80e 100644 --- a/models/user/user.go +++ b/models/user/user.go @@ -182,11 +182,11 @@ func (u *User) BeforeUpdate() { u.MaxRepoCreation = -1 } - // Ensure AvatarEmail is set for non-organization users, because organization - // are not required to have a email set. + // Organization does not need email + u.Email = strings.ToLower(u.Email) if !u.IsOrganization() { if len(u.AvatarEmail) == 0 { - u.AvatarEmail = strings.ToLower(u.Email) + u.AvatarEmail = u.Email } } diff --git a/package-lock.json b/package-lock.json index 4555b299bf..18e007e5a6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -86,7 +86,7 @@ "eslint-plugin-vue": "10.2.0", "eslint-plugin-vue-scoped-css": "2.10.0", "eslint-plugin-wc": "3.0.1", - "globals": "16.3.0", + "globals": "16.1.0", "happy-dom": "18.0.1", "license-checker-rseidelsohn": "4.4.2", "markdownlint-cli": "0.45.0", @@ -8440,9 +8440,9 @@ } }, "node_modules/globals": { - "version": "16.3.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-16.3.0.tgz", - "integrity": "sha512-bqWEnJ1Nt3neqx2q5SFfGS8r/ahumIakg3HcwtNlrVlwXIeNumWn/c7Pn/wKzGhf6SaW6H6uWXLqC30STCMchQ==", + "version": "16.1.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-16.1.0.tgz", + "integrity": "sha512-aibexHNbb/jiUSObBgpHLj+sIuUmJnYcgXBlrfsiDZ9rt4aF2TFRbyLgZ2iFQuVZ1K5Mx3FVkbKRSgKrbK3K2g==", "dev": true, "license": "MIT", "engines": { diff --git a/package.json b/package.json index 3623c143e0..c6e96d68ec 100644 --- a/package.json +++ b/package.json @@ -85,7 +85,7 @@ "eslint-plugin-vue": "10.2.0", "eslint-plugin-vue-scoped-css": "2.10.0", "eslint-plugin-wc": "3.0.1", - "globals": "16.3.0", + "globals": "16.1.0", "happy-dom": "18.0.1", "license-checker-rseidelsohn": "4.4.2", "markdownlint-cli": "0.45.0",