diff --git a/.drone.yml b/.drone.yml
index 1181b809b0da4..0e8e8abcbfd5d 100644
--- a/.drone.yml
+++ b/.drone.yml
@@ -9,8 +9,6 @@ platform:
trigger:
event:
- - push
- - tag
- pull_request
paths:
exclude:
@@ -28,7 +26,7 @@ steps:
- make deps-frontend
- name: deps-backend
- image: golang:1.20
+ image: gitea/test_env:linux-1.20-amd64
pull: always
commands:
- make deps-backend
@@ -44,7 +42,7 @@ steps:
depends_on: [deps-frontend]
- name: lint-backend
- image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
+ image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
pull: always
commands:
- make lint-backend
@@ -58,7 +56,7 @@ steps:
path: /go
- name: lint-backend-windows
- image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
+ image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
commands:
- make golangci-lint-windows vet
environment:
@@ -73,7 +71,7 @@ steps:
path: /go
- name: lint-backend-gogit
- image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
+ image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
commands:
- make lint-backend
environment:
@@ -92,7 +90,7 @@ steps:
depends_on: [deps-frontend]
- name: checks-backend
- image: golang:1.20
+ image: gitea/test_env:linux-1.20-amd64
commands:
- make --always-make checks-backend # ensure the 'go-licenses' make target runs
depends_on: [deps-backend]
@@ -113,7 +111,7 @@ steps:
depends_on: [deps-frontend]
- name: build-backend-no-gcc
- image: golang:1.19 # this step is kept as the lowest version of golang that we support
+ image: gitea/test_env:linux-1.19-amd64 # this step is kept as the lowest version of golang that we support
pull: always
environment:
GOPROXY: https://goproxy.io
@@ -125,7 +123,7 @@ steps:
path: /go
- name: build-backend-arm64
- image: golang:1.20
+ image: gitea/test_env:linux-1.20-amd64
environment:
GOPROXY: https://goproxy.io
GOOS: linux
@@ -140,7 +138,7 @@ steps:
path: /go
- name: build-backend-windows
- image: golang:1.20
+ image: gitea/test_env:linux-1.20-amd64
environment:
GOPROXY: https://goproxy.io
GOOS: windows
@@ -154,7 +152,7 @@ steps:
path: /go
- name: build-backend-386
- image: golang:1.20
+ image: gitea/test_env:linux-1.20-amd64
environment:
GOPROXY: https://goproxy.io
GOOS: linux
@@ -180,8 +178,6 @@ depends_on:
trigger:
event:
- - push
- - tag
- pull_request
paths:
exclude:
@@ -217,7 +213,6 @@ steps:
image: docker:git
pull: always
commands:
- - git config --global --add safe.directory /drone/src
- git fetch --tags --force
when:
event:
@@ -225,7 +220,7 @@ steps:
- pull_request
- name: deps-backend
- image: golang:1.20
+ image: gitea/test_env:linux-1.20-amd64
pull: always
commands:
- make deps-backend
@@ -234,13 +229,13 @@ steps:
path: /go
- name: prepare-test-env
- image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
+ image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
pull: always
commands:
- ./build/test-env-prepare.sh
- name: build
- image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
+ image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
user: gitea
commands:
- ./build/test-env-check.sh
@@ -255,7 +250,7 @@ steps:
path: /go
- name: test-pgsql
- image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
+ image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
user: gitea
commands:
- timeout -s ABRT 50m make test-pgsql-migration test-pgsql
@@ -285,8 +280,6 @@ depends_on:
trigger:
event:
- - push
- - tag
- pull_request
paths:
exclude:
@@ -319,7 +312,6 @@ steps:
image: docker:git
pull: always
commands:
- - git config --global --add safe.directory /drone/src
- git fetch --tags --force
when:
event:
@@ -327,7 +319,7 @@ steps:
- pull_request
- name: deps-backend
- image: golang:1.20
+ image: gitea/test_env:linux-1.20-amd64
pull: always
commands:
- make deps-backend
@@ -336,13 +328,13 @@ steps:
path: /go
- name: prepare-test-env
- image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
+ image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
pull: always
commands:
- ./build/test-env-prepare.sh
- name: build
- image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
+ image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
user: gitea
commands:
- ./build/test-env-check.sh
@@ -357,7 +349,7 @@ steps:
path: /go
- name: unit-test
- image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
+ image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
user: gitea
commands:
- make unit-test-coverage test-check
@@ -373,7 +365,7 @@ steps:
path: /go
- name: unit-test-gogit
- image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
+ image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
user: gitea
commands:
- make unit-test-coverage test-check
@@ -389,7 +381,7 @@ steps:
path: /go
- name: test-mysql
- image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
+ image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
user: gitea
commands:
- make test-mysql-migration integration-test-coverage
@@ -405,7 +397,7 @@ steps:
path: /go
- name: generate-coverage
- image: golang:1.20
+ image: gitea/test_env:linux-1.20-amd64
commands:
- make coverage
environment:
@@ -449,8 +441,6 @@ depends_on:
trigger:
event:
- - push
- - tag
- pull_request
paths:
exclude:
@@ -473,7 +463,6 @@ steps:
image: docker:git
pull: always
commands:
- - git config --global --add safe.directory /drone/src
- git fetch --tags --force
when:
event:
@@ -481,7 +470,7 @@ steps:
- pull_request
- name: deps-backend
- image: golang:1.20
+ image: gitea/test_env:linux-1.20-amd64
pull: always
commands:
- make deps-backend
@@ -490,13 +479,13 @@ steps:
path: /go
- name: prepare-test-env
- image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
+ image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
pull: always
commands:
- ./build/test-env-prepare.sh
- name: build
- image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
+ image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
user: gitea
commands:
- ./build/test-env-check.sh
@@ -511,7 +500,7 @@ steps:
path: /go
- name: test-mysql8
- image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
+ image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
user: gitea
commands:
- timeout -s ABRT 50m make test-mysql8-migration test-mysql8
@@ -538,8 +527,6 @@ depends_on:
trigger:
event:
- - push
- - tag
- pull_request
paths:
exclude:
@@ -563,7 +550,6 @@ steps:
image: docker:git
pull: always
commands:
- - git config --global --add safe.directory /drone/src
- git fetch --tags --force
when:
event:
@@ -571,7 +557,7 @@ steps:
- pull_request
- name: deps-backend
- image: golang:1.20
+ image: gitea/test_env:linux-1.20-amd64
pull: always
commands:
- make deps-backend
@@ -580,13 +566,13 @@ steps:
path: /go
- name: prepare-test-env
- image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
+ image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
pull: always
commands:
- ./build/test-env-prepare.sh
- name: build
- image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
+ image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
user: gitea
commands:
- ./build/test-env-check.sh
@@ -601,7 +587,7 @@ steps:
path: /go
- name: test-mssql
- image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
+ image: gitea/test_env:linux-1.20-amd64 # https://gitea.com/gitea/test-env
user: gitea
commands:
- make test-mssql-migration test-mssql
@@ -627,8 +613,6 @@ depends_on:
trigger:
event:
- - push
- - tag
- pull_request
paths:
exclude:
@@ -643,7 +627,6 @@ steps:
image: docker:git
pull: always
commands:
- - git config --global --add safe.directory /drone/src
- git fetch --tags --force
when:
event:
@@ -651,7 +634,7 @@ steps:
- pull_request
- name: deps-backend
- image: golang:1.20
+ image: gitea/test_env:linux-1.20-arm64
pull: always
commands:
- make deps-backend
@@ -660,13 +643,13 @@ steps:
path: /go
- name: prepare-test-env
- image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
+ image: gitea/test_env:linux-1.20-arm64 # https://gitea.com/gitea/test-env
pull: always
commands:
- ./build/test-env-prepare.sh
- name: build
- image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
+ image: gitea/test_env:linux-1.20-arm64 # https://gitea.com/gitea/test-env
user: gitea
commands:
- ./build/test-env-check.sh
@@ -681,7 +664,7 @@ steps:
path: /go
- name: test-sqlite
- image: gitea/test_env:linux-arm64 # https://gitea.com/gitea/test-env
+ image: gitea/test_env:linux-1.20-arm64 # https://gitea.com/gitea/test-env
user: gitea
commands:
- timeout -s ABRT 50m make test-sqlite-migration test-sqlite
@@ -733,7 +716,7 @@ steps:
depends_on: [deps-frontend]
- name: deps-backend
- image: golang:1.18
+ image: gitea/test_env:linux-1.20-amd64
pull: always
commands:
- make deps-backend
@@ -842,7 +825,7 @@ trigger:
steps:
- name: download
- image: golang:1.20
+ image: gitea/test_env:linux-1.20-amd64
pull: always
commands:
- timeout -s ABRT 40m make generate-license generate-gitignore
@@ -902,7 +885,6 @@ steps:
image: docker:git
pull: always
commands:
- - git config --global --add safe.directory /drone/src
- git fetch --tags --force
- name: deps-frontend
@@ -912,7 +894,7 @@ steps:
- make deps-frontend
- name: deps-backend
- image: golang:1.20
+ image: gitea/test_env:linux-1.20-amd64
pull: always
commands:
- make deps-backend
@@ -1038,7 +1020,6 @@ steps:
image: docker:git
pull: always
commands:
- - git config --global --add safe.directory /drone/src
- git fetch --tags --force
- name: deps-frontend
@@ -1048,7 +1029,7 @@ steps:
- make deps-frontend
- name: deps-backend
- image: golang:1.20
+ image: gitea/test_env:linux-1.20-amd64
pull: always
commands:
- make deps-backend
@@ -1148,7 +1129,7 @@ trigger:
steps:
- name: build-docs
- image: golang:1.20
+ image: gitea/test_env:linux-1.20-amd64
commands:
- cd docs
- make trans-copy clean build
@@ -1202,7 +1183,6 @@ steps:
image: docker:git
pull: always
commands:
- - git config --global --add safe.directory /drone/src
- git fetch --tags --force
- name: publish
@@ -1280,7 +1260,6 @@ steps:
image: docker:git
pull: always
commands:
- - git config --global --add safe.directory /drone/src
- git fetch --tags --force
- name: publish
@@ -1353,7 +1332,6 @@ steps:
image: docker:git
pull: always
commands:
- - git config --global --add safe.directory /drone/src
- git fetch --tags --force
- name: publish
@@ -1427,7 +1405,6 @@ steps:
image: docker:git
pull: always
commands:
- - git config --global --add safe.directory /drone/src
- git fetch --tags --force
- name: publish
@@ -1477,7 +1454,7 @@ steps:
---
kind: pipeline
type: docker
-name: docker-linux-amd64-dry-run
+name: docker-linux-arm64-dry-run
platform:
os: linux
@@ -1487,8 +1464,8 @@ depends_on:
- compliance
trigger:
- ref:
- - "refs/pull/**"
+ event:
+ - pull_request
paths:
exclude:
- docs/**
@@ -1545,7 +1522,6 @@ steps:
image: docker:git
pull: always
commands:
- - git config --global --add safe.directory /drone/src
- git fetch --tags --force
- name: publish
@@ -1623,7 +1599,6 @@ steps:
image: docker:git
pull: always
commands:
- - git config --global --add safe.directory /drone/src
- git fetch --tags --force
- name: publish
@@ -1699,7 +1674,6 @@ steps:
image: docker:git
pull: always
commands:
- - git config --global --add safe.directory /drone/src
- git fetch --tags --force
- name: publish
@@ -1773,7 +1747,6 @@ steps:
image: docker:git
pull: always
commands:
- - git config --global --add safe.directory /drone/src
- git fetch --tags --force
- name: publish
diff --git a/.stylelintrc.yaml b/.stylelintrc.yaml
index c488d0677f18a..62660fcf94409 100644
--- a/.stylelintrc.yaml
+++ b/.stylelintrc.yaml
@@ -5,8 +5,6 @@ ignoreFiles:
- "**/*.go"
overrides:
- - files: ["**/*.less"]
- customSyntax: postcss-less
- files: ["**/chroma/*", "**/codemirror/*", "**/standalone/*", "**/console/*"]
rules:
scale-unlimited/declaration-strict-value: null
diff --git a/Makefile b/Makefile
index d770ed453f4fa..0d49bdfdfb272 100644
--- a/Makefile
+++ b/Makefile
@@ -29,7 +29,7 @@ AIR_PACKAGE ?= github.com/cosmtrek/air@v1.40.4
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/editorconfig-checker@2.6.0
ERRCHECK_PACKAGE ?= github.com/kisielk/errcheck@v1.6.2
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.4.0
-GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.0
+GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/golangci-lint@v1.51.2
GXZ_PAGAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.10
MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/misspell@v0.3.4
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.30.4
@@ -105,7 +105,7 @@ GO_TEST_PACKAGES ?= $(filter-out $(shell $(GO) list code.gitea.io/gitea/models/m
FOMANTIC_WORK_DIR := web_src/fomantic
-WEBPACK_SOURCES := $(shell find web_src/js web_src/less -type f)
+WEBPACK_SOURCES := $(shell find web_src/js web_src/css -type f)
WEBPACK_CONFIGS := webpack.config.js
WEBPACK_DEST := public/js/index.js public/css/index.css
WEBPACK_DEST_ENTRIES := public/js public/css public/fonts public/img/webpack public/serviceworker.js
@@ -131,7 +131,7 @@ TEST_TAGS ?= sqlite sqlite_unlock_notify
TAR_EXCLUDES := .git data indexers queues log node_modules $(EXECUTABLE) $(FOMANTIC_WORK_DIR)/node_modules $(DIST) $(MAKE_EVIDENCE_DIR) $(AIR_TMP_DIR) $(GO_LICENSE_TMP_DIR)
GO_DIRS := cmd tests models modules routers build services tools
-WEB_DIRS := web_src/js web_src/less
+WEB_DIRS := web_src/js web_src/css
GO_SOURCES := $(wildcard *.go)
GO_SOURCES += $(shell find $(GO_DIRS) -type f -name "*.go" -not -path modules/options/bindata.go -not -path modules/public/bindata.go -not -path modules/templates/bindata.go)
@@ -342,7 +342,7 @@ lint: lint-frontend lint-backend
.PHONY: lint-frontend
lint-frontend: node_modules
npx eslint --color --max-warnings=0 --ext js,vue web_src/js build *.config.js docs/assets/js tests/e2e
- npx stylelint --color --max-warnings=0 web_src/less
+ npx stylelint --color --max-warnings=0 web_src/css
npx spectral lint -q -F hint $(SWAGGER_SPEC)
npx markdownlint docs *.md
diff --git a/custom/conf/app.example.ini b/custom/conf/app.example.ini
index e53ed7ad9fd8b..1e55ce73a2385 100644
--- a/custom/conf/app.example.ini
+++ b/custom/conf/app.example.ini
@@ -20,7 +20,7 @@
;; - The environment variable `$GITEA_WORK_DIR`
;; - A built-in value set at build time (see building from source)
;; - Otherwise it defaults to the directory of the _`AppPath`_
-;; - If any of the above are relative paths then they are made absolute against the
+;; - If any of the above are relative paths then they are made absolute against
;; the directory of the _`AppPath`_
;; - _`CustomPath`_: This is the base directory for custom templates and other options.
;; It is determined by using the first set thing in the following hierarchy:
diff --git a/docs/content/doc/advanced/config-cheat-sheet.en-us.md b/docs/content/doc/advanced/config-cheat-sheet.en-us.md
index 4b9c519cd80df..e0df371a0f0a0 100644
--- a/docs/content/doc/advanced/config-cheat-sheet.en-us.md
+++ b/docs/content/doc/advanced/config-cheat-sheet.en-us.md
@@ -46,7 +46,7 @@ reported as part of the default configuration when running `gitea --help` or on
- The environment variable `$GITEA_WORK_DIR`
- A built-in value set at build time (see building from source)
- Otherwise it defaults to the directory of the _`AppPath`_
- - If any of the above are relative paths then they are made absolute against the
+ - If any of the above are relative paths then they are made absolute against
the directory of the _`AppPath`_
- _`CustomPath`_: This is the base directory for custom templates and other options.
It is determined by using the first set thing in the following hierarchy:
diff --git a/docs/content/doc/advanced/customizing-gitea.en-us.md b/docs/content/doc/advanced/customizing-gitea.en-us.md
index bad6342aad44d..4c0235c04aca5 100644
--- a/docs/content/doc/advanced/customizing-gitea.en-us.md
+++ b/docs/content/doc/advanced/customizing-gitea.en-us.md
@@ -354,7 +354,7 @@ To make a custom theme available to all users:
Community themes are listed in [gitea/awesome-gitea#themes](https://gitea.com/gitea/awesome-gitea#themes).
-The `arc-green` theme source can be found [here](https://github.com/go-gitea/gitea/blob/main/web_src/less/themes/theme-arc-green.less).
+The `arc-green` theme source can be found [here](https://github.com/go-gitea/gitea/blob/main/web_src/css/themes/theme-arc-green.css).
If your custom theme is considered a dark theme, set the global css variable `--is-dark-theme` to `true`.
This allows Gitea to adjust the Monaco code editor's theme accordingly.
diff --git a/docs/content/doc/developers/guidelines-frontend.en-us.md b/docs/content/doc/developers/guidelines-frontend.en-us.md
index 9ac317f401903..e2bdc7adcb596 100644
--- a/docs/content/doc/developers/guidelines-frontend.en-us.md
+++ b/docs/content/doc/developers/guidelines-frontend.en-us.md
@@ -21,13 +21,13 @@ menu:
## Background
-Gitea uses [Less CSS](https://lesscss.org), [Fomantic-UI](https://fomantic-ui.com/introduction/getting-started.html) (based on [jQuery](https://api.jquery.com)) and [Vue3](https://vuejs.org/) for its frontend.
+Gitea uses [Fomantic-UI](https://fomantic-ui.com/introduction/getting-started.html) (based on [jQuery](https://api.jquery.com)) and [Vue3](https://vuejs.org/) for its frontend.
The HTML pages are rendered by [Go HTML Template](https://pkg.go.dev/html/template).
The source files can be found in the following directories:
-* **Less styles:** `web_src/less/`
+* **CSS styles:** `web_src/css/`
* **JavaScript files:** `web_src/js/`
* **Vue components:** `web_src/js/components/`
* **Go HTML templates:** `templates/`
diff --git a/docs/content/doc/features/localization.zh-cn.md b/docs/content/doc/features/localization.zh-cn.md
index 44f9537f31b4e..dd2dc1fa90f68 100644
--- a/docs/content/doc/features/localization.zh-cn.md
+++ b/docs/content/doc/features/localization.zh-cn.md
@@ -14,6 +14,7 @@ menu:
---
# 本地化
+
Gitea的本地化是通过我们的[Crowdin项目](https://crowdin.com/project/gitea)进行的。
对于对**英语翻译**的更改,可以发出pull-request,来更改[英语语言环境](https://github.com/go-gitea/gitea/blob/master/options/locale/locale_en-US.ini)中合适的关键字。
@@ -21,6 +22,7 @@ Gitea的本地化是通过我们的[Crowdin项目](https://crowdin.com/project/g
有关对**非英语**翻译的更改,请参阅上面的 Crowdin 项目。
## 支持的语言
+
上述 Crowdin 项目中列出的任何语言一旦翻译了 25% 或更多都将得到支持。
翻译被接受后,它将在下一次 Crowdin 同步后反映在主存储库中,这通常是在任何 PR 合并之后。
diff --git a/docs/content/doc/usage/push-options.en-us.md b/docs/content/doc/usage/push-options.en-us.md
index 8d7de19609c83..b58a91c2cc541 100644
--- a/docs/content/doc/usage/push-options.en-us.md
+++ b/docs/content/doc/usage/push-options.en-us.md
@@ -29,5 +29,5 @@ were added.
Example of changing a repository's visibility to public:
```shell
-git push -o repo.private=false -u origin master
+git push -o repo.private=false -u origin main
```
diff --git a/docs/content/doc/usage/push-options.zh-tw.md b/docs/content/doc/usage/push-options.zh-tw.md
index d6ffbe695b401..558492af77073 100644
--- a/docs/content/doc/usage/push-options.zh-tw.md
+++ b/docs/content/doc/usage/push-options.zh-tw.md
@@ -29,5 +29,5 @@ Gitea 從 `1.13` 版開始支援某些 [push options](https://git-scm.com/docs/g
以下範例修改儲存庫的可見性為公開:
```shell
-git push -o repo.private=false -u origin master
+git push -o repo.private=false -u origin main
```
diff --git a/docs/content/doc/usage/push-to-create.en-us.md b/docs/content/doc/usage/push-to-create.en-us.md
new file mode 100644
index 0000000000000..7ed3f563687df
--- /dev/null
+++ b/docs/content/doc/usage/push-to-create.en-us.md
@@ -0,0 +1,40 @@
+---
+date: "2020-07-06T16:00:00+02:00"
+title: "Usage: Push To Create"
+slug: "push-to-create"
+weight: 15
+toc: false
+draft: false
+menu:
+ sidebar:
+ parent: "usage"
+ name: "Push To Create"
+ weight: 15
+ identifier: "push-to-create"
+---
+
+# Push To Create
+
+Push to create is a feature that allows you to push to a repository that does not exist yet in Gitea. This is useful for automation and for allowing users to create repositories without having to go through the web interface. This feature is disabled by default.
+
+## Enabling Push To Create
+
+In the `app.ini` file, set `ENABLE_PUSH_CREATE_USER` to `true` and `ENABLE_PUSH_CREATE_ORG` to `true` if you want to allow users to create repositories in their own user account and in organizations they are a member of respectively. Restart Gitea for the changes to take effect. You can read more about these two options in the [Configuration Cheat Sheet]({{< relref "doc/advanced/config-cheat-sheet.en-us.md#repository-repository" >}}).
+
+## Using Push To Create
+
+Assuming you have a git repository in the current directory, you can push to a repository that does not exist yet in Gitea by running the following command:
+
+```shell
+# Add the remote you want to push to
+git remote add origin git@{domain}:{username}/{repo name that does not exist yet}.git
+
+# push to the remote
+git push -u origin main
+```
+
+This assumes you are using an SSH remote, but you can also use HTTPS remotes as well.
+
+## Push options (bonus)
+
+Push-to-create will default to the visibility defined by `DEFAULT_PUSH_CREATE_PRIVATE` in `app.ini`. To explicitly set the visibility, you can use a [push option]({{< relref "doc/usage/push-options.en-us.md" >}}).
diff --git a/models/issues/pull.go b/models/issues/pull.go
index 6a1dc31556247..a15ebec0b52a3 100644
--- a/models/issues/pull.go
+++ b/models/issues/pull.go
@@ -660,10 +660,10 @@ func GetPullRequestByIssueID(ctx context.Context, issueID int64) (*PullRequest,
// GetAllUnmergedAgitPullRequestByPoster get all unmerged agit flow pull request
// By poster id.
-func GetAllUnmergedAgitPullRequestByPoster(uid int64) ([]*PullRequest, error) {
+func GetAllUnmergedAgitPullRequestByPoster(ctx context.Context, uid int64) ([]*PullRequest, error) {
pulls := make([]*PullRequest, 0, 10)
- err := db.GetEngine(db.DefaultContext).
+ err := db.GetEngine(ctx).
Where("has_merged=? AND flow = ? AND issue.is_closed=? AND issue.poster_id=?",
false, PullRequestFlowAGit, false, uid).
Join("INNER", "issue", "issue.id=pull_request.issue_id").
diff --git a/models/migrations/fixtures/Test_DeleteOrphanedIssueLabels/label.yml b/models/migrations/fixtures/Test_DeleteOrphanedIssueLabels/label.yml
index 085b7f0882d5e..d651c87d5b0d6 100644
--- a/models/migrations/fixtures/Test_DeleteOrphanedIssueLabels/label.yml
+++ b/models/migrations/fixtures/Test_DeleteOrphanedIssueLabels/label.yml
@@ -4,7 +4,6 @@
org_id: 0
name: label1
color: '#abcdef'
- exclusive: false
num_issues: 2
num_closed_issues: 0
@@ -14,7 +13,6 @@
org_id: 0
name: label2
color: '#000000'
- exclusive: false
num_issues: 1
num_closed_issues: 1
-
@@ -23,7 +21,6 @@
org_id: 3
name: orglabel3
color: '#abcdef'
- exclusive: false
num_issues: 0
num_closed_issues: 0
@@ -33,7 +30,6 @@
org_id: 3
name: orglabel4
color: '#000000'
- exclusive: false
num_issues: 1
num_closed_issues: 0
@@ -43,6 +39,5 @@
org_id: 0
name: pull-test-label
color: '#000000'
- exclusive: false
num_issues: 0
num_closed_issues: 0
diff --git a/models/user/user.go b/models/user/user.go
index 454779b9ea361..82c2d3b6cdc10 100644
--- a/models/user/user.go
+++ b/models/user/user.go
@@ -742,13 +742,13 @@ func VerifyUserActiveCode(code string) (user *User) {
}
// ChangeUserName changes all corresponding setting from old user name to new one.
-func ChangeUserName(u *User, newUserName string) (err error) {
+func ChangeUserName(ctx context.Context, u *User, newUserName string) (err error) {
oldUserName := u.Name
if err = IsUsableUsername(newUserName); err != nil {
return err
}
- ctx, committer, err := db.TxContext(db.DefaultContext)
+ ctx, committer, err := db.TxContext(ctx)
if err != nil {
return err
}
diff --git a/modules/actions/github.go b/modules/actions/github.go
new file mode 100644
index 0000000000000..bcde9a0f552ec
--- /dev/null
+++ b/modules/actions/github.go
@@ -0,0 +1,41 @@
+// Copyright 2023 The Gitea Authors. All rights reserved.
+// SPDX-License-Identifier: MIT
+
+package actions
+
+import (
+ webhook_module "code.gitea.io/gitea/modules/webhook"
+
+ "github.com/nektos/act/pkg/jobparser"
+)
+
+const (
+ githubEventPullRequest = "pull_request"
+ githubEventPullRequestTarget = "pull_request_target"
+ githubEventPullRequestReviewComment = "pull_request_review_comment"
+ githubEventPullRequestReview = "pull_request_review"
+ githubEventRegistryPackage = "registry_package"
+ githubEventCreate = "create"
+ githubEventDelete = "delete"
+ githubEventFork = "fork"
+ githubEventPush = "push"
+ githubEventIssues = "issues"
+ githubEventIssueComment = "issue_comment"
+ githubEventRelease = "release"
+ githubEventPullRequestComment = "pull_request_comment"
+)
+
+func convertFromGithubEvent(evt *jobparser.Event) string {
+ switch evt.Name {
+ case githubEventPullRequest, githubEventPullRequestTarget, githubEventPullRequestReview,
+ githubEventPullRequestReviewComment:
+ return string(webhook_module.HookEventPullRequest)
+ case githubEventRegistryPackage:
+ return string(webhook_module.HookEventPackage)
+ case githubEventCreate, githubEventDelete, githubEventFork, githubEventPush,
+ githubEventIssues, githubEventIssueComment, githubEventRelease, githubEventPullRequestComment:
+ fallthrough
+ default:
+ return evt.Name
+ }
+}
diff --git a/modules/actions/workflows.go b/modules/actions/workflows.go
index 7f0e6e456436b..67c3b12427adb 100644
--- a/modules/actions/workflows.go
+++ b/modules/actions/workflows.go
@@ -44,6 +44,32 @@ func ListWorkflows(commit *git.Commit) (git.Entries, error) {
return ret, nil
}
+func GetContentFromEntry(entry *git.TreeEntry) ([]byte, error) {
+ f, err := entry.Blob().DataAsync()
+ if err != nil {
+ return nil, err
+ }
+ content, err := io.ReadAll(f)
+ _ = f.Close()
+ if err != nil {
+ return nil, err
+ }
+ return content, nil
+}
+
+func GetEventsFromContent(content []byte) ([]*jobparser.Event, error) {
+ workflow, err := model.ReadWorkflow(bytes.NewReader(content))
+ if err != nil {
+ return nil, err
+ }
+ events, err := jobparser.ParseRawOn(&workflow.RawOn)
+ if err != nil {
+ return nil, err
+ }
+
+ return events, nil
+}
+
func DetectWorkflows(commit *git.Commit, triggedEvent webhook_module.HookEventType, payload api.Payloader) (map[string][]byte, error) {
entries, err := ListWorkflows(commit)
if err != nil {
@@ -52,29 +78,17 @@ func DetectWorkflows(commit *git.Commit, triggedEvent webhook_module.HookEventTy
workflows := make(map[string][]byte, len(entries))
for _, entry := range entries {
- f, err := entry.Blob().DataAsync()
- if err != nil {
- return nil, err
- }
- content, err := io.ReadAll(f)
- _ = f.Close()
+ content, err := GetContentFromEntry(entry)
if err != nil {
return nil, err
}
- workflow, err := model.ReadWorkflow(bytes.NewReader(content))
- if err != nil {
- log.Warn("ignore invalid workflow %q: %v", entry.Name(), err)
- continue
- }
- events, err := jobparser.ParseRawOn(&workflow.RawOn)
+ events, err := GetEventsFromContent(content)
if err != nil {
log.Warn("ignore invalid workflow %q: %v", entry.Name(), err)
continue
}
for _, evt := range events {
- if evt.Name != triggedEvent.Event() {
- continue
- }
+ log.Trace("detect workflow %q for event %#v matching %q", entry.Name(), evt, triggedEvent)
if detectMatched(commit, triggedEvent, payload, evt) {
workflows[entry.Name()] = content
}
@@ -85,138 +99,197 @@ func DetectWorkflows(commit *git.Commit, triggedEvent webhook_module.HookEventTy
}
func detectMatched(commit *git.Commit, triggedEvent webhook_module.HookEventType, payload api.Payloader, evt *jobparser.Event) bool {
- if len(evt.Acts) == 0 {
- return true
+ if convertFromGithubEvent(evt) != string(triggedEvent) {
+ return false
}
switch triggedEvent {
- case webhook_module.HookEventCreate:
- fallthrough
- case webhook_module.HookEventDelete:
- fallthrough
- case webhook_module.HookEventFork:
- log.Warn("unsupported event %q", triggedEvent.Event())
- return false
+ case webhook_module.HookEventCreate,
+ webhook_module.HookEventDelete,
+ webhook_module.HookEventFork,
+ webhook_module.HookEventIssueAssign,
+ webhook_module.HookEventIssueLabel,
+ webhook_module.HookEventIssueMilestone,
+ webhook_module.HookEventPullRequestAssign,
+ webhook_module.HookEventPullRequestLabel,
+ webhook_module.HookEventPullRequestMilestone,
+ webhook_module.HookEventPullRequestComment,
+ webhook_module.HookEventPullRequestReviewApproved,
+ webhook_module.HookEventPullRequestReviewRejected,
+ webhook_module.HookEventPullRequestReviewComment,
+ webhook_module.HookEventWiki,
+ webhook_module.HookEventRepository,
+ webhook_module.HookEventRelease,
+ webhook_module.HookEventPackage:
+ if len(evt.Acts) != 0 {
+ log.Warn("Ignore unsupported %s event arguments %q", triggedEvent, evt.Acts)
+ }
+ // no special filter parameters for these events, just return true if name matched
+ return true
+
case webhook_module.HookEventPush:
- pushPayload := payload.(*api.PushPayload)
- matchTimes := 0
- // all acts conditions should be satisfied
- for cond, vals := range evt.Acts {
- switch cond {
- case "branches", "tags":
- refShortName := git.RefName(pushPayload.Ref).ShortName()
+ return matchPushEvent(commit, payload.(*api.PushPayload), evt)
+
+ case webhook_module.HookEventIssues:
+ return matchIssuesEvent(commit, payload.(*api.IssuePayload), evt)
+
+ case webhook_module.HookEventPullRequest, webhook_module.HookEventPullRequestSync:
+ return matchPullRequestEvent(commit, payload.(*api.PullRequestPayload), evt)
+
+ case webhook_module.HookEventIssueComment:
+ return matchIssueCommentEvent(commit, payload.(*api.IssueCommentPayload), evt)
+
+ default:
+ log.Warn("unsupported event %q", triggedEvent)
+ return false
+ }
+}
+
+func matchPushEvent(commit *git.Commit, pushPayload *api.PushPayload, evt *jobparser.Event) bool {
+ // with no special filter parameters
+ if len(evt.Acts) == 0 {
+ return true
+ }
+
+ matchTimes := 0
+ // all acts conditions should be satisfied
+ for cond, vals := range evt.Acts {
+ switch cond {
+ case "branches", "tags":
+ refShortName := git.RefName(pushPayload.Ref).ShortName()
+ for _, val := range vals {
+ if glob.MustCompile(val, '/').Match(refShortName) {
+ matchTimes++
+ break
+ }
+ }
+ case "paths":
+ filesChanged, err := commit.GetFilesChangedSinceCommit(pushPayload.Before)
+ if err != nil {
+ log.Error("GetFilesChangedSinceCommit [commit_sha1: %s]: %v", commit.ID.String(), err)
+ } else {
for _, val := range vals {
- if glob.MustCompile(val, '/').Match(refShortName) {
+ matched := false
+ for _, file := range filesChanged {
+ if glob.MustCompile(val, '/').Match(file) {
+ matched = true
+ break
+ }
+ }
+ if matched {
matchTimes++
break
}
}
- case "paths":
- filesChanged, err := commit.GetFilesChangedSinceCommit(pushPayload.Before)
- if err != nil {
- log.Error("GetFilesChangedSinceCommit [commit_sha1: %s]: %v", commit.ID.String(), err)
- } else {
- for _, val := range vals {
- matched := false
- for _, file := range filesChanged {
- if glob.MustCompile(val, '/').Match(file) {
- matched = true
- break
- }
- }
- if matched {
- matchTimes++
- break
- }
- }
+ }
+ default:
+ log.Warn("push event unsupported condition %q", cond)
+ }
+ }
+ return matchTimes == len(evt.Acts)
+}
+
+func matchIssuesEvent(commit *git.Commit, issuePayload *api.IssuePayload, evt *jobparser.Event) bool {
+ // with no special filter parameters
+ if len(evt.Acts) == 0 {
+ return true
+ }
+
+ matchTimes := 0
+ // all acts conditions should be satisfied
+ for cond, vals := range evt.Acts {
+ switch cond {
+ case "types":
+ for _, val := range vals {
+ if glob.MustCompile(val, '/').Match(string(issuePayload.Action)) {
+ matchTimes++
+ break
}
- default:
- log.Warn("unsupported condition %q", cond)
}
+ default:
+ log.Warn("issue event unsupported condition %q", cond)
}
- return matchTimes == len(evt.Acts)
+ }
+ return matchTimes == len(evt.Acts)
+}
- case webhook_module.HookEventIssues:
- fallthrough
- case webhook_module.HookEventIssueAssign:
- fallthrough
- case webhook_module.HookEventIssueLabel:
- fallthrough
- case webhook_module.HookEventIssueMilestone:
- fallthrough
- case webhook_module.HookEventIssueComment:
- fallthrough
- case webhook_module.HookEventPullRequest:
- prPayload := payload.(*api.PullRequestPayload)
- matchTimes := 0
- // all acts conditions should be satisfied
- for cond, vals := range evt.Acts {
- switch cond {
- case "types":
- for _, val := range vals {
- if glob.MustCompile(val, '/').Match(string(prPayload.Action)) {
- matchTimes++
- break
- }
+func matchPullRequestEvent(commit *git.Commit, prPayload *api.PullRequestPayload, evt *jobparser.Event) bool {
+ // with no special filter parameters
+ if len(evt.Acts) == 0 {
+ // defaultly, only pull request opened and synchronized will trigger workflow
+ return prPayload.Action == api.HookIssueSynchronized || prPayload.Action == api.HookIssueOpened
+ }
+
+ matchTimes := 0
+ // all acts conditions should be satisfied
+ for cond, vals := range evt.Acts {
+ switch cond {
+ case "types":
+ action := prPayload.Action
+ if prPayload.Action == api.HookIssueSynchronized {
+ action = "synchronize"
+ }
+ log.Trace("matching pull_request %s with %v", action, vals)
+ for _, val := range vals {
+ if glob.MustCompile(val, '/').Match(string(action)) {
+ matchTimes++
+ break
+ }
+ }
+ case "branches":
+ refShortName := git.RefName(prPayload.PullRequest.Base.Ref).ShortName()
+ for _, val := range vals {
+ if glob.MustCompile(val, '/').Match(refShortName) {
+ matchTimes++
+ break
}
- case "branches":
- refShortName := git.RefName(prPayload.PullRequest.Base.Ref).ShortName()
+ }
+ case "paths":
+ filesChanged, err := commit.GetFilesChangedSinceCommit(prPayload.PullRequest.Base.Ref)
+ if err != nil {
+ log.Error("GetFilesChangedSinceCommit [commit_sha1: %s]: %v", commit.ID.String(), err)
+ } else {
for _, val := range vals {
- if glob.MustCompile(val, '/').Match(refShortName) {
+ matched := false
+ for _, file := range filesChanged {
+ if glob.MustCompile(val, '/').Match(file) {
+ matched = true
+ break
+ }
+ }
+ if matched {
matchTimes++
break
}
}
- case "paths":
- filesChanged, err := commit.GetFilesChangedSinceCommit(prPayload.PullRequest.Base.Ref)
- if err != nil {
- log.Error("GetFilesChangedSinceCommit [commit_sha1: %s]: %v", commit.ID.String(), err)
- } else {
- for _, val := range vals {
- matched := false
- for _, file := range filesChanged {
- if glob.MustCompile(val, '/').Match(file) {
- matched = true
- break
- }
- }
- if matched {
- matchTimes++
- break
- }
- }
+ }
+ default:
+ log.Warn("pull request event unsupported condition %q", cond)
+ }
+ }
+ return matchTimes == len(evt.Acts)
+}
+
+func matchIssueCommentEvent(commit *git.Commit, issueCommentPayload *api.IssueCommentPayload, evt *jobparser.Event) bool {
+ // with no special filter parameters
+ if len(evt.Acts) == 0 {
+ return true
+ }
+
+ matchTimes := 0
+ // all acts conditions should be satisfied
+ for cond, vals := range evt.Acts {
+ switch cond {
+ case "types":
+ for _, val := range vals {
+ if glob.MustCompile(val, '/').Match(string(issueCommentPayload.Action)) {
+ matchTimes++
+ break
}
- default:
- log.Warn("unsupported condition %q", cond)
}
+ default:
+ log.Warn("issue comment unsupported condition %q", cond)
}
- return matchTimes == len(evt.Acts)
- case webhook_module.HookEventPullRequestAssign:
- fallthrough
- case webhook_module.HookEventPullRequestLabel:
- fallthrough
- case webhook_module.HookEventPullRequestMilestone:
- fallthrough
- case webhook_module.HookEventPullRequestComment:
- fallthrough
- case webhook_module.HookEventPullRequestReviewApproved:
- fallthrough
- case webhook_module.HookEventPullRequestReviewRejected:
- fallthrough
- case webhook_module.HookEventPullRequestReviewComment:
- fallthrough
- case webhook_module.HookEventPullRequestSync:
- fallthrough
- case webhook_module.HookEventWiki:
- fallthrough
- case webhook_module.HookEventRepository:
- fallthrough
- case webhook_module.HookEventRelease:
- fallthrough
- case webhook_module.HookEventPackage:
- fallthrough
- default:
- log.Warn("unsupported event %q", triggedEvent.Event())
}
- return false
+ return matchTimes == len(evt.Acts)
}
diff --git a/modules/context/pagination.go b/modules/context/pagination.go
index 3effd88f109cf..5a88c92053aa7 100644
--- a/modules/context/pagination.go
+++ b/modules/context/pagination.go
@@ -18,10 +18,11 @@ type Pagination struct {
urlParams []string
}
-// NewPagination creates a new instance of the Pagination struct
-func NewPagination(total, page, issueNum, numPages int) *Pagination {
+// NewPagination creates a new instance of the Pagination struct.
+// "pagingNum" is "page size" or "limit", "current" is "page"
+func NewPagination(total, pagingNum, current, numPages int) *Pagination {
p := &Pagination{}
- p.Paginater = paginator.New(total, page, issueNum, numPages)
+ p.Paginater = paginator.New(total, pagingNum, current, numPages)
return p
}
diff --git a/modules/highlight/highlight.go b/modules/highlight/highlight.go
index a5c38940a7be5..fac682b8a81a7 100644
--- a/modules/highlight/highlight.go
+++ b/modules/highlight/highlight.go
@@ -36,6 +36,8 @@ var (
once sync.Once
cache *lru.TwoQueueCache
+
+ githubStyles = styles.Get("github")
)
// NewContext loads custom highlight map from local config
@@ -121,7 +123,7 @@ func CodeFromLexer(lexer chroma.Lexer, code string) string {
return code
}
// style not used for live site but need to pass something
- err = formatter.Format(htmlw, styles.GitHub, iterator)
+ err = formatter.Format(htmlw, githubStyles, iterator)
if err != nil {
log.Error("Can't format code: %v", err)
return code
@@ -184,7 +186,7 @@ func File(fileName, language string, code []byte) ([]string, string, error) {
lines := make([]string, 0, len(tokensLines))
for _, tokens := range tokensLines {
iterator = chroma.Literator(tokens...)
- err = formatter.Format(htmlBuf, styles.GitHub, iterator)
+ err = formatter.Format(htmlBuf, githubStyles, iterator)
if err != nil {
return nil, "", fmt.Errorf("can't format code: %w", err)
}
diff --git a/modules/structs/user.go b/modules/structs/user.go
index c5e96f335690a..f68b92ac069e2 100644
--- a/modules/structs/user.go
+++ b/modules/structs/user.go
@@ -93,3 +93,12 @@ type UserSettingsOptions struct {
HideEmail *bool `json:"hide_email"`
HideActivity *bool `json:"hide_activity"`
}
+
+// RenameUserOption options when renaming a user
+type RenameUserOption struct {
+ // New username for this user. This name cannot be in use yet by any other user.
+ //
+ // required: true
+ // unique: true
+ NewName string `json:"new_username" binding:"Required"`
+}
diff --git a/modules/structs/user_email.go b/modules/structs/user_email.go
index 6a11e040afb33..9319667e8fca6 100644
--- a/modules/structs/user_email.go
+++ b/modules/structs/user_email.go
@@ -1,4 +1,5 @@
// Copyright 2015 The Gogs Authors. All rights reserved.
+// Copyright 2023 The Gitea Authors. All rights reserved.
// SPDX-License-Identifier: MIT
package structs
@@ -9,6 +10,8 @@ type Email struct {
Email string `json:"email"`
Verified bool `json:"verified"`
Primary bool `json:"primary"`
+ UserID int64 `json:"user_id"`
+ UserName string `json:"username"`
}
// CreateEmailOption options when creating email addresses
diff --git a/options/locale/locale_cs-CZ.ini b/options/locale/locale_cs-CZ.ini
index 543cd44045dec..258267fac1e7e 100644
--- a/options/locale/locale_cs-CZ.ini
+++ b/options/locale/locale_cs-CZ.ini
@@ -3269,6 +3269,7 @@ rubygems.dependencies.development=Vývojové závislosti
rubygems.required.ruby=Vyžaduje verzi Ruby
rubygems.required.rubygems=Vyžaduje verzi RubyGem
rubygems.documentation=Další informace o registru RubyGems naleznete v dokumentaci.
+swift.registry=Nastavte tento registr z příkazového řádku:
vagrant.install=Pro přidání Vagrant box spusťte následující příkaz:
vagrant.documentation=Další informace o registru Vagrant naleznete v dokumentaci.
settings.link=Propojit tento balíček s repozitářem
diff --git a/options/locale/locale_de-DE.ini b/options/locale/locale_de-DE.ini
index 9bee2104e4d65..d195fe206cd8d 100644
--- a/options/locale/locale_de-DE.ini
+++ b/options/locale/locale_de-DE.ini
@@ -3122,6 +3122,7 @@ rubygems.dependencies.development=Entwicklungsabhängigkeiten
rubygems.required.ruby=Benötigt Ruby Version
rubygems.required.rubygems=Benötigt RubyGem Version
rubygems.documentation=Weitere Informationen zur RubyGems-Paketverwaltung findest du in der Dokumentation.
+swift.registry=Diese Registry über die Kommandozeile einrichten:
vagrant.install=Um eine Vagrant-Box hinzuzufügen, führen Sie folgenden Befehl aus:
vagrant.documentation=Für weitere Informationen zur Vagrant-Registry, siehe Dokumentation.
settings.link=Dieses Paket einem Repository zuweisen
diff --git a/options/locale/locale_el-GR.ini b/options/locale/locale_el-GR.ini
index 6affdf7e8be77..5fd330fa841f6 100644
--- a/options/locale/locale_el-GR.ini
+++ b/options/locale/locale_el-GR.ini
@@ -3155,6 +3155,7 @@ rubygems.dependencies.development=Εξαρτήσεις Ανάπτυξης
rubygems.required.ruby=Απαιτεί την έκδοση Ruby
rubygems.required.rubygems=Απαιτεί έκδοση RubyGem
rubygems.documentation=Για περισσότερες πληροφορίες σχετικά με το μητρώο RubyGems, ανατρέξτε στην τεκμηρίωση.
+swift.registry=Ρυθμίστε αυτό το μητρώο από τη γραμμή εντολών:
vagrant.install=Για προσθήκη ενός κυτίου Vagrant, εκτελέστε την ακόλουθη εντολή:
vagrant.documentation=Για περισσότερες πληροφορίες σχετικά με το μητρώο του Vagrant, ανατρέξτε στην τεκμηρίωση.
settings.link=Σύνδεση αυτού του πακέτου με ένα αποθετήριο
diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini
index e793c3ef03314..afcf9ade04da7 100644
--- a/options/locale/locale_en-US.ini
+++ b/options/locale/locale_en-US.ini
@@ -3360,5 +3360,7 @@ runs.open_tab = %d Open
runs.closed_tab = %d Closed
runs.commit = Commit
runs.pushed_by = Pushed by
+runs.valid_workflow_helper = Workflow config file is valid.
+runs.invalid_workflow_helper = Workflow config file is invalid. Please check your config file: %s
need_approval_desc = Need approval to run workflows for fork pull request.
diff --git a/options/locale/locale_es-ES.ini b/options/locale/locale_es-ES.ini
index f104d3c49d308..f67eb7ee9f984 100644
--- a/options/locale/locale_es-ES.ini
+++ b/options/locale/locale_es-ES.ini
@@ -3154,6 +3154,7 @@ rubygems.dependencies.development=Dependencias de desarrollo
rubygems.required.ruby=Requiere versión Ruby
rubygems.required.rubygems=Requiere la versión de RubyGem
rubygems.documentation=Para obtener más información sobre el registro de RubyGems, consulte la documentación.
+swift.registry=Configurar este registro desde la línea de comandos:
vagrant.install=Para añadir un paquete Vagrant, ejecuta el siguiente comando:
vagrant.documentation=Para más información sobre el registro de paquetes Vagrant, revisa la documentación.
settings.link=Vincular este paquete a un repositorio
diff --git a/options/locale/locale_it-IT.ini b/options/locale/locale_it-IT.ini
index d77baee6e502f..a4dfa501c5be3 100644
--- a/options/locale/locale_it-IT.ini
+++ b/options/locale/locale_it-IT.ini
@@ -3121,6 +3121,7 @@ rubygems.dependencies.development=Dipendenze Di Sviluppo
rubygems.required.ruby=Richiede la versione di Ruby
rubygems.required.rubygems=Richiede la versione RubyGem
rubygems.documentation=Per ulteriori informazioni sul registro di RubyGems, vedere la documentazione.
+swift.registry=Configura questo registro dalla riga di comando:
settings.link=Collega questo pacchetto a un repository
settings.link.description=Se si collega un pacchetto a un repository, il pacchetto è elencato nell'elenco dei pacchetti del repository.
settings.link.select=Seleziona Repository
diff --git a/options/locale/locale_ja-JP.ini b/options/locale/locale_ja-JP.ini
index 8e77329f5cc9b..c0ff33b1e7eb7 100644
--- a/options/locale/locale_ja-JP.ini
+++ b/options/locale/locale_ja-JP.ini
@@ -3232,6 +3232,7 @@ rubygems.dependencies.development=開発用依存関係
rubygems.required.ruby=必要なRubyバージョン
rubygems.required.rubygems=必要なRubyGemバージョン
rubygems.documentation=RubyGemsレジストリの詳細については、ドキュメント を参照してください。
+swift.registry=このレジストリをコマンドラインからセットアップします:
vagrant.install=Vagrant ボックスを追加するには、次のコマンドを実行します。
vagrant.documentation=Vagrantレジストリの詳細については ドキュメントを参照してください。
settings.link=このパッケージをリポジトリにリンク
diff --git a/options/locale/locale_lv-LV.ini b/options/locale/locale_lv-LV.ini
index 0f7862f8a3dee..2172c23f2152d 100644
--- a/options/locale/locale_lv-LV.ini
+++ b/options/locale/locale_lv-LV.ini
@@ -3329,6 +3329,7 @@ rubygems.dependencies.development=Izstrādes atkarības
rubygems.required.ruby=Nepieciešamā Ruby versija
rubygems.required.rubygems=Nepieciešamā RubyGem versija
rubygems.documentation=Papildus informācija par RubyGems reģistru pieejama dokumentācijā.
+swift.registry=Konfigurējiet šo reģistru no komandrindas:
vagrant.install=Lai pievienotu Vagrant kasti, izpildiet sekojošu komandu:
vagrant.documentation=Papildus informācija par Vagrant reģistru pieejama dokumentācijā.
settings.link=Piesaistīt pakotni šim repozitorijam
diff --git a/options/locale/locale_pt-BR.ini b/options/locale/locale_pt-BR.ini
index b34b5642dc741..5ec3e084bf7f4 100644
--- a/options/locale/locale_pt-BR.ini
+++ b/options/locale/locale_pt-BR.ini
@@ -3237,6 +3237,7 @@ rubygems.dependencies.development=Dependências de Desenvolvimento
rubygems.required.ruby=Requer o Ruby versão
rubygems.required.rubygems=Requer o RubyGem versão
rubygems.documentation=Para obter mais informações sobre o registro do RubyGems, consulte a documentação.
+swift.registry=Configure este registro pela linha de comando:
vagrant.install=Para adicionar uma Vagrant box, execute o seguinte comando:
vagrant.documentation=Para obter mais informações sobre o registro do Vagrant, consulte a documentação.
settings.link=Vincular este pacote a um repositório
diff --git a/options/locale/locale_pt-PT.ini b/options/locale/locale_pt-PT.ini
index ef7a400ec8b8c..ee36a0f4e64c6 100644
--- a/options/locale/locale_pt-PT.ini
+++ b/options/locale/locale_pt-PT.ini
@@ -1357,8 +1357,8 @@ issues.opened_by_fake=%[1]s aberta(s) por %[2]s
issues.closed_by_fake=por %[2]s foi fechada %[1]s
issues.previous=Anterior
issues.next=Seguinte
-issues.open_title=Aberta
-issues.closed_title=Fechada
+issues.open_title=aberta(s)
+issues.closed_title=fechada(s)
issues.draft_title=Rascunho
issues.num_comments=%d comentários
issues.commented_at=`comentou %s`
@@ -1780,7 +1780,7 @@ activity.title.issues_1=%d questão
activity.title.issues_n=%d questões
activity.title.issues_closed_from=%s resolvida(s) de %s
activity.title.issues_created_by=%s criada por %s
-activity.closed_issue_label=Encerrada
+activity.closed_issue_label=Fechada
activity.new_issues_count_1=questão nova
activity.new_issues_count_n=questões novas
activity.new_issue_label=Em aberto
@@ -2934,6 +2934,8 @@ config.git_disable_diff_highlight=Desabilitar o realce de sintaxe no diff
config.git_max_diff_lines=Número máximo de linhas diff (por ficheiro)
config.git_max_diff_line_characters=Número máximos de caracteres diff (por linha)
config.git_max_diff_files=Número máximo de ficheiros diff a serem apresentados
+config.git_enable_reflogs=Habilitar reflogs
+config.git_reflog_expiry_time=Tempo de expiração
config.git_gc_args=Argumentos da recolha de lixo
config.git_migrate_timeout=Prazo da migração
config.git_mirror_timeout=Prazo para sincronização da réplica
@@ -3237,6 +3239,10 @@ rubygems.dependencies.development=Dependências de desenvolvimento
rubygems.required.ruby=Requer a versão do Ruby
rubygems.required.rubygems=Requer a versão do RubyGem
rubygems.documentation=Para obter mais informações sobre o registo do RubyGems, consulte a documentação.
+swift.registry=Configurar este registo usando a linha de comandos:
+swift.install=Adicione o pacote no seu ficheiro Package.swift
:
+swift.install2=e execute o seguinte comando:
+swift.documentation=Para obter mais informações sobre o registo do Swift, consulte a documentação.
vagrant.install=Para adicionar uma máquina virtual Vagrant, execute o seguinte comando:
vagrant.documentation=Para obter mais informações sobre o registo do Vagrant, consulte a documentação.
settings.link=Vincular este pacote a um repositório
diff --git a/options/locale/locale_tr-TR.ini b/options/locale/locale_tr-TR.ini
index 131dfa69af192..ae5b42c7d8347 100644
--- a/options/locale/locale_tr-TR.ini
+++ b/options/locale/locale_tr-TR.ini
@@ -57,6 +57,7 @@ new_mirror=Yeni Yansı
new_fork=Yeni Depo Çatalı
new_org=Yeni Organizasyon
new_project=Yeni Proje
+new_project_column=Yeni Sütun
manage_org=Organizasyonları Yönet
admin_panel=Site Yönetimi
account_settings=Hesap Ayarları
@@ -90,9 +91,11 @@ disabled=Devre Dışı
copy=Kopyala
copy_url=URL'yi kopyala
+copy_content=İçeriği kopyala
copy_branch=Dal adını kopyala
copy_success=Kopyalandı!
copy_error=Kopyalama başarısız oldu
+copy_type_unsupported=Bu dosya türü kopyalanamaz
write=Yaz
preview=Önizleme
@@ -109,6 +112,10 @@ never=Asla
rss_feed=RSS Beslemesi
[aria]
+navbar=Gezinti Çubuğu
+footer=Alt Bilgi
+footer.software=Yazılım Hakkında
+footer.links=Bağlantılar
[filter]
string.asc=A - Z
@@ -240,7 +247,10 @@ default_enable_timetracking_popup=Yeni depolar için zaman takibini varsayılan
no_reply_address=Gizlenecek E-Posta Alan Adı
no_reply_address_helper=Gizlenmiş e-posta adresine sahip kullanıcılar için alan adı. Örneğin 'ali' kullanıcı adı, gizlenmiş e-postalar için alan adı 'yanityok.ornek.org' olarak ayarlandığında Git günlüğüne 'ali@yanityok.ornek.org' olarak kaydedilecektir.
password_algorithm=Parola Hash Algoritması
+invalid_password_algorithm=Hatalı parola hash algoritması
password_algorithm_helper=Parola için hash algoritmasını ayarlayın. Algoritmalar değişen gereksinimlere ve güce sahiptirler. `argon2` iyi özelliklere sahip olmasına rağmen fazla miktarda bellek kullanır ve küçük sistemler için uygun olmayabilir.
+enable_update_checker=Güncelleme Denetleyicisini Etkinleştir
+enable_update_checker_helper=Düzenli olarak gitea.io'ya bağlanarak yeni yayınlanan sürümleri denetler.
[home]
uname_holder=Kullanıcı Adı veya E-Posta Adresi
@@ -290,14 +300,36 @@ code_last_indexed_at=Son endekslenen %s
relevant_repositories_tooltip=Çatal olan veya konusu, simgesi veya açıklaması olmayan depolar gizlenmiştir.
relevant_repositories=`Sadece ilişkili depolar gösteriliyor, belgeye bakabilirsiniz.
+swift.registry=Bu kütüğü komut satırını kullanarak kurun:
vagrant.install=Vagrant paketi eklemek için aşağıdaki komutu çalıştırın:
vagrant.documentation=Vagrant kütüğü hakkında daha fazla bilgi için, belgeye bakabilirsiniz.
settings.link=Bu paketi bir depoya bağlayın
diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini
index aa4cc4dde9744..21836963f1ce4 100644
--- a/options/locale/locale_zh-CN.ini
+++ b/options/locale/locale_zh-CN.ini
@@ -3232,6 +3232,7 @@ rubygems.dependencies.development=开发依赖
rubygems.required.ruby=需要 Ruby 版本
rubygems.required.rubygems=需要 RubyGem 版本
rubygems.documentation=关于 RubyGems 注册中心的更多信息,请参阅 文档。
+swift.registry=从命令行设置此注册中心:
vagrant.install=若要添加一个 Vagrant box,请运行以下命令:
vagrant.documentation=关于 Vagrant 注册中心的更多信息,请参阅 文档。
settings.link=将此软件包链接到仓库
diff --git a/options/locale/locale_zh-TW.ini b/options/locale/locale_zh-TW.ini
index e98e55b77700d..5ef7b96dee482 100644
--- a/options/locale/locale_zh-TW.ini
+++ b/options/locale/locale_zh-TW.ini
@@ -3232,6 +3232,7 @@ rubygems.dependencies.development=開發相依性
rubygems.required.ruby=需要的 Ruby 版本
rubygems.required.rubygems=需要的 RubyGem 版本
rubygems.documentation=關於 RubyGems registry 的詳情請參閱說明文件。
+swift.registry=透過下列命令設定此註冊中心:
vagrant.install=執行下列命令以新增 Vagrant box:
vagrant.documentation=關於 Vagrant registry 的詳情請參閱說明文件。
settings.link=連結此套件到儲存庫
diff --git a/package-lock.json b/package-lock.json
index 7ec6d09d1996f..94b6e9c504829 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -28,8 +28,6 @@
"jquery": "3.6.3",
"jquery.are-you-sure": "1.9.0",
"katex": "0.16.4",
- "less": "4.1.3",
- "less-loader": "11.1.0",
"license-checker-webpack-plugin": "0.2.1",
"mermaid": "10.0.2",
"mini-css-extract-plugin": "2.7.2",
@@ -64,7 +62,6 @@
"eslint-plugin-vue": "9.9.0",
"jsdom": "21.0.0",
"markdownlint-cli": "0.33.0",
- "postcss-less": "6.0.0",
"stylelint": "15.2.0",
"stylelint-declaration-strict-value": "1.9.2",
"svgo": "3.0.2",
@@ -2667,6 +2664,9 @@
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-2.0.6.tgz",
"integrity": "sha512-1j20GZTsvKNkc4BY3NpMOM8tt///wY3FpIzozTOFO2ffuZcV61nojHXVKIy3WM+7ADCy5FVhdZYHYDdgTU0yJw==",
+ "dev": true,
+ "optional": true,
+ "peer": true,
"dependencies": {
"is-what": "^3.14.1"
},
@@ -3813,7 +3813,9 @@
"version": "0.1.8",
"resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz",
"integrity": "sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==",
+ "dev": true,
"optional": true,
+ "peer": true,
"dependencies": {
"prr": "~1.0.1"
},
@@ -5240,7 +5242,9 @@
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/image-size/-/image-size-0.5.5.tgz",
"integrity": "sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ==",
+ "dev": true,
"optional": true,
+ "peer": true,
"bin": {
"image-size": "bin/image-size.js"
},
@@ -5675,7 +5679,10 @@
"node_modules/is-what": {
"version": "3.14.1",
"resolved": "https://registry.npmjs.org/is-what/-/is-what-3.14.1.tgz",
- "integrity": "sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA=="
+ "integrity": "sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA==",
+ "dev": true,
+ "optional": true,
+ "peer": true
},
"node_modules/isarray": {
"version": "0.0.1",
@@ -5933,14 +5940,6 @@
"node": ">=0.10.0"
}
},
- "node_modules/klona": {
- "version": "2.0.6",
- "resolved": "https://registry.npmjs.org/klona/-/klona-2.0.6.tgz",
- "integrity": "sha512-dhG34DXATL5hSxJbIexCft8FChFXtmskoZYnoPWjXQuebWYCNkVeV3KkGegCK9CP1oswI/vQibS2GY7Em/sJJA==",
- "engines": {
- "node": ">= 8"
- }
- },
"node_modules/known-css-properties": {
"version": "0.26.0",
"resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.26.0.tgz",
@@ -5956,6 +5955,9 @@
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/less/-/less-4.1.3.tgz",
"integrity": "sha512-w16Xk/Ta9Hhyei0Gpz9m7VS8F28nieJaL/VyShID7cYvP6IL5oHeL6p4TXSDJqZE/lNv0oJ2pGVjJsRkfwm5FA==",
+ "dev": true,
+ "optional": true,
+ "peer": true,
"dependencies": {
"copy-anything": "^2.0.1",
"parse-node-version": "^1.0.1",
@@ -5977,25 +5979,6 @@
"source-map": "~0.6.0"
}
},
- "node_modules/less-loader": {
- "version": "11.1.0",
- "resolved": "https://registry.npmjs.org/less-loader/-/less-loader-11.1.0.tgz",
- "integrity": "sha512-C+uDBV7kS7W5fJlUjq5mPBeBVhYpTIm5gB09APT9o3n/ILeaXVsiSFTbZpTJCJwQ/Crczfn3DmfQFwxYusWFug==",
- "dependencies": {
- "klona": "^2.0.4"
- },
- "engines": {
- "node": ">= 14.15.0"
- },
- "funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/webpack"
- },
- "peerDependencies": {
- "less": "^3.5.0 || ^4.0.0",
- "webpack": "^5.0.0"
- }
- },
"node_modules/leven": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz",
@@ -6201,7 +6184,9 @@
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz",
"integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==",
+ "dev": true,
"optional": true,
+ "peer": true,
"dependencies": {
"pify": "^4.0.1",
"semver": "^5.6.0"
@@ -6214,7 +6199,9 @@
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
+ "dev": true,
"optional": true,
+ "peer": true,
"bin": {
"semver": "bin/semver"
}
@@ -6505,7 +6492,9 @@
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
+ "dev": true,
"optional": true,
+ "peer": true,
"bin": {
"mime": "cli.js"
},
@@ -6637,7 +6626,7 @@
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
- "devOptional": true
+ "dev": true
},
"node_modules/nanoid": {
"version": "3.3.4",
@@ -6660,7 +6649,9 @@
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/needle/-/needle-3.2.0.tgz",
"integrity": "sha512-oUvzXnyLiVyVGoianLijF9O/RecZUf7TkBfimjGrLM4eQhXyeJwM6GeAWccwfQ9aa4gMCZKqhAOuLaMIcQxajQ==",
+ "dev": true,
"optional": true,
+ "peer": true,
"dependencies": {
"debug": "^3.2.6",
"iconv-lite": "^0.6.3",
@@ -6677,7 +6668,9 @@
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
+ "dev": true,
"optional": true,
+ "peer": true,
"dependencies": {
"ms": "^2.1.1"
}
@@ -7047,6 +7040,9 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/parse-node-version/-/parse-node-version-1.0.1.tgz",
"integrity": "sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA==",
+ "dev": true,
+ "optional": true,
+ "peer": true,
"engines": {
"node": ">= 0.10"
}
@@ -7148,7 +7144,9 @@
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz",
"integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==",
+ "dev": true,
"optional": true,
+ "peer": true,
"engines": {
"node": ">=6"
}
@@ -7288,18 +7286,6 @@
"node": "^10 || ^12 || >=14"
}
},
- "node_modules/postcss-less": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/postcss-less/-/postcss-less-6.0.0.tgz",
- "integrity": "sha512-FPX16mQLyEjLzEuuJtxA8X3ejDLNGGEG503d2YGZR5Ask1SpDN8KmZUMpzCvyalWRywAn1n1VOA5dcqfCLo5rg==",
- "dev": true,
- "engines": {
- "node": ">=12"
- },
- "peerDependencies": {
- "postcss": "^8.3.5"
- }
- },
"node_modules/postcss-media-query-parser": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/postcss-media-query-parser/-/postcss-media-query-parser-0.2.3.tgz",
@@ -7481,7 +7467,9 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
"integrity": "sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==",
- "optional": true
+ "dev": true,
+ "optional": true,
+ "peer": true
},
"node_modules/psl": {
"version": "1.9.0",
@@ -7987,7 +7975,9 @@
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
- "optional": true
+ "dev": true,
+ "optional": true,
+ "peer": true
},
"node_modules/saxes": {
"version": "6.0.0",
@@ -8917,7 +8907,8 @@
"node_modules/tslib": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz",
- "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA=="
+ "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==",
+ "dev": true
},
"node_modules/type-check": {
"version": "0.4.0",
@@ -11852,6 +11843,9 @@
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/copy-anything/-/copy-anything-2.0.6.tgz",
"integrity": "sha512-1j20GZTsvKNkc4BY3NpMOM8tt///wY3FpIzozTOFO2ffuZcV61nojHXVKIy3WM+7ADCy5FVhdZYHYDdgTU0yJw==",
+ "dev": true,
+ "optional": true,
+ "peer": true,
"requires": {
"is-what": "^3.14.1"
}
@@ -12710,7 +12704,9 @@
"version": "0.1.8",
"resolved": "https://registry.npmjs.org/errno/-/errno-0.1.8.tgz",
"integrity": "sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A==",
+ "dev": true,
"optional": true,
+ "peer": true,
"requires": {
"prr": "~1.0.1"
}
@@ -13783,7 +13779,9 @@
"version": "0.5.5",
"resolved": "https://registry.npmjs.org/image-size/-/image-size-0.5.5.tgz",
"integrity": "sha512-6TDAlDPZxUFCv+fuOkIoXT/V/f3Qbq8e37p+YOiYrUv3v9cc3/6x78VdfPgFVaB9dZYeLUfKgHRebpkm/oP2VQ==",
- "optional": true
+ "dev": true,
+ "optional": true,
+ "peer": true
},
"immer": {
"version": "9.0.18",
@@ -14076,7 +14074,10 @@
"is-what": {
"version": "3.14.1",
"resolved": "https://registry.npmjs.org/is-what/-/is-what-3.14.1.tgz",
- "integrity": "sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA=="
+ "integrity": "sha512-sNxgpk9793nzSs7bA6JQJGeIuRBQhAaNGG77kzYQgMkrID+lS6SlK07K5LaptscDlSaIgH+GPFzf+d75FVxozA==",
+ "dev": true,
+ "optional": true,
+ "peer": true
},
"isarray": {
"version": "0.0.1",
@@ -14269,11 +14270,6 @@
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
"integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw=="
},
- "klona": {
- "version": "2.0.6",
- "resolved": "https://registry.npmjs.org/klona/-/klona-2.0.6.tgz",
- "integrity": "sha512-dhG34DXATL5hSxJbIexCft8FChFXtmskoZYnoPWjXQuebWYCNkVeV3KkGegCK9CP1oswI/vQibS2GY7Em/sJJA=="
- },
"known-css-properties": {
"version": "0.26.0",
"resolved": "https://registry.npmjs.org/known-css-properties/-/known-css-properties-0.26.0.tgz",
@@ -14289,6 +14285,9 @@
"version": "4.1.3",
"resolved": "https://registry.npmjs.org/less/-/less-4.1.3.tgz",
"integrity": "sha512-w16Xk/Ta9Hhyei0Gpz9m7VS8F28nieJaL/VyShID7cYvP6IL5oHeL6p4TXSDJqZE/lNv0oJ2pGVjJsRkfwm5FA==",
+ "dev": true,
+ "optional": true,
+ "peer": true,
"requires": {
"copy-anything": "^2.0.1",
"errno": "^0.1.1",
@@ -14302,14 +14301,6 @@
"tslib": "^2.3.0"
}
},
- "less-loader": {
- "version": "11.1.0",
- "resolved": "https://registry.npmjs.org/less-loader/-/less-loader-11.1.0.tgz",
- "integrity": "sha512-C+uDBV7kS7W5fJlUjq5mPBeBVhYpTIm5gB09APT9o3n/ILeaXVsiSFTbZpTJCJwQ/Crczfn3DmfQFwxYusWFug==",
- "requires": {
- "klona": "^2.0.4"
- }
- },
"leven": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz",
@@ -14484,7 +14475,9 @@
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz",
"integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==",
+ "dev": true,
"optional": true,
+ "peer": true,
"requires": {
"pify": "^4.0.1",
"semver": "^5.6.0"
@@ -14494,7 +14487,9 @@
"version": "5.7.1",
"resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz",
"integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==",
- "optional": true
+ "dev": true,
+ "optional": true,
+ "peer": true
}
}
},
@@ -14721,7 +14716,9 @@
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
- "optional": true
+ "dev": true,
+ "optional": true,
+ "peer": true
},
"mime-db": {
"version": "1.52.0",
@@ -14817,7 +14814,7 @@
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
- "devOptional": true
+ "dev": true
},
"nanoid": {
"version": "3.3.4",
@@ -14834,7 +14831,9 @@
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/needle/-/needle-3.2.0.tgz",
"integrity": "sha512-oUvzXnyLiVyVGoianLijF9O/RecZUf7TkBfimjGrLM4eQhXyeJwM6GeAWccwfQ9aa4gMCZKqhAOuLaMIcQxajQ==",
+ "dev": true,
"optional": true,
+ "peer": true,
"requires": {
"debug": "^3.2.6",
"iconv-lite": "^0.6.3",
@@ -14845,7 +14844,9 @@
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz",
"integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==",
+ "dev": true,
"optional": true,
+ "peer": true,
"requires": {
"ms": "^2.1.1"
}
@@ -15127,7 +15128,10 @@
"parse-node-version": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/parse-node-version/-/parse-node-version-1.0.1.tgz",
- "integrity": "sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA=="
+ "integrity": "sha512-3YHlOa/JgH6Mnpr05jP9eDG254US9ek25LyIxZlDItp2iJtwyaXQb57lBYLdT3MowkUFYEV2XXNAYIPlESvJlA==",
+ "dev": true,
+ "optional": true,
+ "peer": true
},
"parse5": {
"version": "7.1.2",
@@ -15198,7 +15202,9 @@
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz",
"integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==",
- "optional": true
+ "dev": true,
+ "optional": true,
+ "peer": true
},
"pkg-dir": {
"version": "4.2.0",
@@ -15296,13 +15302,6 @@
"source-map-js": "^1.0.2"
}
},
- "postcss-less": {
- "version": "6.0.0",
- "resolved": "https://registry.npmjs.org/postcss-less/-/postcss-less-6.0.0.tgz",
- "integrity": "sha512-FPX16mQLyEjLzEuuJtxA8X3ejDLNGGEG503d2YGZR5Ask1SpDN8KmZUMpzCvyalWRywAn1n1VOA5dcqfCLo5rg==",
- "dev": true,
- "requires": {}
- },
"postcss-media-query-parser": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/postcss-media-query-parser/-/postcss-media-query-parser-0.2.3.tgz",
@@ -15433,7 +15432,9 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz",
"integrity": "sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==",
- "optional": true
+ "dev": true,
+ "optional": true,
+ "peer": true
},
"psl": {
"version": "1.9.0",
@@ -15792,7 +15793,9 @@
"version": "1.2.4",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
- "optional": true
+ "dev": true,
+ "optional": true,
+ "peer": true
},
"saxes": {
"version": "6.0.0",
@@ -16527,7 +16530,8 @@
"tslib": {
"version": "2.4.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz",
- "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA=="
+ "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==",
+ "dev": true
},
"type-check": {
"version": "0.4.0",
diff --git a/package.json b/package.json
index c4457fe9708fa..f6e037ce455b5 100644
--- a/package.json
+++ b/package.json
@@ -28,8 +28,6 @@
"jquery": "3.6.3",
"jquery.are-you-sure": "1.9.0",
"katex": "0.16.4",
- "less": "4.1.3",
- "less-loader": "11.1.0",
"license-checker-webpack-plugin": "0.2.1",
"mermaid": "10.0.2",
"mini-css-extract-plugin": "2.7.2",
@@ -64,7 +62,6 @@
"eslint-plugin-vue": "9.9.0",
"jsdom": "21.0.0",
"markdownlint-cli": "0.33.0",
- "postcss-less": "6.0.0",
"stylelint": "15.2.0",
"stylelint-declaration-strict-value": "1.9.2",
"svgo": "3.0.2",
diff --git a/routers/api/v1/admin/email.go b/routers/api/v1/admin/email.go
new file mode 100644
index 0000000000000..8d0491e07024b
--- /dev/null
+++ b/routers/api/v1/admin/email.go
@@ -0,0 +1,87 @@
+// Copyright 2023 The Gitea Authors. All rights reserved.
+// SPDX-License-Identifier: MIT
+
+package admin
+
+import (
+ "net/http"
+
+ user_model "code.gitea.io/gitea/models/user"
+ "code.gitea.io/gitea/modules/context"
+ api "code.gitea.io/gitea/modules/structs"
+ "code.gitea.io/gitea/routers/api/v1/utils"
+ "code.gitea.io/gitea/services/convert"
+)
+
+// GetAllEmails
+func GetAllEmails(ctx *context.APIContext) {
+ // swagger:operation GET /admin/emails admin adminGetAllEmails
+ // ---
+ // summary: List all emails
+ // produces:
+ // - application/json
+ // parameters:
+ // - name: page
+ // in: query
+ // description: page number of results to return (1-based)
+ // type: integer
+ // - name: limit
+ // in: query
+ // description: page size of results
+ // type: integer
+ // responses:
+ // "200":
+ // "$ref": "#/responses/EmailList"
+ // "403":
+ // "$ref": "#/responses/forbidden"
+
+ listOptions := utils.GetListOptions(ctx)
+
+ emails, maxResults, err := user_model.SearchEmails(&user_model.SearchEmailOptions{
+ Keyword: ctx.Params(":email"),
+ ListOptions: listOptions,
+ })
+ if err != nil {
+ ctx.Error(http.StatusInternalServerError, "GetAllEmails", err)
+ return
+ }
+
+ results := make([]*api.Email, len(emails))
+ for i := range emails {
+ results[i] = convert.ToEmailSearch(emails[i])
+ }
+
+ ctx.SetLinkHeader(int(maxResults), listOptions.PageSize)
+ ctx.SetTotalCountHeader(maxResults)
+ ctx.JSON(http.StatusOK, &results)
+}
+
+// SearchEmail
+func SearchEmail(ctx *context.APIContext) {
+ // swagger:operation GET /admin/emails/search admin adminSearchEmails
+ // ---
+ // summary: Search all emails
+ // produces:
+ // - application/json
+ // parameters:
+ // - name: q
+ // in: query
+ // description: keyword
+ // type: string
+ // - name: page
+ // in: query
+ // description: page number of results to return (1-based)
+ // type: integer
+ // - name: limit
+ // in: query
+ // description: page size of results
+ // type: integer
+ // responses:
+ // "200":
+ // "$ref": "#/responses/EmailList"
+ // "403":
+ // "$ref": "#/responses/forbidden"
+
+ ctx.SetParams(":email", ctx.FormTrim("q"))
+ GetAllEmails(ctx)
+}
diff --git a/routers/api/v1/admin/user.go b/routers/api/v1/admin/user.go
index 4192d8654d7c4..369d13943a329 100644
--- a/routers/api/v1/admin/user.go
+++ b/routers/api/v1/admin/user.go
@@ -461,3 +461,61 @@ func GetAllUsers(ctx *context.APIContext) {
ctx.SetTotalCountHeader(maxResults)
ctx.JSON(http.StatusOK, &results)
}
+
+// RenameUser api for renaming a user
+func RenameUser(ctx *context.APIContext) {
+ // swagger:operation POST /admin/users/{username}/rename admin adminRenameUser
+ // ---
+ // summary: Rename a user
+ // produces:
+ // - application/json
+ // parameters:
+ // - name: username
+ // in: path
+ // description: existing username of user
+ // type: string
+ // required: true
+ // - name: body
+ // in: body
+ // required: true
+ // schema:
+ // "$ref": "#/definitions/RenameUserOption"
+ // responses:
+ // "204":
+ // "$ref": "#/responses/empty"
+ // "403":
+ // "$ref": "#/responses/forbidden"
+ // "422":
+ // "$ref": "#/responses/validationError"
+
+ if ctx.ContextUser.IsOrganization() {
+ ctx.Error(http.StatusUnprocessableEntity, "", fmt.Errorf("%s is an organization not a user", ctx.ContextUser.Name))
+ return
+ }
+
+ newName := web.GetForm(ctx).(*api.RenameUserOption).NewName
+
+ if strings.EqualFold(newName, ctx.ContextUser.Name) {
+ // Noop as username is not changed
+ ctx.Status(http.StatusNoContent)
+ return
+ }
+
+ // Check if user name has been changed
+ if err := user_service.RenameUser(ctx, ctx.ContextUser, newName); err != nil {
+ switch {
+ case user_model.IsErrUserAlreadyExist(err):
+ ctx.Error(http.StatusUnprocessableEntity, "", ctx.Tr("form.username_been_taken"))
+ case db.IsErrNameReserved(err):
+ ctx.Error(http.StatusUnprocessableEntity, "", ctx.Tr("user.form.name_reserved", newName))
+ case db.IsErrNamePatternNotAllowed(err):
+ ctx.Error(http.StatusUnprocessableEntity, "", ctx.Tr("user.form.name_pattern_not_allowed", newName))
+ case db.IsErrNameCharsNotAllowed(err):
+ ctx.Error(http.StatusUnprocessableEntity, "", ctx.Tr("user.form.name_chars_not_allowed", newName))
+ default:
+ ctx.ServerError("ChangeUserName", err)
+ }
+ return
+ }
+ ctx.Status(http.StatusNoContent)
+}
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go
index 735939a5517c9..5c32164fa7066 100644
--- a/routers/api/v1/api.go
+++ b/routers/api/v1/api.go
@@ -1257,8 +1257,13 @@ func Routes(ctx gocontext.Context) *web.Route {
m.Get("/orgs", org.ListUserOrgs)
m.Post("/orgs", bind(api.CreateOrgOption{}), admin.CreateOrg)
m.Post("/repos", bind(api.CreateRepoOption{}), admin.CreateRepo)
+ m.Post("/rename", bind(api.RenameUserOption{}), admin.RenameUser)
}, context_service.UserAssignmentAPI())
})
+ m.Group("/emails", func() {
+ m.Get("", admin.GetAllEmails)
+ m.Get("/search", admin.SearchEmail)
+ })
m.Group("/unadopted", func() {
m.Get("", admin.ListUnadoptedRepositories)
m.Post("/{username}/{reponame}", admin.AdoptRepository)
diff --git a/routers/api/v1/swagger/options.go b/routers/api/v1/swagger/options.go
index 979b18407590c..0c8d3d353feca 100644
--- a/routers/api/v1/swagger/options.go
+++ b/routers/api/v1/swagger/options.go
@@ -48,6 +48,9 @@ type swaggerParameterBodies struct {
// in:body
CreateKeyOption api.CreateKeyOption
+ // in:body
+ RenameUserOption api.RenameUserOption
+
// in:body
CreateLabelOption api.CreateLabelOption
// in:body
diff --git a/routers/web/org/setting.go b/routers/web/org/setting.go
index b57ebfbcda23a..654e9000fa1b5 100644
--- a/routers/web/org/setting.go
+++ b/routers/web/org/setting.go
@@ -79,7 +79,7 @@ func SettingsPost(ctx *context.Context) {
ctx.Data["OrgName"] = true
ctx.RenderWithErr(ctx.Tr("form.username_been_taken"), tplSettingsOptions, &form)
return
- } else if err = user_model.ChangeUserName(org.AsUser(), form.Name); err != nil {
+ } else if err = user_model.ChangeUserName(ctx, org.AsUser(), form.Name); err != nil {
switch {
case db.IsErrNameReserved(err):
ctx.Data["OrgName"] = true
diff --git a/routers/web/repo/actions/actions.go b/routers/web/repo/actions/actions.go
index 0e7a95ed073aa..dd2dc55bd5bcf 100644
--- a/routers/web/repo/actions/actions.go
+++ b/routers/web/repo/actions/actions.go
@@ -23,6 +23,12 @@ const (
tplViewActions base.TplName = "repo/actions/view"
)
+type Workflow struct {
+ Entry git.TreeEntry
+ IsInvalid bool
+ ErrMsg string
+}
+
// MustEnableActions check if actions are enabled in settings
func MustEnableActions(ctx *context.Context) {
if !setting.Actions.Enabled {
@@ -47,7 +53,7 @@ func List(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("actions.actions")
ctx.Data["PageIsActions"] = true
- var workflows git.Entries
+ var workflows []Workflow
if empty, err := ctx.Repo.GitRepo.IsEmpty(); err != nil {
ctx.Error(http.StatusInternalServerError, err.Error())
return
@@ -62,13 +68,27 @@ func List(ctx *context.Context) {
ctx.Error(http.StatusInternalServerError, err.Error())
return
}
- workflows, err = actions.ListWorkflows(commit)
+ entries, err := actions.ListWorkflows(commit)
if err != nil {
ctx.Error(http.StatusInternalServerError, err.Error())
return
}
+ workflows = make([]Workflow, 0, len(entries))
+ for _, entry := range entries {
+ workflow := Workflow{Entry: *entry}
+ content, err := actions.GetContentFromEntry(entry)
+ if err != nil {
+ ctx.Error(http.StatusInternalServerError, err.Error())
+ return
+ }
+ _, err = actions.GetEventsFromContent(content)
+ if err != nil {
+ workflow.IsInvalid = true
+ workflow.ErrMsg = err.Error()
+ }
+ workflows = append(workflows, workflow)
+ }
}
-
ctx.Data["workflows"] = workflows
ctx.Data["RepoLink"] = ctx.Repo.Repository.Link()
diff --git a/routers/web/repo/branch.go b/routers/web/repo/branch.go
index d23367e04790d..9f26634311125 100644
--- a/routers/web/repo/branch.go
+++ b/routers/web/repo/branch.go
@@ -8,6 +8,7 @@ import (
"errors"
"fmt"
"net/http"
+ "net/url"
"strings"
"code.gitea.io/gitea/models"
@@ -65,21 +66,17 @@ func Branches(ctx *context.Context) {
if page <= 1 {
page = 1
}
+ pageSize := setting.Git.BranchesRangeSize
- limit := ctx.FormInt("limit")
- if limit <= 0 || limit > setting.Git.BranchesRangeSize {
- limit = setting.Git.BranchesRangeSize
- }
-
- skip := (page - 1) * limit
- log.Debug("Branches: skip: %d limit: %d", skip, limit)
- defaultBranchBranch, branches, branchesCount := loadBranches(ctx, skip, limit)
+ skip := (page - 1) * pageSize
+ log.Debug("Branches: skip: %d limit: %d", skip, pageSize)
+ defaultBranchBranch, branches, branchesCount := loadBranches(ctx, skip, pageSize)
if ctx.Written() {
return
}
ctx.Data["Branches"] = branches
ctx.Data["DefaultBranchBranch"] = defaultBranchBranch
- pager := context.NewPagination(branchesCount, setting.Git.BranchesRangeSize, page, 5)
+ pager := context.NewPagination(branchesCount, pageSize, page, 5)
pager.SetDefaultParams(ctx)
ctx.Data["Page"] = pager
@@ -165,7 +162,7 @@ func RestoreBranchPost(ctx *context.Context) {
func redirect(ctx *context.Context) {
ctx.JSON(http.StatusOK, map[string]interface{}{
- "redirect": ctx.Repo.RepoLink + "/branches",
+ "redirect": ctx.Repo.RepoLink + "/branches?page=" + url.QueryEscape(ctx.FormString("page")),
})
}
diff --git a/routers/web/user/setting/profile.go b/routers/web/user/setting/profile.go
index f0f053a514e0b..f500be7632336 100644
--- a/routers/web/user/setting/profile.go
+++ b/routers/web/user/setting/profile.go
@@ -27,9 +27,7 @@ import (
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/modules/web"
"code.gitea.io/gitea/modules/web/middleware"
- "code.gitea.io/gitea/services/agit"
"code.gitea.io/gitea/services/forms"
- container_service "code.gitea.io/gitea/services/packages/container"
user_service "code.gitea.io/gitea/services/user"
)
@@ -57,45 +55,25 @@ func HandleUsernameChange(ctx *context.Context, user *user_model.User, newName s
return fmt.Errorf(ctx.Tr("form.username_change_not_local_user"))
}
- // Check if user name has been changed
- if user.LowerName != strings.ToLower(newName) {
- if err := user_model.ChangeUserName(user, newName); err != nil {
- switch {
- case user_model.IsErrUserAlreadyExist(err):
- ctx.Flash.Error(ctx.Tr("form.username_been_taken"))
- case user_model.IsErrEmailAlreadyUsed(err):
- ctx.Flash.Error(ctx.Tr("form.email_been_used"))
- case db.IsErrNameReserved(err):
- ctx.Flash.Error(ctx.Tr("user.form.name_reserved", newName))
- case db.IsErrNamePatternNotAllowed(err):
- ctx.Flash.Error(ctx.Tr("user.form.name_pattern_not_allowed", newName))
- case db.IsErrNameCharsNotAllowed(err):
- ctx.Flash.Error(ctx.Tr("user.form.name_chars_not_allowed", newName))
- default:
- ctx.ServerError("ChangeUserName", err)
- }
- return err
- }
- } else {
- if err := repo_model.UpdateRepositoryOwnerNames(user.ID, newName); err != nil {
- ctx.ServerError("UpdateRepository", err)
- return err
+ // rename user
+ if err := user_service.RenameUser(ctx, user, newName); err != nil {
+ switch {
+ case user_model.IsErrUserAlreadyExist(err):
+ ctx.Flash.Error(ctx.Tr("form.username_been_taken"))
+ case user_model.IsErrEmailAlreadyUsed(err):
+ ctx.Flash.Error(ctx.Tr("form.email_been_used"))
+ case db.IsErrNameReserved(err):
+ ctx.Flash.Error(ctx.Tr("user.form.name_reserved", newName))
+ case db.IsErrNamePatternNotAllowed(err):
+ ctx.Flash.Error(ctx.Tr("user.form.name_pattern_not_allowed", newName))
+ case db.IsErrNameCharsNotAllowed(err):
+ ctx.Flash.Error(ctx.Tr("user.form.name_chars_not_allowed", newName))
+ default:
+ ctx.ServerError("ChangeUserName", err)
}
- }
-
- // update all agit flow pull request header
- err := agit.UserNameChanged(user, newName)
- if err != nil {
- ctx.ServerError("agit.UserNameChanged", err)
- return err
- }
-
- if err := container_service.UpdateRepositoryNames(ctx, user, newName); err != nil {
- ctx.ServerError("UpdateRepositoryNames", err)
return err
}
- log.Trace("User name changed: %s -> %s", user.Name, newName)
return nil
}
diff --git a/services/agit/agit.go b/services/agit/agit.go
index b61cb6f3f5692..32fc3cba4a36e 100644
--- a/services/agit/agit.go
+++ b/services/agit/agit.go
@@ -226,8 +226,8 @@ func ProcReceive(ctx context.Context, repo *repo_model.Repository, gitRepo *git.
}
// UserNameChanged handle user name change for agit flow pull
-func UserNameChanged(user *user_model.User, newName string) error {
- pulls, err := issues_model.GetAllUnmergedAgitPullRequestByPoster(user.ID)
+func UserNameChanged(ctx context.Context, user *user_model.User, newName string) error {
+ pulls, err := issues_model.GetAllUnmergedAgitPullRequestByPoster(ctx, user.ID)
if err != nil {
return err
}
diff --git a/services/convert/convert.go b/services/convert/convert.go
index 5f2100a039409..bce0e7ba214b6 100644
--- a/services/convert/convert.go
+++ b/services/convert/convert.go
@@ -38,6 +38,17 @@ func ToEmail(email *user_model.EmailAddress) *api.Email {
}
}
+// ToEmail convert models.EmailAddress to api.Email
+func ToEmailSearch(email *user_model.SearchEmailResult) *api.Email {
+ return &api.Email{
+ Email: email.Email,
+ Verified: email.IsActivated,
+ Primary: email.IsPrimary,
+ UserID: email.UID,
+ UserName: email.Name,
+ }
+}
+
// ToBranch convert a git.Commit and git.Branch to an api.Branch
func ToBranch(ctx context.Context, repo *repo_model.Repository, b *git.Branch, c *git.Commit, bp *git_model.ProtectedBranch, user *user_model.User, isRepoAdmin bool) (*api.Branch, error) {
if bp == nil {
diff --git a/services/user/rename.go b/services/user/rename.go
new file mode 100644
index 0000000000000..af195d7d76a26
--- /dev/null
+++ b/services/user/rename.go
@@ -0,0 +1,41 @@
+// Copyright 2023 The Gitea Authors. All rights reserved.
+// SPDX-License-Identifier: MIT
+
+package user
+
+import (
+ "context"
+ "fmt"
+ "strings"
+
+ user_model "code.gitea.io/gitea/models/user"
+ "code.gitea.io/gitea/modules/log"
+ "code.gitea.io/gitea/services/agit"
+ container_service "code.gitea.io/gitea/services/packages/container"
+)
+
+func renameUser(ctx context.Context, u *user_model.User, newUserName string) error {
+ if u.IsOrganization() {
+ return fmt.Errorf("cannot rename organization")
+ }
+
+ if err := user_model.ChangeUserName(ctx, u, newUserName); err != nil {
+ return err
+ }
+
+ if err := agit.UserNameChanged(ctx, u, newUserName); err != nil {
+ return err
+ }
+ if err := container_service.UpdateRepositoryNames(ctx, u, newUserName); err != nil {
+ return err
+ }
+
+ u.Name = newUserName
+ u.LowerName = strings.ToLower(newUserName)
+ if err := user_model.UpdateUser(ctx, u, false); err != nil {
+ return err
+ }
+
+ log.Trace("User name changed: %s -> %s", u.Name, newUserName)
+ return nil
+}
diff --git a/services/user/user.go b/services/user/user.go
index f0b8fe1c3174b..d52a2f404bcf0 100644
--- a/services/user/user.go
+++ b/services/user/user.go
@@ -27,6 +27,22 @@ import (
"code.gitea.io/gitea/services/packages"
)
+// RenameUser renames a user
+func RenameUser(ctx context.Context, u *user_model.User, newUserName string) error {
+ ctx, committer, err := db.TxContext(ctx)
+ if err != nil {
+ return err
+ }
+ defer committer.Close()
+ if err := renameUser(ctx, u, newUserName); err != nil {
+ return err
+ }
+ if err := committer.Commit(); err != nil {
+ return err
+ }
+ return err
+}
+
// DeleteUser completely and permanently deletes everything of a user,
// but issues/comments/pulls will be kept and shown as someone has been deleted,
// unless the user is younger than USER_DELETE_WITH_COMMENTS_MAX_DAYS.
diff --git a/templates/code/searchresults.tmpl b/templates/code/searchresults.tmpl
index 74721a5a674dd..684e2860bff43 100644
--- a/templates/code/searchresults.tmpl
+++ b/templates/code/searchresults.tmpl
@@ -11,15 +11,15 @@
{{range $result := .SearchResults}}
{{$repo := (index $.RepoMaps .RepoID)}}