From 7740779b28e53cdf0a9780a39af71e3ee353e170 Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 14 Jul 2022 10:58:14 +0200 Subject: [PATCH 01/11] Fix versions check for busybox `sh` (#20358) `printf` in busybox emits a ugly 'invalid number' error when formatting string variables are present. Avoid that by reducing the go version check to just two digits, which ought to be enough as patch-level go versions are meant to be compatible. Avoid error on node-check as well. --- Makefile | 6 +++--- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 41d39b4c3232..5536788613c4 100644 --- a/Makefile +++ b/Makefile @@ -201,9 +201,9 @@ help: .PHONY: go-check go-check: - $(eval MIN_GO_VERSION_STR := $(shell grep -Eo '^go\s+[0-9]+\.[0-9.]+' go.mod | cut -d' ' -f2)) - $(eval MIN_GO_VERSION := $(shell printf "%03d%03d%03d" $(shell echo '$(MIN_GO_VERSION_STR)' | tr '.' ' '))) - $(eval GO_VERSION := $(shell printf "%03d%03d%03d" $(shell $(GO) version | grep -Eo '[0-9]+\.[0-9.]+' | tr '.' ' ');)) + $(eval MIN_GO_VERSION_STR := $(shell grep -Eo '^go\s+[0-9]+\.[0-9]+' go.mod | cut -d' ' -f2)) + $(eval MIN_GO_VERSION := $(shell printf "%03d%03d" $(shell echo '$(MIN_GO_VERSION_STR)' | tr '.' ' '))) + $(eval GO_VERSION := $(shell printf "%03d%03d" $(shell $(GO) version | grep -Eo '[0-9]+\.[0-9]+' | tr '.' ' ');)) @if [ "$(GO_VERSION)" -lt "$(MIN_GO_VERSION)" ]; then \ echo "Gitea requires Go $(MIN_GO_VERSION_STR) or greater to build. You can get it at https://go.dev/dl/"; \ exit 1; \ diff --git a/package-lock.json b/package-lock.json index 411a22037d12..5032e50fc525 100644 --- a/package-lock.json +++ b/package-lock.json @@ -61,7 +61,7 @@ "updates": "13.0.5" }, "engines": { - "node": ">= 14" + "node": ">= 14.0.0" } }, "node_modules/@ampproject/remapping": { diff --git a/package.json b/package.json index 1ec816fc569d..b55da05b3dec 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "private": true, "type": "module", "engines": { - "node": ">= 14" + "node": ">= 14.0.0" }, "dependencies": { "@claviska/jquery-minicolors": "2.3.6", From 725f9e40b36b510e734a95d83b0f1fd0a8f3ef86 Mon Sep 17 00:00:00 2001 From: Jeremy Date: Thu, 14 Jul 2022 23:15:35 +1200 Subject: [PATCH 02/11] Fix English mistakes in some Markdown documents (#20274) --- README.md | 16 ++--- README_ZH.md | 2 +- .../doc/installation/from-binary.en-us.md | 66 +++++++++++-------- docs/content/page/index.en-us.md | 13 ++-- 4 files changed, 55 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 6c5952894aca..09ee1291b65f 100644 --- a/README.md +++ b/README.md @@ -45,21 +45,21 @@

- View the chinese version of this document + View this document in Chinese

## Purpose The goal of this project is to make the easiest, fastest, and most painless way of setting up a self-hosted Git service. -Using Go, this can be done with an independent binary distribution across -**all platforms** which Go supports, including Linux, macOS, and Windows -on x86, amd64, ARM and PowerPC architectures. -Want to try it before doing anything else? -Do it [with the online demo](https://try.gitea.io/)! + +As Gitea is written in Go, it works across **all** the platforms and +architectures that are supported by Go, including Linux, macOS, and +Windows on x86, amd64, ARM and PowerPC architectures. +You can try it out using [the online demo](https://try.gitea.io/). This project has been [forked](https://blog.gitea.io/2016/12/welcome-to-gitea/) from -[Gogs](https://gogs.io) since 2016.11 but changed a lot. +[Gogs](https://gogs.io) since November of 2016, but a lot has changed. ## Building @@ -114,7 +114,7 @@ For more information and instructions about how to install Gitea, please look at If you have questions that are not covered by the documentation, you can get in contact with us on our [Discord server](https://discord.gg/Gitea) or create a post in the [discourse forum](https://discourse.gitea.io/). We maintain a list of Gitea-related projects at [gitea/awesome-gitea](https://gitea.com/gitea/awesome-gitea). -The hugo-based documentation theme is hosted at [gitea/theme](https://gitea.com/gitea/theme). +The Hugo-based documentation theme is hosted at [gitea/theme](https://gitea.com/gitea/theme). The official Gitea CLI is developed at [gitea/tea](https://gitea.com/gitea/tea). ## Authors diff --git a/README_ZH.md b/README_ZH.md index 904b3a4fb637..2be35742672f 100644 --- a/README_ZH.md +++ b/README_ZH.md @@ -45,7 +45,7 @@

- View the english version of this document + View this document in English

## 目标 diff --git a/docs/content/doc/installation/from-binary.en-us.md b/docs/content/doc/installation/from-binary.en-us.md index d3486d815099..c598317b6ec0 100644 --- a/docs/content/doc/installation/from-binary.en-us.md +++ b/docs/content/doc/installation/from-binary.en-us.md @@ -24,7 +24,7 @@ embedded assets. This can be different for older releases. ## Download -Choose the file matching the destination platform from the [downloads page](https://dl.gitea.io/gitea/), copy the URL and replace the URL within the commands below: +Choose the file matching your platform from the [downloads page](https://dl.gitea.io/gitea/), copy the URL and replace the URL within the commands below: ```sh wget -O gitea https://dl.gitea.io/gitea/{{< version >}}/gitea-{{< version >}}-linux-amd64 @@ -56,7 +56,8 @@ Check that Git is installed on the server. If it is not, install it first. Gitea git --version ``` -Create user to run Gitea (ex. `git`) +Create a user to run Gitea (e.g. `git`) + ```sh adduser \ --system \ @@ -79,29 +80,39 @@ chown root:git /etc/gitea chmod 770 /etc/gitea ``` -**NOTE:** `/etc/gitea` is temporary set with write rights for user `git` so that Web installer could write configuration file. After installation is done, it is recommended to set rights to read-only using: -``` +**NOTE:** `/etc/gitea` is temporarily set with write permissions for user `git` so that the web installer can write the configuration file. After the installation is finished, it is recommended to set permissions to read-only using: + +```sh chmod 750 /etc/gitea chmod 640 /etc/gitea/app.ini ``` -If you don't want the web installer to be able to write the config file at all, it is also possible to make the config file read-only for the Gitea user (owner/group `root:git`, mode `0640`), and set `INSTALL_LOCK = true`. In that case all database configuration details must be set beforehand in the config file, as well as the `SECRET_KEY` and `INTERNAL_TOKEN` values. See the [command line documentation]({{< relref "doc/usage/command-line.en-us.md" >}}) for information on using `gitea generate secret INTERNAL_TOKEN`. + +If you don't want the web installer to be able to write to the config file, it is possible to make the config file read-only for the Gitea user (owner/group `root:git`, mode `0640`) however you will need to edit your config file manually to: + + * Set `INSTALL_LOCK= true`, + * Ensure all database configuration details are set correctly + * Ensure that the `SECRET_KEY` and `INTERNAL_TOKEN` values are set. (You may want to use the `gitea generate secret` to generate these secret keys.) + * Ensure that any other secret keys you need are set. + +See the [command line documentation]({{< relref "doc/usage/command-line.en-us.md" >}}) for information on using `gitea generate secret`. ### Configure Gitea's working directory -**NOTE:** If you plan on running Gitea as a Linux service, you can skip this step as the service file allows you to set `WorkingDirectory`. Otherwise, consider setting this environment variable (semi-)permanently so that Gitea consistently uses the correct working directory. -``` +**NOTE:** If you plan on running Gitea as a Linux service, you can skip this step, as the service file allows you to set `WorkingDirectory`. Otherwise, consider setting this environment variable (semi-)permanently so that Gitea consistently uses the correct working directory. + +```sh export GITEA_WORK_DIR=/var/lib/gitea/ ``` -### Copy Gitea binary to global location +### Copy the Gitea binary to a global location -``` +```sh cp gitea /usr/local/bin/gitea ``` ## Running Gitea -After the above steps, two options to run Gitea are: +After you complete the above steps, you can run Gitea two ways: ### 1. Creating a service file to start Gitea automatically (recommended) @@ -109,32 +120,31 @@ See how to create [Linux service]({{< relref "run-as-service-in-ubuntu.en-us.md" ### 2. Running from command-line/terminal -``` +```sh GITEA_WORK_DIR=/var/lib/gitea/ /usr/local/bin/gitea web -c /etc/gitea/app.ini ``` ## Updating to a new version You can update to a new version of Gitea by stopping Gitea, replacing the binary at `/usr/local/bin/gitea` and restarting the instance. -The binary file name should not be changed during the update to avoid problems -in existing repositories. +The binary file name should not be changed during the update to avoid problems in existing repositories. -It is recommended you do a [backup]({{< relref "doc/usage/backup-and-restore.en-us.md" >}}) before updating your installation. +It is recommended that you make a [backup]({{< relref "doc/usage/backup-and-restore.en-us.md" >}}) before updating your installation. If you have carried out the installation steps as described above, the binary should have the generic name `gitea`. Do not change this, i.e. to include the version number. ### 1. Restarting Gitea with systemd (recommended) -As explained before, we recommend to use systemd as service manager. In this case ```systemctl restart gitea``` should be enough. +As we explained before, we recommend to use systemd as the service manager. In this case, `systemctl restart gitea` should be fine. ### 2. Restarting Gitea without systemd -To restart your Gitea instance, we recommend to use SIGHUP signal. If you know your Gitea PID use ```kill -1 $GITEA_PID``` otherwise you can use ```killall -1 gitea``` or ```pkill -1 gitea``` +To restart your Gitea instance, we recommend to use SIGHUP signal. If you know your Gitea PID, use `kill -1 $GITEA_PID`, otherwise you can use `killall -1 gitea`. -To gracefully stop the Gitea instance, a simple ```kill $GITEA_PID``` or ```killall gitea``` is enough. +To gracefully stop the Gitea instance, a simple `kill $GITEA_PID` or `killall gitea` is enough. -**NOTE:** We don't recommend to use SIGKILL signal (know also as `-9`), you may be forcefully stopping some of Gitea internal tasks and it will not gracefully stop (tasks in queues, indexers processes, etc.) +**NOTE:** We don't recommend to use the SIGKILL signal (`-9`); you may be forcefully stopping some of Gitea's internal tasks, and it will not gracefully stop (tasks in queues, indexers, etc.) See below for troubleshooting instructions to repair broken repositories after an update of your Gitea version. @@ -144,31 +154,31 @@ an update of your Gitea version. ### Old glibc versions Older Linux distributions (such as Debian 7 and CentOS 6) may not be able to load the -Gitea binary, usually producing an error such as ```./gitea: /lib/x86_64-linux-gnu/libc.so.6: -version `GLIBC\_2.14' not found (required by ./gitea)```. This is due to the integrated +Gitea binary, usually producing an error such as `./gitea: /lib/x86_64-linux-gnu/libc.so.6: +version 'GLIBC\_2.14' not found (required by ./gitea)`. This is due to the integrated SQLite support in the binaries provided by dl.gitea.io. In this situation, it is usually -possible to [install from source]({{< relref "from-source.en-us.md" >}}) without SQLite -support. +possible to [install from source]({{< relref "from-source.en-us.md" >}}), without including +SQLite support. ### Running Gitea on another port For errors like `702 runWeb()] [E] Failed to start server: listen tcp 0.0.0.0:3000: -bind: address already in use` Gitea needs to be started on another free port. This +bind: address already in use`, Gitea needs to be started on another free port. This is possible using `./gitea web -p $PORT`. It's possible another instance of Gitea is already running. ### Running Gitea on Raspbian -As of v1.8, there is a problem with the arm7 version of Gitea and it doesn't run on Raspberry Pi and similar devices. +As of v1.8, there is a problem with the arm7 version of Gitea, and it doesn't run on Raspberry Pis and similar devices. -It is therefore recommended to switch to the arm6 version which has been tested and shown to work on Raspberry Pi and similar devices. +It is recommended to switch to the arm6 version, which has been tested and shown to work on Raspberry Pis and similar devices. ### Git error after updating to a new version of Gitea -If the binary file name has been changed during the update to a new version of Gitea, +If during the update, the binary file name has been changed to a new version of Gitea, Git Hooks in existing repositories will not work any more. In that case, a Git error will be displayed when pushing to the repository. @@ -181,9 +191,9 @@ binary. To solve this, go to the admin options and run the task `Resynchronize pre-receive, update and post-receive hooks of all repositories` to update all hooks to contain -the new binary path. Please note that this overwrite all Git Hooks including ones +the new binary path. Please note that this overwrites all Git Hooks, including ones with customizations made. -If you aren't using the built-in to Gitea SSH server you will also need to re-write +If you aren't using the Gitea built-in SSH server, you will also need to re-write the authorized key file by running the `Update the '.ssh/authorized_keys' file with Gitea SSH keys.` task in the admin options. diff --git a/docs/content/page/index.en-us.md b/docs/content/page/index.en-us.md index c3a43cd029db..f9da78df510d 100644 --- a/docs/content/page/index.en-us.md +++ b/docs/content/page/index.en-us.md @@ -17,9 +17,12 @@ blog post to read about the justification for a fork. ## Purpose The goal of this project is to provide the easiest, fastest, and most painless way of setting -up a self-hosted Git service. With Go, this can be done with an independent binary distribution -across all platforms and architectures that Go supports. This support includes Linux, macOS, and -Windows, on architectures like amd64, i386, ARM, PowerPC, and others. +up a self-hosted Git service. + +With Go, this can be done platform-independently across +**all platforms** which Go supports, including Linux, macOS, and Windows, +on x86, amd64, ARM and PowerPC architectures. +You can try it out using [the online demo](https://try.gitea.io/). ## Features @@ -268,8 +271,8 @@ Windows, on architectures like amd64, i386, ARM, PowerPC, and others. - Gitea should be run with a dedicated non-root system account on UNIX-type systems. - Note: Gitea manages the `~/.ssh/authorized_keys` file. Running Gitea as a regular user could break that user's ability to log in. - [Git](https://git-scm.com/) version 2.0.0 or later is required. - - [Git Large File Storage](https://git-lfs.github.com/) will be available if enabled when Git >= 2.1.2. - - Git commit-graph rendering will be enabled automatically when Git >= 2.18. + - [Git Large File Storage](https://git-lfs.github.com/) will be available if enabled and if your Git version is >= 2.1.2 + - Git commit-graph rendering will be enabled automatically if your Git version is >= 2.18 ## Browser Support From f85bb6f70bb390ec04a296827ac0f2a078741a80 Mon Sep 17 00:00:00 2001 From: a1012112796 <1012112796@qq.com> Date: Thu, 14 Jul 2022 21:52:18 +0800 Subject: [PATCH 03/11] Make sure `repo_dir` is an empty directory or doesn't exist before 'dump-repo' (#20205) --- cmd/dump_repo.go | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/cmd/dump_repo.go b/cmd/dump_repo.go index c9d24c6c8367..72456c61d339 100644 --- a/cmd/dump_repo.go +++ b/cmd/dump_repo.go @@ -7,6 +7,8 @@ package cmd import ( "context" "errors" + "fmt" + "os" "strings" "code.gitea.io/gitea/modules/convert" @@ -15,6 +17,7 @@ import ( base "code.gitea.io/gitea/modules/migration" "code.gitea.io/gitea/modules/setting" "code.gitea.io/gitea/modules/structs" + "code.gitea.io/gitea/modules/util" "code.gitea.io/gitea/services/migrations" "github.com/urfave/cli" @@ -159,9 +162,23 @@ func runDumpRepository(ctx *cli.Context) error { } } + // the repo_dir will be removed if error occurs in DumpRepository + // make sure the directory doesn't exist or is empty, prevent from deleting user files + repoDir := ctx.String("repo_dir") + if exists, err := util.IsExist(repoDir); err != nil { + return fmt.Errorf("unable to stat repo_dir %q: %v", repoDir, err) + } else if exists { + if isDir, _ := util.IsDir(repoDir); !isDir { + return fmt.Errorf("repo_dir %q already exists but it's not a directory", repoDir) + } + if dir, _ := os.ReadDir(repoDir); len(dir) > 0 { + return fmt.Errorf("repo_dir %q is not empty", repoDir) + } + } + if err := migrations.DumpRepository( context.Background(), - ctx.String("repo_dir"), + repoDir, ctx.String("owner_name"), opts, ); err != nil { From 931c02d1521b7b990f70a590c691b066dbc27d4d Mon Sep 17 00:00:00 2001 From: Tyrone Yeh Date: Fri, 15 Jul 2022 00:00:10 +0800 Subject: [PATCH 04/11] Add order by for assignee no sort issue (#20053) Co-authored-by: wxiaoguang --- models/issues/issue_list.go | 2 +- models/organization/team_repo.go | 1 + models/repo/user_repo.go | 4 ++-- models/user/user.go | 7 +++++++ 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/models/issues/issue_list.go b/models/issues/issue_list.go index 20e9949b6620..e311e80b1d66 100644 --- a/models/issues/issue_list.go +++ b/models/issues/issue_list.go @@ -242,7 +242,7 @@ func (issues IssueList) loadAssignees(ctx context.Context) error { } rows, err := db.GetEngine(ctx).Table("issue_assignees"). Join("INNER", "`user`", "`user`.id = `issue_assignees`.assignee_id"). - In("`issue_assignees`.issue_id", issueIDs[:limit]). + In("`issue_assignees`.issue_id", issueIDs[:limit]).OrderBy(user_model.GetOrderByName()). Rows(new(AssigneeIssue)) if err != nil { return err diff --git a/models/organization/team_repo.go b/models/organization/team_repo.go index fb3f267f817a..3ac4fa926b83 100644 --- a/models/organization/team_repo.go +++ b/models/organization/team_repo.go @@ -81,5 +81,6 @@ func GetTeamsWithAccessToRepo(ctx context.Context, orgID, repoID int64, mode per Join("INNER", "team_repo", "team_repo.team_id = team.id"). And("team_repo.org_id = ?", orgID). And("team_repo.repo_id = ?", repoID). + OrderBy("name"). Find(&teams) } diff --git a/models/repo/user_repo.go b/models/repo/user_repo.go index e697505b81e4..71e0c57550c5 100644 --- a/models/repo/user_repo.go +++ b/models/repo/user_repo.go @@ -109,7 +109,7 @@ func GetRepoAssignees(ctx context.Context, repo *Repository) (_ []*user_model.Us // and just waste 1 unit is cheaper than re-allocate memory once. users := make([]*user_model.User, 0, len(userIDs)+1) if len(userIDs) > 0 { - if err = e.In("id", userIDs).Find(&users); err != nil { + if err = e.In("id", userIDs).OrderBy(user_model.GetOrderByName()).Find(&users); err != nil { return nil, err } } @@ -168,5 +168,5 @@ func GetReviewers(ctx context.Context, repo *Repository, doerID, posterID int64) } users := make([]*user_model.User, 0, 8) - return users, db.GetEngine(ctx).Where(cond).OrderBy("name").Find(&users) + return users, db.GetEngine(ctx).Where(cond).OrderBy(user_model.GetOrderByName()).Find(&users) } diff --git a/models/user/user.go b/models/user/user.go index 125c643f3ee8..fbd8df947247 100644 --- a/models/user/user.go +++ b/models/user/user.go @@ -1314,3 +1314,10 @@ func IsUserVisibleToViewer(ctx context.Context, u, viewer *User) bool { } return false } + +func GetOrderByName() string { + if setting.UI.DefaultShowFullName { + return "full_name, name" + } + return "name" +} From 181814952779c92942d296647852a5a3aa394c79 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Thu, 14 Jul 2022 20:40:30 +0200 Subject: [PATCH 05/11] update xorm.io/xorm v1.3.2-0.20220714055524-c3bce556200f (#20371) Xorm 1.3.2-0.20220714055524 contains a fix for interpreting db column sizes. Prior to this fix xorm would assume that the size of a column was within the range of an `int`. This is correct on 64bit machines where `int` is typical equivalent to `int64` however, on 32bit machines `int` tends to be `int32`. Unfortunately the size of a LONGTEXT field is actually `max_uint32`, thus using `strconv.Atoi` on these fields will fail and thus #20161 occurs on 32 bit arm. Xorm 1.3.2-0.20220714055524 changes this field to use int64 instead. Fix #20161 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 026c5723c38d..78495cc6a252 100644 --- a/go.mod +++ b/go.mod @@ -104,7 +104,7 @@ require ( mvdan.cc/xurls/v2 v2.4.0 strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251 xorm.io/builder v0.3.11 - xorm.io/xorm v1.3.1 + xorm.io/xorm v1.3.2-0.20220714055524-c3bce556200f ) require ( diff --git a/go.sum b/go.sum index 103206980776..dca68d9a8e7d 100644 --- a/go.sum +++ b/go.sum @@ -2423,5 +2423,5 @@ strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251/go.mod h1: xorm.io/builder v0.3.11-0.20220531020008-1bd24a7dc978/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE= xorm.io/builder v0.3.11 h1:naLkJitGyYW7ZZdncsh/JW+HF4HshmvTHTyUyPwJS00= xorm.io/builder v0.3.11/go.mod h1:aUW0S9eb9VCaPohFCH3j7czOx1PMW3i1HrSzbLYGBSE= -xorm.io/xorm v1.3.1 h1:z5egKrDoOLqZFhMjcGF4FBHiTmE5/feQoHclfhNidfM= -xorm.io/xorm v1.3.1/go.mod h1:9NbjqdnjX6eyjRRhh01GHm64r6N9shTb/8Ak3YRt8Nw= +xorm.io/xorm v1.3.2-0.20220714055524-c3bce556200f h1:3NvNsM4lnttTsHpk8ODHqrwN1MCEjsO3bD/rpd8A47k= +xorm.io/xorm v1.3.2-0.20220714055524-c3bce556200f/go.mod h1:9NbjqdnjX6eyjRRhh01GHm64r6N9shTb/8Ak3YRt8Nw= From 4ddae2c1b51b48dc9e0d548b40e186bc1391a4e7 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Fri, 15 Jul 2022 00:20:57 +0000 Subject: [PATCH 06/11] [skip ci] Updated translations via Crowdin --- options/locale/locale_cs-CZ.ini | 1 - options/locale/locale_de-DE.ini | 1 - options/locale/locale_el-GR.ini | 1 - options/locale/locale_es-ES.ini | 1 - options/locale/locale_fa-IR.ini | 1 - options/locale/locale_fr-FR.ini | 1 - options/locale/locale_ja-JP.ini | 1 - options/locale/locale_lv-LV.ini | 1 - options/locale/locale_pl-PL.ini | 1 - options/locale/locale_pt-BR.ini | 11 ++++++++++- options/locale/locale_pt-PT.ini | 3 ++- options/locale/locale_ru-RU.ini | 1 - options/locale/locale_si-LK.ini | 1 - options/locale/locale_tr-TR.ini | 1 - options/locale/locale_uk-UA.ini | 1 - options/locale/locale_zh-CN.ini | 1 - options/locale/locale_zh-TW.ini | 4 +++- 17 files changed, 15 insertions(+), 17 deletions(-) diff --git a/options/locale/locale_cs-CZ.ini b/options/locale/locale_cs-CZ.ini index 4cdc4d987449..06f62cf50c7b 100644 --- a/options/locale/locale_cs-CZ.ini +++ b/options/locale/locale_cs-CZ.ini @@ -1461,7 +1461,6 @@ pulls.remove_prefix=Odstranit prefix %s pulls.data_broken=Tento požadavek na natažení je rozbitý kvůli chybějícím informacím o rozštěpení. pulls.files_conflicted=Tento požadavek na natažení obsahuje změny, které kolidují s cílovou větví. pulls.is_checking=Právě probíhá kontrola konfliktů při sloučení. Zkuste to za chvíli. -pulls.is_empty=Tato větev je stejná jako cílová větev. pulls.required_status_check_failed=Některé požadované kontroly nebyly úspěšné. pulls.required_status_check_missing=Některé požadované kontroly chybí. pulls.required_status_check_administrator=Jako administrátor stále můžete sloučit tento požadavek na natažení. diff --git a/options/locale/locale_de-DE.ini b/options/locale/locale_de-DE.ini index 496c4e6d9899..917c14bb9c3e 100644 --- a/options/locale/locale_de-DE.ini +++ b/options/locale/locale_de-DE.ini @@ -1528,7 +1528,6 @@ pulls.remove_prefix=%s Präfix entfernen pulls.data_broken=Dieser Pull-Requests ist kaputt, da Fork-Informationen gelöscht wurden. pulls.files_conflicted=Dieser Pull-Request hat Änderungen, die im Widerspruch zum Ziel-Branch stehen. pulls.is_checking=Die Konfliktprüfung läuft noch. Bitte aktualisiere die Seite in wenigen Augenblicken. -pulls.is_empty=Dieser Branch ist gleich mit dem Zielbranch. pulls.required_status_check_failed=Einige erforderliche Prüfungen waren nicht erfolgreich. pulls.required_status_check_missing=Einige erforderliche Prüfungen fehlen. pulls.required_status_check_administrator=Als Administrator kannst du diesen Pull-Request weiterhin zusammenführen. diff --git a/options/locale/locale_el-GR.ini b/options/locale/locale_el-GR.ini index 21b2d4a5b3c6..65b3d736a8d4 100644 --- a/options/locale/locale_el-GR.ini +++ b/options/locale/locale_el-GR.ini @@ -1528,7 +1528,6 @@ pulls.remove_prefix=Αφαίρεση %s προθέματος pulls.data_broken=Αυτό το pull request είναι κατεστραμμένο λόγω των πληροφοριών του fork που λείπουν. pulls.files_conflicted=Αυτό το pull request περιέχει αλλαγές που συγκρούονται με το κλάδο προορισμού. pulls.is_checking=Ο έλεγχος συγκρούσεων κατά την συγχώνευση είναι σε εξέλιξη. Δοκιμάστε ξανά σε λίγα λεπτά. -pulls.is_empty=Αυτός ο κλάδος είναι ίσος με τον κλάδο-στόχο. pulls.required_status_check_failed=Ορισμένοι απαιτούμενοι έλεγχοι δεν ήταν επιτυχείς. pulls.required_status_check_missing=Λείπουν ορισμένοι απαιτούμενοι έλεγχοι. pulls.required_status_check_administrator=Ως διαχειριστής, μπορείτε ακόμα να συγχωνεύσετε αυτό το pull request. diff --git a/options/locale/locale_es-ES.ini b/options/locale/locale_es-ES.ini index 724d35467044..bacf2a427e4d 100644 --- a/options/locale/locale_es-ES.ini +++ b/options/locale/locale_es-ES.ini @@ -1530,7 +1530,6 @@ pulls.remove_prefix=Eliminar prefijo %s pulls.data_broken=Este pull request está rota debido a que falta información del fork. pulls.files_conflicted=Este pull request tiene cambios en conflicto con la rama de destino. pulls.is_checking=La comprobación de conflicto de fusión está en progreso. Inténtalo de nuevo en unos momentos. -pulls.is_empty=Esta rama es igual a la rama objetivo. pulls.required_status_check_failed=Algunos controles requeridos no han tenido éxito. pulls.required_status_check_missing=Faltan algunos controles necesarios. pulls.required_status_check_administrator=Como administrador, aún puede fusionar este Pull Request. diff --git a/options/locale/locale_fa-IR.ini b/options/locale/locale_fa-IR.ini index c7488cf0e91a..ae62a8c8fd71 100644 --- a/options/locale/locale_fa-IR.ini +++ b/options/locale/locale_fa-IR.ini @@ -1410,7 +1410,6 @@ pulls.remove_prefix=حذف پیشوند %s pulls.data_broken=این تقاضای واکشی به دلیل از دست رفتن اطلاعات انشعاب با شکست مواجه شد. pulls.files_conflicted=این تقاضای واکشی دارای تغییراتی است که با شاخه هدف تداخل دارد. pulls.is_checking=در حال پردازش تداخل در ادغام می‌باشد. لطفاً لحظاتی بعد امتحان کنید. -pulls.is_empty=این شاخه با شاخه مقصد برابر است. pulls.required_status_check_failed=برخی بررسی های ضروری موفقیت آمیز نبود. pulls.required_status_check_missing=برخی بررسی های موردنیاز از قلم افتاده است. pulls.required_status_check_administrator=مثل یک مدیر، ممکن است شما این تقاضای واکشی را مسکوت بگذارید. diff --git a/options/locale/locale_fr-FR.ini b/options/locale/locale_fr-FR.ini index 396ad2900b93..9fbdec862ce4 100644 --- a/options/locale/locale_fr-FR.ini +++ b/options/locale/locale_fr-FR.ini @@ -1404,7 +1404,6 @@ pulls.remove_prefix=Enlever le préfixe %s pulls.data_broken=Cette demande de fusion est impossible par manque d'informations de bifurcation. pulls.files_conflicted=Cette demande d'ajout contient des modifications en conflit avec la branche ciblée. pulls.is_checking=Vérification des conflits de fusion en cours. Réessayez dans quelques instants. -pulls.is_empty=Cette branche est identique à la branche cible. pulls.required_status_check_failed=Certains contrôles requis n'ont pas réussi. pulls.required_status_check_missing=Certains contrôles requis sont manquants. pulls.required_status_check_administrator=En tant qu'administrateur, vous pouvez toujours fusionner cette requête de pull. diff --git a/options/locale/locale_ja-JP.ini b/options/locale/locale_ja-JP.ini index 748715f4364c..e760b6b7737c 100644 --- a/options/locale/locale_ja-JP.ini +++ b/options/locale/locale_ja-JP.ini @@ -1532,7 +1532,6 @@ pulls.remove_prefix=先頭の %s を除去 pulls.data_broken=このプルリクエストは、フォークの情報が見つからないため壊れています。 pulls.files_conflicted=このプルリクエストは、ターゲットブランチと競合する変更を含んでいます。 pulls.is_checking=マージのコンフリクトを確認中です。 少し待ってからもう一度実行してください。 -pulls.is_empty=このブランチの内容はターゲットブランチと同じです。 pulls.required_status_check_failed=いくつかの必要なステータスチェックが成功していません。 pulls.required_status_check_missing=必要なステータスチェックが見つかりません。 pulls.required_status_check_administrator=管理者であるため、このプルリクエストをマージすることは可能です。 diff --git a/options/locale/locale_lv-LV.ini b/options/locale/locale_lv-LV.ini index b87202e2b670..0b09167a0cda 100644 --- a/options/locale/locale_lv-LV.ini +++ b/options/locale/locale_lv-LV.ini @@ -1528,7 +1528,6 @@ pulls.remove_prefix=Noņemt %s prefiksu pulls.data_broken=Izmaiņu pieprasījums ir bojāts, jo dzēsta informācija no atdalītā repozitorija. pulls.files_conflicted=Šīs izmaiņu pieprasījuma izmaiņas konfliktē ar mērķa atzaru. pulls.is_checking=Notiek konfliktu pārbaude, mirkli uzgaidiet un atjaunojiet lapu. -pulls.is_empty=Šis atzars ir vienāds ar mērķa atzaru. pulls.required_status_check_failed=Dažas no pārbaudēm nebija veiksmīgas. pulls.required_status_check_missing=Trūkst dažu obligāto pārbaužu. pulls.required_status_check_administrator=Kā administrators Jūs varat sapludināt šo izmaiņu pieprasījumu. diff --git a/options/locale/locale_pl-PL.ini b/options/locale/locale_pl-PL.ini index 3b65957bf5a9..8843dd4c2667 100644 --- a/options/locale/locale_pl-PL.ini +++ b/options/locale/locale_pl-PL.ini @@ -1388,7 +1388,6 @@ pulls.remove_prefix=Usuń %s prefiks pulls.data_broken=Ten Pull Request jest uszkodzony ze względu na brakujące informacje o forku. pulls.files_conflicted=Ten Pull Request zawiera zmiany konfliktujące z docelową gałęzią. pulls.is_checking=Sprawdzanie konfliktów ze scalaniem w toku. Spróbuj ponownie za chwilę. -pulls.is_empty=Ten branch jest równy z docelowym branch'em. pulls.required_status_check_failed=Niektóre kontrole stanów nie były pomyślne. pulls.required_status_check_missing=Brakuje pewnych wymaganych etapów. pulls.required_status_check_administrator=Jako administrator, możesz wciąż scalić ten Pull Request. diff --git a/options/locale/locale_pt-BR.ini b/options/locale/locale_pt-BR.ini index 3bf98901acf4..660b0a240a25 100644 --- a/options/locale/locale_pt-BR.ini +++ b/options/locale/locale_pt-BR.ini @@ -862,6 +862,7 @@ default_branch_helper=O branch padrão é o branch base para pull requests e com mirror_prune=Varrer mirror_prune_desc=Remover referências obsoletas de controle remoto mirror_interval_invalid=O intervalo do espelhamento não é válido. +mirror_sync_on_commit=Sincronizar quando commits forem enviados mirror_address=Clonar de URL mirror_address_desc=Coloque todas as credenciais necessárias na seção de autorização. mirror_address_url_invalid=A url fornecida é inválida. Você deve escapar todos os componentes da url corretamente. @@ -930,6 +931,7 @@ form.name_pattern_not_allowed=O padrão de '%s' não é permitido em um nome de need_auth=Autorização migrate_options=Opções de Migração migrate_service=Serviço de Migração +migrate_options_mirror_helper=Este repositório será um espelho migrate_options_lfs=Migrar arquivos LFS migrate_options_lfs_endpoint.label=Destino LFS migrate_options_lfs_endpoint.description=A migração tentará usar seu controle remoto Git para determinar o servidor LFS. Você também pode especificar um destino personalizado se os dados do repositório LFS forem armazenados em outro lugar. @@ -1300,6 +1302,7 @@ issues.previous=Anterior issues.next=Próximo issues.open_title=Aberto issues.closed_title=Fechado +issues.draft_title=Rascunho issues.num_comments=%d comentários issues.commented_at=`comentou %s` issues.delete_comment_confirm=Tem certeza que deseja excluir este comentário? @@ -1490,6 +1493,7 @@ pulls.new=Novo pull request pulls.view=Ver Pull Request pulls.compare_changes=Novo pull request pulls.allow_edits_from_maintainers=Permitir edições de mantenedores +pulls.allow_edits_from_maintainers_desc=Usuários com acesso de gravação para o branch base também podem fazer push para este branch pulls.allow_edits_from_maintainers_err=Falha na atualização pulls.compare_changes_desc=Selecione o branch de destino (push) e o branch de origem (pull) para o merge. pulls.has_viewed_file=Visto @@ -1527,7 +1531,6 @@ pulls.remove_prefix=Remover o prefixo %s pulls.data_broken=Este pull request está quebrado devido a falta de informação do fork. pulls.files_conflicted=Este pull request tem alterações conflitantes com o branch de destino. pulls.is_checking=Verificação de conflitos do merge está em andamento. Tente novamente em alguns momentos. -pulls.is_empty=Este branch é igual ao branch de destino. pulls.required_status_check_failed=Algumas verificações necessárias não foram bem sucedidas. pulls.required_status_check_missing=Estão faltando algumas verificações necessárias. pulls.required_status_check_administrator=Como administrador, você ainda pode aplicar o merge deste pull request. @@ -1595,9 +1598,13 @@ pulls.merge_instruction_step1_desc=No repositório do seu projeto, crie um novo pulls.merge_instruction_step2_desc=Faça merge das alterações e atualize no Gitea. pulls.auto_merge_button_when_succeed=(Quando a verificação for bem-sucedida) +pulls.auto_merge_newly_scheduled=O merge do pull request foi agendado para quando todas as verificações forem bem-sucedidas. +pulls.auto_merge_cancel_schedule=Cancelar merge automático +pulls.delete.title=Excluir este pull request? +pulls.delete.text=Você realmente deseja excluir este pull request? (Isto irá remover permanentemente todo o conteúdo. Considere fechá-la em vez disso, se você pretende mantê-la arquivado) milestones.new=Novo marco milestones.closed=Fechado %s @@ -2268,6 +2275,8 @@ topic.done=Feito topic.count_prompt=Você não pode selecionar mais de 25 tópicos topic.format_prompt=Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres. +find_file.go_to_file=Ir para arquivo +find_file.no_matching=Nenhum arquivo correspondente encontrado error.csv.too_large=Não é possível renderizar este arquivo porque ele é muito grande. error.csv.unexpected=Não é possível renderizar este arquivo porque ele contém um caractere inesperado na linha %d e coluna %d. diff --git a/options/locale/locale_pt-PT.ini b/options/locale/locale_pt-PT.ini index 176537129ccc..f84a72381ee5 100644 --- a/options/locale/locale_pt-PT.ini +++ b/options/locale/locale_pt-PT.ini @@ -1532,7 +1532,8 @@ pulls.remove_prefix=Remover o prefixo %s pulls.data_broken=Este pedido de integração está danificado devido à falta de informação da derivação. pulls.files_conflicted=Este pedido de integração contém modificações que entram em conflito com o ramo de destino. pulls.is_checking=Está em andamento uma verificação de conflitos na integração. Tente novamente daqui a alguns momentos. -pulls.is_empty=Este ramo é igual ao ramo de destino. +pulls.is_ancestor=Este ramo já está incluído no ramo de destino. Não há nada a integrar. +pulls.is_empty=As modificações feitas neste ramo já existem no ramo de destino. Este cometimento ficará vazio. pulls.required_status_check_failed=Algumas das verificações obrigatórias não foram bem sucedidas. pulls.required_status_check_missing=Estão faltando algumas verificações necessárias. pulls.required_status_check_administrator=Uma vez que é administrador, ainda pode realizar a integração deste pedido. diff --git a/options/locale/locale_ru-RU.ini b/options/locale/locale_ru-RU.ini index 555959b5124c..135eed89bdd1 100644 --- a/options/locale/locale_ru-RU.ini +++ b/options/locale/locale_ru-RU.ini @@ -1480,7 +1480,6 @@ pulls.remove_prefix=Удалить %s префикс pulls.data_broken=Содержимое этого запроса было нарушено вследствие удаления информации форка. pulls.files_conflicted=Этот запрос на слияние имеет изменения конфликтующие с целевой веткой. pulls.is_checking=Продолжается проверка конфликтов, пожалуйста обновите страницу несколько позже. -pulls.is_empty=Ветвь идентична с целевой. pulls.required_status_check_failed=Некоторые необходимые проверки не были пройдены. pulls.required_status_check_missing=Отсутствуют некоторые обязательные проверки. pulls.required_status_check_administrator=Как администратор, вы все равно можете принять этот запрос на слияние. diff --git a/options/locale/locale_si-LK.ini b/options/locale/locale_si-LK.ini index be82918627dc..426cbf73dc43 100644 --- a/options/locale/locale_si-LK.ini +++ b/options/locale/locale_si-LK.ini @@ -1355,7 +1355,6 @@ pulls.remove_prefix=%s උපසර්ගය ඉවත් ක pulls.data_broken=අතුරුදහන් වූ දෙබලක තොරතුරු හේතුවෙන් මෙම අදින්න ඉල්ලීම කැඩී ඇත. pulls.files_conflicted=මෙම අදින්න ඉල්ලීම ඉලක්කගත ශාඛාව සමග එකිනෙකට වෙනස් වෙනස්කම් ඇත. pulls.is_checking=ගැටුම් පරීක්ෂා කිරීම ඒකාබද්ධ කිරීම ක්රියාත්මක වෙමින් පවතී. සුළු මොහොතකින් නැවත උත්සාහ කරන්න. -pulls.is_empty=මෙම ශාඛාව ඉලක්කගත ශාඛාව සමග සමාන වේ. pulls.required_status_check_failed=සමහර අවශ්ය චෙක්පත් සාර්ථක නොවීය. pulls.required_status_check_missing=සමහර අවශ්ය චෙක්පත් අස්ථානගත වී ඇත. pulls.required_status_check_administrator=පරිපාලකයෙකු ලෙස, ඔබ තවමත් මෙම අදින්න ඉල්ලීම ඒකාබද්ධ කළ හැකිය. diff --git a/options/locale/locale_tr-TR.ini b/options/locale/locale_tr-TR.ini index 6d3e03c2461a..b302209121e8 100644 --- a/options/locale/locale_tr-TR.ini +++ b/options/locale/locale_tr-TR.ini @@ -1369,7 +1369,6 @@ pulls.remove_prefix=%s ön ekini kaldır pulls.data_broken=Bu değişiklik isteği, çatallama bilgilerinin eksik olması nedeniyle bozuldu. pulls.files_conflicted=Bu değişiklik isteğinde, hedef dalla çakışan değişiklikler var. pulls.is_checking=Birleştirme çakışması denetimi devam ediyor. Birkaç dakika sonra tekrar deneyin. -pulls.is_empty=Bu dal, hedef dalla eşittir. pulls.required_status_check_failed=Bazı gerekli denetimler başarılı olmadı. pulls.required_status_check_missing=Gerekli bazı kontroller eksik. pulls.required_status_check_administrator=Yönetici olarak, bu değişiklik isteğini yine de birleştirebilirsiniz. diff --git a/options/locale/locale_uk-UA.ini b/options/locale/locale_uk-UA.ini index 460ab2192cc2..f9e47f4a80b8 100644 --- a/options/locale/locale_uk-UA.ini +++ b/options/locale/locale_uk-UA.ini @@ -1418,7 +1418,6 @@ pulls.remove_prefix=Видалити префікс %s pulls.data_broken=Зміст цього запиту було порушено внаслідок видалення інформації Форком. Цей запит тягнеться через відсутність інформації про вилучення. pulls.files_conflicted=Цей запит має зміни, що конфліктують з цільовою гілкою. pulls.is_checking=Триває перевірка конфліктів, будь ласка обновіть сторінку дещо пізніше. -pulls.is_empty=Ця гілка ідентична з цільовою гілкою. pulls.required_status_check_failed=Деякі необхідні перевірки виконані з помилками. pulls.required_status_check_missing=Декілька з необхідних перевірок відсутні. pulls.required_status_check_administrator=Як адміністратор ви все одно можете об'єднати цей запит на злиття. diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index eec7c0ba596e..bccf5d7e3780 100644 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -1531,7 +1531,6 @@ pulls.remove_prefix=删除 %s 前缀 pulls.data_broken=此合并请求因为派生仓库信息缺失而中断。 pulls.files_conflicted=此合并请求有变更与目标分支冲突。 pulls.is_checking=正在进行合并冲突检测,请稍后再试。 -pulls.is_empty=此分支与目标分支相同。 pulls.required_status_check_failed=一些必要的检查没有成功 pulls.required_status_check_missing=缺少一些必要的检查。 pulls.required_status_check_administrator=作为管理员,您仍可合并此合并请求 diff --git a/options/locale/locale_zh-TW.ini b/options/locale/locale_zh-TW.ini index 3dcd5ecd0401..10e6418be07f 100644 --- a/options/locale/locale_zh-TW.ini +++ b/options/locale/locale_zh-TW.ini @@ -861,7 +861,9 @@ default_branch=預設分支 default_branch_helper=預設分支是合併請求和提交程式碼的基礎分支。 mirror_prune=裁減 mirror_prune_desc=刪除過時的遠端追蹤參考 +mirror_interval=鏡像間隔 (有效時間單位為 'h'、'm'、's'),設為 0 以停用定期同步。(最小間隔: %s) mirror_interval_invalid=鏡像週期無效 +mirror_sync_on_commit=推送提交後進行同步 mirror_address=從 URL Clone mirror_address_desc=在授權資訊中填入必要的資料。 mirror_address_url_invalid=提供的網址無效。請檢查您輸入的網址是否正確。 @@ -1300,6 +1302,7 @@ issues.previous=上一頁 issues.next=下一頁 issues.open_title=開放中 issues.closed_title=已關閉 +issues.draft_title=草稿 issues.num_comments=%d 則留言 issues.commented_at=`已留言 %s` issues.delete_comment_confirm=您確定要刪除這則留言嗎? @@ -1528,7 +1531,6 @@ pulls.remove_prefix=移除 %s 前綴 pulls.data_broken=此合併請求已損毀,因為遺失 Fork 資訊。 pulls.files_conflicted=此合併請求有變更和目標分支衝突。 pulls.is_checking=正在進行合併衝突檢查,請稍後再試。 -pulls.is_empty=此分支與目標分支相同。 pulls.required_status_check_failed=未通過某些必要的檢查。 pulls.required_status_check_missing=遺失某些必要的檢查。 pulls.required_status_check_administrator=身為系統管理員,您依然可以進行合併。 From edd945bca386929a0d0e5cfbc5fe1b225d64dd71 Mon Sep 17 00:00:00 2001 From: Gusted Date: Fri, 15 Jul 2022 06:38:10 +0000 Subject: [PATCH 07/11] Allow to specify colors for text in markup (#20363) `Hello World!` will now be accepted by Bluemonday, other properties are still disallowed by Bluemonday. --- modules/markup/sanitizer.go | 6 ++++++ modules/markup/sanitizer_test.go | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/modules/markup/sanitizer.go b/modules/markup/sanitizer.go index 388af567123d..57e88fdabc81 100644 --- a/modules/markup/sanitizer.go +++ b/modules/markup/sanitizer.go @@ -85,6 +85,12 @@ func createDefaultPolicy() *bluemonday.Policy { // Allow icons, emojis, chroma syntax and keyword markup on span policy.AllowAttrs("class").Matching(regexp.MustCompile(`^((icon(\s+[\p{L}\p{N}_-]+)+)|(emoji))$|^([a-z][a-z0-9]{0,2})$|^` + keywordClass + `$`)).OnElements("span") + // Allow 'style' attribute on text elements. + policy.AllowAttrs("style").OnElements("span", "p") + + // Allow 'color' property for the style attribute on text elements. + policy.AllowStyles("color").OnElements("span", "p") + // Allow generally safe attributes generalSafeAttrs := []string{ "abbr", "accept", "accept-charset", diff --git a/modules/markup/sanitizer_test.go b/modules/markup/sanitizer_test.go index 7dfca7a468db..b3b07404b451 100644 --- a/modules/markup/sanitizer_test.go +++ b/modules/markup/sanitizer_test.go @@ -45,6 +45,14 @@ func Test_Sanitizer(t *testing.T) { `unchecked`, `unchecked`, `NAUGHTY`, `NAUGHTY`, `contents`, `contents`, + + // Color property + `Hello World`, `Hello World`, + `

Hello World

`, `

Hello World

`, + `Hello World`, `Hello World`, + `Hello World`, `Hello World`, + `

Hello World

`, `

Hello World

`, + `Hello World`, `Hello World`, } for i := 0; i < len(testCases); i += 2 { From e49ef56dde11e87ec5d43a001dfe59c57b21441c Mon Sep 17 00:00:00 2001 From: Bian Jiaping Date: Fri, 15 Jul 2022 16:00:01 +0800 Subject: [PATCH 08/11] Add allow_rebase_update, default_delete_branch_after_merge to repository api response (#20079) `PATCH /repos/{owner}/{repo}` API allows users to update `allow_rebase_update`, `default_delete_branch_after_merge`, but `GET /repos/{owner}/{repo}` API does not return these two options, and API users has no other ways to find the state of these two options. This PR add `allow_rebase_update`, `default_delete_branch_after_merge` to repository query api response. --- modules/convert/repository.go | 102 +++++++++++++++++---------------- modules/structs/repo.go | 38 ++++++------ templates/swagger/v1_json.tmpl | 8 +++ 3 files changed, 82 insertions(+), 66 deletions(-) diff --git a/modules/convert/repository.go b/modules/convert/repository.go index eb6bb3770739..d333c124b54c 100644 --- a/modules/convert/repository.go +++ b/modules/convert/repository.go @@ -78,6 +78,8 @@ func innerToRepo(repo *repo_model.Repository, mode perm.AccessMode, isParent boo allowRebase := false allowRebaseMerge := false allowSquash := false + allowRebaseUpdate := false + defaultDeleteBranchAfterMerge := false defaultMergeStyle := repo_model.MergeStyleMerge if unit, err := repo.GetUnit(unit_model.TypePullRequests); err == nil { config := unit.PullRequestsConfig() @@ -87,6 +89,8 @@ func innerToRepo(repo *repo_model.Repository, mode perm.AccessMode, isParent boo allowRebase = config.AllowRebase allowRebaseMerge = config.AllowRebaseMerge allowSquash = config.AllowSquash + allowRebaseUpdate = config.AllowRebaseUpdate + defaultDeleteBranchAfterMerge = config.DefaultDeleteBranchAfterMerge defaultMergeStyle = config.GetDefaultMergeStyle() } hasProjects := false @@ -133,54 +137,56 @@ func innerToRepo(repo *repo_model.Repository, mode perm.AccessMode, isParent boo repoAPIURL := repo.APIURL() return &api.Repository{ - ID: repo.ID, - Owner: ToUserWithAccessMode(repo.Owner, mode), - Name: repo.Name, - FullName: repo.FullName(), - Description: repo.Description, - Private: repo.IsPrivate, - Template: repo.IsTemplate, - Empty: repo.IsEmpty, - Archived: repo.IsArchived, - Size: int(repo.Size / 1024), - Fork: repo.IsFork, - Parent: parent, - Mirror: repo.IsMirror, - HTMLURL: repo.HTMLURL(), - SSHURL: cloneLink.SSH, - CloneURL: cloneLink.HTTPS, - OriginalURL: repo.SanitizedOriginalURL(), - Website: repo.Website, - Language: language, - LanguagesURL: repoAPIURL + "/languages", - Stars: repo.NumStars, - Forks: repo.NumForks, - Watchers: repo.NumWatches, - OpenIssues: repo.NumOpenIssues, - OpenPulls: repo.NumOpenPulls, - Releases: int(numReleases), - DefaultBranch: repo.DefaultBranch, - Created: repo.CreatedUnix.AsTime(), - Updated: repo.UpdatedUnix.AsTime(), - Permissions: permission, - HasIssues: hasIssues, - ExternalTracker: externalTracker, - InternalTracker: internalTracker, - HasWiki: hasWiki, - HasProjects: hasProjects, - ExternalWiki: externalWiki, - HasPullRequests: hasPullRequests, - IgnoreWhitespaceConflicts: ignoreWhitespaceConflicts, - AllowMerge: allowMerge, - AllowRebase: allowRebase, - AllowRebaseMerge: allowRebaseMerge, - AllowSquash: allowSquash, - DefaultMergeStyle: string(defaultMergeStyle), - AvatarURL: repo.AvatarLink(), - Internal: !repo.IsPrivate && repo.Owner.Visibility == api.VisibleTypePrivate, - MirrorInterval: mirrorInterval, - MirrorUpdated: mirrorUpdated, - RepoTransfer: transfer, + ID: repo.ID, + Owner: ToUserWithAccessMode(repo.Owner, mode), + Name: repo.Name, + FullName: repo.FullName(), + Description: repo.Description, + Private: repo.IsPrivate, + Template: repo.IsTemplate, + Empty: repo.IsEmpty, + Archived: repo.IsArchived, + Size: int(repo.Size / 1024), + Fork: repo.IsFork, + Parent: parent, + Mirror: repo.IsMirror, + HTMLURL: repo.HTMLURL(), + SSHURL: cloneLink.SSH, + CloneURL: cloneLink.HTTPS, + OriginalURL: repo.SanitizedOriginalURL(), + Website: repo.Website, + Language: language, + LanguagesURL: repoAPIURL + "/languages", + Stars: repo.NumStars, + Forks: repo.NumForks, + Watchers: repo.NumWatches, + OpenIssues: repo.NumOpenIssues, + OpenPulls: repo.NumOpenPulls, + Releases: int(numReleases), + DefaultBranch: repo.DefaultBranch, + Created: repo.CreatedUnix.AsTime(), + Updated: repo.UpdatedUnix.AsTime(), + Permissions: permission, + HasIssues: hasIssues, + ExternalTracker: externalTracker, + InternalTracker: internalTracker, + HasWiki: hasWiki, + HasProjects: hasProjects, + ExternalWiki: externalWiki, + HasPullRequests: hasPullRequests, + IgnoreWhitespaceConflicts: ignoreWhitespaceConflicts, + AllowMerge: allowMerge, + AllowRebase: allowRebase, + AllowRebaseMerge: allowRebaseMerge, + AllowSquash: allowSquash, + AllowRebaseUpdate: allowRebaseUpdate, + DefaultDeleteBranchAfterMerge: defaultDeleteBranchAfterMerge, + DefaultMergeStyle: string(defaultMergeStyle), + AvatarURL: repo.AvatarLink(), + Internal: !repo.IsPrivate && repo.Owner.Visibility == api.VisibleTypePrivate, + MirrorInterval: mirrorInterval, + MirrorUpdated: mirrorUpdated, + RepoTransfer: transfer, } } diff --git a/modules/structs/repo.go b/modules/structs/repo.go index ef247ebc9ce3..6a5736898d13 100644 --- a/modules/structs/repo.go +++ b/modules/structs/repo.go @@ -77,24 +77,26 @@ type Repository struct { // swagger:strfmt date-time Created time.Time `json:"created_at"` // swagger:strfmt date-time - Updated time.Time `json:"updated_at"` - Permissions *Permission `json:"permissions,omitempty"` - HasIssues bool `json:"has_issues"` - InternalTracker *InternalTracker `json:"internal_tracker,omitempty"` - ExternalTracker *ExternalTracker `json:"external_tracker,omitempty"` - HasWiki bool `json:"has_wiki"` - ExternalWiki *ExternalWiki `json:"external_wiki,omitempty"` - HasPullRequests bool `json:"has_pull_requests"` - HasProjects bool `json:"has_projects"` - IgnoreWhitespaceConflicts bool `json:"ignore_whitespace_conflicts"` - AllowMerge bool `json:"allow_merge_commits"` - AllowRebase bool `json:"allow_rebase"` - AllowRebaseMerge bool `json:"allow_rebase_explicit"` - AllowSquash bool `json:"allow_squash_merge"` - DefaultMergeStyle string `json:"default_merge_style"` - AvatarURL string `json:"avatar_url"` - Internal bool `json:"internal"` - MirrorInterval string `json:"mirror_interval"` + Updated time.Time `json:"updated_at"` + Permissions *Permission `json:"permissions,omitempty"` + HasIssues bool `json:"has_issues"` + InternalTracker *InternalTracker `json:"internal_tracker,omitempty"` + ExternalTracker *ExternalTracker `json:"external_tracker,omitempty"` + HasWiki bool `json:"has_wiki"` + ExternalWiki *ExternalWiki `json:"external_wiki,omitempty"` + HasPullRequests bool `json:"has_pull_requests"` + HasProjects bool `json:"has_projects"` + IgnoreWhitespaceConflicts bool `json:"ignore_whitespace_conflicts"` + AllowMerge bool `json:"allow_merge_commits"` + AllowRebase bool `json:"allow_rebase"` + AllowRebaseMerge bool `json:"allow_rebase_explicit"` + AllowSquash bool `json:"allow_squash_merge"` + AllowRebaseUpdate bool `json:"allow_rebase_update"` + DefaultDeleteBranchAfterMerge bool `json:"default_delete_branch_after_merge"` + DefaultMergeStyle string `json:"default_merge_style"` + AvatarURL string `json:"avatar_url"` + Internal bool `json:"internal"` + MirrorInterval string `json:"mirror_interval"` // swagger:strfmt date-time MirrorUpdated time.Time `json:"mirror_updated,omitempty"` RepoTransfer *RepoTransfer `json:"repo_transfer"` diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 39c5026b77ad..4b24cb729db8 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -17713,6 +17713,10 @@ "type": "boolean", "x-go-name": "AllowRebaseMerge" }, + "allow_rebase_update": { + "type": "boolean", + "x-go-name": "AllowRebaseUpdate" + }, "allow_squash_merge": { "type": "boolean", "x-go-name": "AllowSquash" @@ -17738,6 +17742,10 @@ "type": "string", "x-go-name": "DefaultBranch" }, + "default_delete_branch_after_merge": { + "type": "boolean", + "x-go-name": "DefaultDeleteBranchAfterMerge" + }, "default_merge_style": { "type": "string", "x-go-name": "DefaultMergeStyle" From e35a39e81d9ef548b17612b6441951eb08b4345e Mon Sep 17 00:00:00 2001 From: Baekjun Kim <36013575+kimbj95@users.noreply.github.com> Date: Fri, 15 Jul 2022 01:52:11 -0700 Subject: [PATCH 09/11] Include login_name in adminCreateUser response (#20283) `login_name` (Authentication Sign-in Name) is not included in the response of `adminUserCreate` API. This PR is to return user-specified `login_name` if there is one. --- modules/convert/user.go | 1 + modules/structs/user.go | 3 +++ templates/swagger/v1_json.tmpl | 6 ++++++ 3 files changed, 10 insertions(+) diff --git a/modules/convert/user.go b/modules/convert/user.go index 2b07d21838d7..093994856cae 100644 --- a/modules/convert/user.go +++ b/modules/convert/user.go @@ -73,6 +73,7 @@ func toUser(user *user_model.User, signed, authed bool) *api.User { // only site admin will get these information and possibly user himself if authed { result.IsAdmin = user.IsAdmin + result.LoginName = user.LoginName result.LastLogin = user.LastLoginUnix.AsTime() result.Language = user.Language result.IsActive = user.IsActive diff --git a/modules/structs/user.go b/modules/structs/user.go index 431e230fac03..81516894a58f 100644 --- a/modules/structs/user.go +++ b/modules/structs/user.go @@ -17,6 +17,9 @@ type User struct { ID int64 `json:"id"` // the user's username UserName string `json:"login"` + // the user's authentication sign-in name. + // default: empty + LoginName string `json:"login_name"` // the user's full name FullName string `json:"full_name"` // swagger:strfmt email diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index 4b24cb729db8..a3bb90484565 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -18487,6 +18487,12 @@ "type": "string", "x-go-name": "UserName" }, + "login_name": { + "description": "the user's authentication sign-in name.", + "type": "string", + "default": "empty", + "x-go-name": "LoginName" + }, "prohibit_login": { "description": "Is user login prohibited", "type": "boolean", From 4c0fce8f7b3ec185ca34e301fb67bf2d28d972d4 Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 15 Jul 2022 11:38:18 +0200 Subject: [PATCH 10/11] Fix eslint parsing errors, remove eslint-plugin-html (#20323) Introduce a separate .eslintrc in the Vue components folder to selectively enable vue-eslint-parser there, so that the rest of the files can use eslint's core parser which can deal with hashbangs. The fact that the eslint-disable comments worked in HTML was a unintended side-effect of the files being parsed via vue-eslint-parser, so I had to disable the parsing of these files in .eslintrc.yaml to make it work, and finally decided to remove eslint-plugin-html as it causes more issues than it solves. --- .eslintrc.yaml | 19 +----- Makefile | 2 +- package-lock.json | 68 --------------------- package.json | 1 - templates/base/head_script.tmpl | 1 - templates/repo/issue/view_content/pull.tmpl | 1 - web_src/js/components/.eslintrc.yaml | 16 +++++ 7 files changed, 18 insertions(+), 90 deletions(-) create mode 100644 web_src/js/components/.eslintrc.yaml diff --git a/.eslintrc.yaml b/.eslintrc.yaml index ff62d9cc93b0..3a906c44cd84 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -11,13 +11,8 @@ parserOptions: plugins: - eslint-plugin-unicorn - eslint-plugin-import - - eslint-plugin-vue - - eslint-plugin-html - eslint-plugin-jquery -extends: - - plugin:vue/recommended - env: es2022: true node: true @@ -25,18 +20,11 @@ env: globals: __webpack_public_path__: true -settings: - html/html-extensions: [".tmpl"] - overrides: - - files: ["web_src/**/*.js", "web_src/**/*.vue", "templates/**/*.tmpl"] + - files: ["web_src/**/*.js", "docs/**/*.js"] env: browser: true node: false - - files: ["templates/**/*.tmpl"] - rules: - no-tabs: [0] - indent: [2, tab, {SwitchCase: 1}] - files: ["web_src/**/*worker.js"] env: worker: true @@ -502,11 +490,6 @@ rules: use-isnan: [2] valid-typeof: [2, {requireStringLiterals: true}] vars-on-top: [0] - vue/attributes-order: [0] - vue/component-definition-name-casing: [0] - vue/html-closing-bracket-spacing: [0] - vue/max-attributes-per-line: [0] - vue/one-component-per-file: [0] wrap-iife: [2, inside] wrap-regex: [0] yield-star-spacing: [2, after] diff --git a/Makefile b/Makefile index 5536788613c4..5d1b54e852d3 100644 --- a/Makefile +++ b/Makefile @@ -310,7 +310,7 @@ lint: lint-frontend lint-backend .PHONY: lint-frontend lint-frontend: node_modules - npx eslint --color --max-warnings=0 web_src/js build templates *.config.js docs/assets/js + npx eslint --color --max-warnings=0 --ext js,vue web_src/js build *.config.js docs/assets/js npx stylelint --color --max-warnings=0 web_src/less npx spectral lint -q -F hint $(SWAGGER_SPEC) diff --git a/package-lock.json b/package-lock.json index 5032e50fc525..605134201ebb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -47,7 +47,6 @@ "@happy-dom/jest-environment": "4.0.1", "@stoplight/spectral-cli": "6.4.1", "eslint": "8.15.0", - "eslint-plugin-html": "6.2.0", "eslint-plugin-import": "2.26.0", "eslint-plugin-jquery": "1.5.1", "eslint-plugin-unicorn": "42.0.0", @@ -4839,18 +4838,6 @@ "node": ">=10.13.0" } }, - "node_modules/entities": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz", - "integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==", - "dev": true, - "engines": { - "node": ">=0.12" - }, - "funding": { - "url": "https://github.com/fb55/entities?sponsor=1" - } - }, "node_modules/envinfo": { "version": "7.8.1", "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.8.1.tgz", @@ -5231,15 +5218,6 @@ "ms": "^2.1.1" } }, - "node_modules/eslint-plugin-html": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-html/-/eslint-plugin-html-6.2.0.tgz", - "integrity": "sha512-vi3NW0E8AJombTvt8beMwkL1R/fdRWl4QSNRNMhVQKWm36/X0KF0unGNAY4mqUF06mnwVWZcIcerrCnfn9025g==", - "dev": true, - "dependencies": { - "htmlparser2": "^7.1.2" - } - }, "node_modules/eslint-plugin-import": { "version": "2.26.0", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz", @@ -6262,25 +6240,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/htmlparser2": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-7.2.0.tgz", - "integrity": "sha512-H7MImA4MS6cw7nbyURtLPO1Tms7C5H602LRETv95z1MxO/7CP7rDVROehUYeYBUYEON94NXXDEPmZuq+hX4sog==", - "dev": true, - "funding": [ - "https://github.com/fb55/htmlparser2?sponsor=1", - { - "type": "github", - "url": "https://github.com/sponsors/fb55" - } - ], - "dependencies": { - "domelementtype": "^2.0.1", - "domhandler": "^4.2.2", - "domutils": "^2.8.0", - "entities": "^3.0.1" - } - }, "node_modules/http-basic": { "version": "8.1.3", "resolved": "https://registry.npmjs.org/http-basic/-/http-basic-8.1.3.tgz", @@ -16221,12 +16180,6 @@ "tapable": "^2.2.0" } }, - "entities": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/entities/-/entities-3.0.1.tgz", - "integrity": "sha512-WiyBqoomrwMdFG1e0kqvASYfnlb0lp8M5o5Fw2OFq1hNZxxcNk8Ik0Xm7LxzBhuidnZB/UtBqVCgUz3kBOP51Q==", - "dev": true - }, "envinfo": { "version": "7.8.1", "resolved": "https://registry.npmjs.org/envinfo/-/envinfo-7.8.1.tgz", @@ -16519,15 +16472,6 @@ } } }, - "eslint-plugin-html": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-html/-/eslint-plugin-html-6.2.0.tgz", - "integrity": "sha512-vi3NW0E8AJombTvt8beMwkL1R/fdRWl4QSNRNMhVQKWm36/X0KF0unGNAY4mqUF06mnwVWZcIcerrCnfn9025g==", - "dev": true, - "requires": { - "htmlparser2": "^7.1.2" - } - }, "eslint-plugin-import": { "version": "2.26.0", "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz", @@ -17317,18 +17261,6 @@ "integrity": "sha512-vy7ClnArOZwCnqZgvv+ddgHgJiAFXe3Ge9ML5/mBctVJoUoYPCdxVucOywjDARn6CVoh3dRSFdPHy2sX80L0Wg==", "dev": true }, - "htmlparser2": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-7.2.0.tgz", - "integrity": "sha512-H7MImA4MS6cw7nbyURtLPO1Tms7C5H602LRETv95z1MxO/7CP7rDVROehUYeYBUYEON94NXXDEPmZuq+hX4sog==", - "dev": true, - "requires": { - "domelementtype": "^2.0.1", - "domhandler": "^4.2.2", - "domutils": "^2.8.0", - "entities": "^3.0.1" - } - }, "http-basic": { "version": "8.1.3", "resolved": "https://registry.npmjs.org/http-basic/-/http-basic-8.1.3.tgz", diff --git a/package.json b/package.json index b55da05b3dec..afc8d2a374e9 100644 --- a/package.json +++ b/package.json @@ -47,7 +47,6 @@ "@happy-dom/jest-environment": "4.0.1", "@stoplight/spectral-cli": "6.4.1", "eslint": "8.15.0", - "eslint-plugin-html": "6.2.0", "eslint-plugin-import": "2.26.0", "eslint-plugin-jquery": "1.5.1", "eslint-plugin-unicorn": "42.0.0", diff --git a/templates/base/head_script.tmpl b/templates/base/head_script.tmpl index 2f74b959e2a1..48a3df693a39 100644 --- a/templates/base/head_script.tmpl +++ b/templates/base/head_script.tmpl @@ -4,7 +4,6 @@ If you are customizing Gitea, please do not change this file. If you introduce mistakes in it, Gitea JavaScript code wouldn't run correctly. */}}