Skip to content

Commit 6b85c09

Browse files
committed
Merge branch 'main' of https://github.com/go-gitea/gitea into feature-cran
2 parents dd02f85 + 27494ed commit 6b85c09

File tree

131 files changed

+9442
-8372
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+9442
-8372
lines changed

.drone.yml

Lines changed: 40 additions & 67 deletions
Large diffs are not rendered by default.

.stylelintrc.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ ignoreFiles:
55
- "**/*.go"
66

77
overrides:
8-
- files: ["**/*.less"]
9-
customSyntax: postcss-less
108
- files: ["**/chroma/*", "**/codemirror/*", "**/standalone/*", "**/console/*"]
119
rules:
1210
scale-unlimited/declaration-strict-value: null

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ AIR_PACKAGE ?= github.com/cosmtrek/[email protected]
2929
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/cmd/[email protected]
3030
ERRCHECK_PACKAGE ?= github.com/kisielk/[email protected]
3131
GOFUMPT_PACKAGE ?= mvdan.cc/[email protected]
32-
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/[email protected].0
32+
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/cmd/[email protected].2
3333
GXZ_PAGAGE ?= github.com/ulikunitz/xz/cmd/[email protected]
3434
MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/[email protected]
3535
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/[email protected]
@@ -105,7 +105,7 @@ GO_TEST_PACKAGES ?= $(filter-out $(shell $(GO) list code.gitea.io/gitea/models/m
105105

106106
FOMANTIC_WORK_DIR := web_src/fomantic
107107

108-
WEBPACK_SOURCES := $(shell find web_src/js web_src/less -type f)
108+
WEBPACK_SOURCES := $(shell find web_src/js web_src/css -type f)
109109
WEBPACK_CONFIGS := webpack.config.js
110110
WEBPACK_DEST := public/js/index.js public/css/index.css
111111
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
131131
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)
132132

133133
GO_DIRS := cmd tests models modules routers build services tools
134-
WEB_DIRS := web_src/js web_src/less
134+
WEB_DIRS := web_src/js web_src/css
135135

136136
GO_SOURCES := $(wildcard *.go)
137137
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
342342
.PHONY: lint-frontend
343343
lint-frontend: node_modules
344344
npx eslint --color --max-warnings=0 --ext js,vue web_src/js build *.config.js docs/assets/js tests/e2e
345-
npx stylelint --color --max-warnings=0 web_src/less
345+
npx stylelint --color --max-warnings=0 web_src/css
346346
npx spectral lint -q -F hint $(SWAGGER_SPEC)
347347
npx markdownlint docs *.md
348348

custom/conf/app.example.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
;; - The environment variable `$GITEA_WORK_DIR`
2121
;; - A built-in value set at build time (see building from source)
2222
;; - Otherwise it defaults to the directory of the _`AppPath`_
23-
;; - If any of the above are relative paths then they are made absolute against the
23+
;; - If any of the above are relative paths then they are made absolute against
2424
;; the directory of the _`AppPath`_
2525
;; - _`CustomPath`_: This is the base directory for custom templates and other options.
2626
;; It is determined by using the first set thing in the following hierarchy:

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ reported as part of the default configuration when running `gitea --help` or on
4646
- The environment variable `$GITEA_WORK_DIR`
4747
- A built-in value set at build time (see building from source)
4848
- Otherwise it defaults to the directory of the _`AppPath`_
49-
- If any of the above are relative paths then they are made absolute against the
49+
- If any of the above are relative paths then they are made absolute against
5050
the directory of the _`AppPath`_
5151
- _`CustomPath`_: This is the base directory for custom templates and other options.
5252
It is determined by using the first set thing in the following hierarchy:

docs/content/doc/advanced/customizing-gitea.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ To make a custom theme available to all users:
354354
355355
Community themes are listed in [gitea/awesome-gitea#themes](https://gitea.com/gitea/awesome-gitea#themes).
356356
357-
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).
357+
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).
358358
359359
If your custom theme is considered a dark theme, set the global css variable `--is-dark-theme` to `true`.
360360
This allows Gitea to adjust the Monaco code editor's theme accordingly.

