forked from go-gitea/gitea
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: Make Ctrl+Enter work for issue/comment edit (go-gitea#30720) Rename migration package name for 1.22-rc1 (go-gitea#30730) Issue card improvements (go-gitea#30687) Don't show loading indicators when refreshing the system status (go-gitea#30712) Add some tests to clarify the "must-change-password" behavior (go-gitea#30693) Prevent allow/reject reviews on merged/closed PRs (go-gitea#30686) Update JS dependencies (go-gitea#30713) Improve diff stats bar (go-gitea#30669) Remove unused parameter for some functions in `services/mirror` (go-gitea#30724) Update misspell to 0.5.1 and add `misspellings.csv` (go-gitea#30573) Suppress browserslist warning in webpack target (go-gitea#30571) [skip ci] Updated translations via Crowdin Diff color enhancements, add line number background (go-gitea#30670)
- Loading branch information
Showing
75 changed files
with
764 additions
and
550 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,7 +30,7 @@ EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-che | |
GOFUMPT_PACKAGE ?= mvdan.cc/[email protected] | ||
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/[email protected] | ||
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/[email protected] | ||
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.4.1 | ||
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.5.1 | ||
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@db51e79a0e37c572d8b59ae0c58bf2bbbbe53285 | ||
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest | ||
GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1 | ||
|
@@ -397,11 +397,11 @@ lint-md: node_modules | |
|
||
.PHONY: lint-spell | ||
lint-spell: | ||
@go run $(MISSPELL_PACKAGE) -error $(SPELLCHECK_FILES) | ||
@go run $(MISSPELL_PACKAGE) -dict tools/misspellings.csv -error $(SPELLCHECK_FILES) | ||
|
||
.PHONY: lint-spell-fix | ||
lint-spell-fix: | ||
@go run $(MISSPELL_PACKAGE) -w $(SPELLCHECK_FILES) | ||
@go run $(MISSPELL_PACKAGE) -dict tools/misspellings.csv -w $(SPELLCHECK_FILES) | ||
|
||
.PHONY: lint-go | ||
lint-go: | ||
|
@@ -908,8 +908,9 @@ webpack: $(WEBPACK_DEST) | |
|
||
$(WEBPACK_DEST): $(WEBPACK_SOURCES) $(WEBPACK_CONFIGS) package-lock.json | ||
@$(MAKE) -s node-check node_modules | ||
rm -rf $(WEBPACK_DEST_ENTRIES) | ||
npx webpack | ||
@rm -rf $(WEBPACK_DEST_ENTRIES) | ||
@echo "Running webpack..." | ||
@BROWSERSLIST_IGNORE_OLD_DATA=true npx webpack | ||
@touch $(WEBPACK_DEST) | ||
|
||
.PHONY: svg | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// Copyright 2023 The Gitea Authors. All rights reserved. | ||
// SPDX-License-Identifier: MIT | ||
|
||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"strings" | ||
"testing" | ||
|
||
"code.gitea.io/gitea/models/db" | ||
"code.gitea.io/gitea/models/unittest" | ||
user_model "code.gitea.io/gitea/models/user" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestAdminUserCreate(t *testing.T) { | ||
app := NewMainApp(AppVersion{}) | ||
|
||
reset := func() { | ||
assert.NoError(t, db.TruncateBeans(db.DefaultContext, &user_model.User{})) | ||
assert.NoError(t, db.TruncateBeans(db.DefaultContext, &user_model.EmailAddress{})) | ||
} | ||
|
||
type createCheck struct{ IsAdmin, MustChangePassword bool } | ||
createUser := func(name, args string) createCheck { | ||
assert.NoError(t, app.Run(strings.Fields(fmt.Sprintf("./gitea admin user create --username %s --email %[email protected] %s --password foobar", name, name, args)))) | ||
u := unittest.AssertExistsAndLoadBean(t, &user_model.User{LowerName: name}) | ||
return createCheck{u.IsAdmin, u.MustChangePassword} | ||
} | ||
reset() | ||
assert.Equal(t, createCheck{IsAdmin: false, MustChangePassword: false}, createUser("u", ""), "first non-admin user doesn't need to change password") | ||
|
||
reset() | ||
assert.Equal(t, createCheck{IsAdmin: true, MustChangePassword: false}, createUser("u", "--admin"), "first admin user doesn't need to change password") | ||
|
||
reset() | ||
assert.Equal(t, createCheck{IsAdmin: true, MustChangePassword: true}, createUser("u", "--admin --must-change-password")) | ||
assert.Equal(t, createCheck{IsAdmin: true, MustChangePassword: true}, createUser("u2", "--admin")) | ||
assert.Equal(t, createCheck{IsAdmin: true, MustChangePassword: false}, createUser("u3", "--admin --must-change-password=false")) | ||
assert.Equal(t, createCheck{IsAdmin: false, MustChangePassword: true}, createUser("u4", "")) | ||
assert.Equal(t, createCheck{IsAdmin: false, MustChangePassword: false}, createUser("u5", "--must-change-password=false")) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.