docs/content/doc/developers/guidelines-frontend.en-us.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ menu:
2121

2222
## Background
2323

24-
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.
24+
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.
2525

2626
The HTML pages are rendered by [Go HTML Template](https://pkg.go.dev/html/template).
2727

2828
The source files can be found in the following directories:
2929

30-
* **Less styles:** `web_src/less/`
30+
* **CSS styles:** `web_src/css/`
3131
* **JavaScript files:** `web_src/js/`
3232
* **Vue components:** `web_src/js/components/`
3333
* **Go HTML templates:** `templates/`

docs/content/doc/usage/push-options.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ were added.
2929
Example of changing a repository's visibility to public:
3030

3131
```shell
32-
git push -o repo.private=false -u origin master
32+
git push -o repo.private=false -u origin main
3333
```

docs/content/doc/usage/push-options.zh-tw.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ Gitea 從 `1.13` 版開始支援某些 [push options](https://git-scm.com/docs/g
2929
以下範例修改儲存庫的可見性為公開:
3030

3131
```shell
32-
git push -o repo.private=false -u origin master
32+
git push -o repo.private=false -u origin main
3333
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
date: "2020-07-06T16:00:00+02:00"
3+
title: "Usage: Push To Create"
4+
slug: "push-to-create"
5+
weight: 15
6+
toc: false
7+
draft: false
8+
menu:
9+
sidebar:
10+
parent: "usage"
11+
name: "Push To Create"
12+
weight: 15
13+
identifier: "push-to-create"
14+
---
15+
16+
# Push To Create
17+
18+
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.
19+
20+
## Enabling Push To Create
21+
22+
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" >}}).
23+
24+
## Using Push To Create
25+
26+
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:
27+
28+
```shell
29+
# Add the remote you want to push to
30+
git remote add origin git@{domain}:{username}/{repo name that does not exist yet}.git
31+
32+
# push to the remote
33+
git push -u origin main
34+
```
35+
36+
This assumes you are using an SSH remote, but you can also use HTTPS remotes as well.
37+
38+
## Push options (bonus)
39+
40+
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" >}}).

models/fixtures/project.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
-
22
id: 1
33
title: First project
4+
owner_id: 0
45
repo_id: 1
56
is_closed: false
67
creator_id: 2
@@ -10,6 +11,7 @@
1011
-
1112
id: 2
1213
title: second project
14+
owner_id: 0
1315
repo_id: 3
1416
is_closed: false
1517
creator_id: 3
@@ -19,6 +21,7 @@
1921
-
2022
id: 3
2123
title: project on repo with disabled project
24+
owner_id: 0
2225
repo_id: 4
2326
is_closed: true
2427
creator_id: 5
@@ -29,6 +32,7 @@
2932
id: 4
3033
title: project on user2
3134
owner_id: 2
35+
repo_id: 0
3236
is_closed: false
3337
creator_id: 2
3438
board_type: 1

models/issues/pull.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,10 +660,10 @@ func GetPullRequestByIssueID(ctx context.Context, issueID int64) (*PullRequest,
660660

661661
// GetAllUnmergedAgitPullRequestByPoster get all unmerged agit flow pull request
662662
// By poster id.
663-
func GetAllUnmergedAgitPullRequestByPoster(uid int64) ([]*PullRequest, error) {
663+
func GetAllUnmergedAgitPullRequestByPoster(ctx context.Context, uid int64) ([]*PullRequest, error) {
664664
pulls := make([]*PullRequest, 0, 10)
665665

666-
err := db.GetEngine(db.DefaultContext).
666+
err := db.GetEngine(ctx).
667667
Where("has_merged=? AND flow = ? AND issue.is_closed=? AND issue.poster_id=?",
668668
false, PullRequestFlowAGit, false, uid).
669669
Join("INNER", "issue", "issue.id=pull_request.issue_id").

models/migrations/fixtures/Test_DeleteOrphanedIssueLabels/label.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
org_id: 0
55
name: label1
66
color: '#abcdef'
7-
exclusive: false
87
num_issues: 2
98
num_closed_issues: 0
109

@@ -14,7 +13,6 @@
1413
org_id: 0
1514
name: label2
1615
color: '#000000'
17-
exclusive: false
1816
num_issues: 1
1917
num_closed_issues: 1
2018
-
@@ -23,7 +21,6 @@
2321
org_id: 3
2422
name: orglabel3
2523
color: '#abcdef'
26-
exclusive: false
2724
num_issues: 0
2825
num_closed_issues: 0
2926

@@ -33,7 +30,6 @@
3330
org_id: 3
3431
name: orglabel4
3532
color: '#000000'
36-
exclusive: false
3733
num_issues: 1
3834
num_closed_issues: 0
3935

@@ -43,6 +39,5 @@
4339
org_id: 0
4440
name: pull-test-label
4541
color: '#000000'
46-
exclusive: false
4742
num_issues: 0
4843
num_closed_issues: 0

models/migrations/migrations.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,8 @@ var migrations = []Migration{
469469
NewMigration("Add NeedApproval to actions tables", v1_20.AddNeedApprovalToActionRun),
470470
// v245 -> v246
471471
NewMigration("Rename Webhook org_id to owner_id", v1_20.RenameWebhookOrgToOwner),
472+
// v246 -> v247
473+
NewMigration("Add missed column owner_id for project table", v1_20.AddNewColumnForProject),
472474
}
473475

474476
// GetCurrentDBVersion returns the current db version

models/migrations/v1_20/v246.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2023 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
package v1_20 //nolint
5+
6+
import (
7+
"xorm.io/xorm"
8+
)
9+
10+
func AddNewColumnForProject(x *xorm.Engine) error {
11+
type Project struct {
12+
OwnerID int64 `xorm:"INDEX"`
13+
}
14+
15+
return x.Sync(new(Project))
16+
}

models/user/user.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -742,13 +742,13 @@ func VerifyUserActiveCode(code string) (user *User) {
742742
}
743743

744744
// ChangeUserName changes all corresponding setting from old user name to new one.
745-
func ChangeUserName(u *User, newUserName string) (err error) {
745+
func ChangeUserName(ctx context.Context, u *User, newUserName string) (err error) {
746746
oldUserName := u.Name
747747
if err = IsUsableUsername(newUserName); err != nil {
748748
return err
749749
}
750750

751-
ctx, committer, err := db.TxContext(db.DefaultContext)
751+
ctx, committer, err := db.TxContext(ctx)
752752
if err != nil {
753753
return err
754754
}

modules/actions/github.go

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// Copyright 2023 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
package actions
5+
6+
import (
7+
webhook_module "code.gitea.io/gitea/modules/webhook"
8+
9+
"github.com/nektos/act/pkg/jobparser"
10+
)
11+
12+
const (
13+
githubEventPullRequest = "pull_request"
14+
githubEventPullRequestTarget = "pull_request_target"
15+
githubEventPullRequestReviewComment = "pull_request_review_comment"
16+
githubEventPullRequestReview = "pull_request_review"
17+
githubEventRegistryPackage = "registry_package"
18+
githubEventCreate = "create"
19+
githubEventDelete = "delete"
20+
githubEventFork = "fork"
21+
githubEventPush = "push"
22+
githubEventIssues = "issues"
23+
githubEventIssueComment = "issue_comment"
24+
githubEventRelease = "release"
25+
githubEventPullRequestComment = "pull_request_comment"
26+
)
27+
28+
func convertFromGithubEvent(evt *jobparser.Event) string {
29+
switch evt.Name {
30+
case githubEventPullRequest, githubEventPullRequestTarget, githubEventPullRequestReview,
31+
githubEventPullRequestReviewComment:
32+
return string(webhook_module.HookEventPullRequest)
33+
case githubEventRegistryPackage:
34+
return string(webhook_module.HookEventPackage)
35+
case githubEventCreate, githubEventDelete, githubEventFork, githubEventPush,
36+
githubEventIssues, githubEventIssueComment, githubEventRelease, githubEventPullRequestComment:
37+
fallthrough
38+
default:
39+
return evt.Name
40+
}
41+
}

0 commit comments

Comments
 (0)