Skip to content

Commit 3995ef5

Browse files
authored
Merge branch 'main' into gitea/am/file-tab-diff-tree
2 parents adf5f3c + 303af55 commit 3995ef5

Some content is hidden

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

44 files changed

+279
-355
lines changed

.github/labeler.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ modifies/internal:
4141
- ".dockerignore"
4242
- "docker/**"
4343
- ".editorconfig"
44-
- ".eslintrc.yaml"
44+
- ".eslintrc.cjs"
4545
- ".golangci.yml"
4646
- ".gitpod.yml"
4747
- ".markdownlint.yaml"
4848
- ".spectral.yaml"
4949
- "stylelint.config.js"
5050
- ".yamllint.yaml"
5151
- ".github/**"
52-
- ".gitea/"
52+
- ".gitea/**"
5353
- ".devcontainer/**"
5454
- "build.go"
5555
- "build/**"
@@ -73,9 +73,9 @@ modifies/go:
7373
modifies/frontend:
7474
- changed-files:
7575
- any-glob-to-any-file:
76-
- "**/*.js"
77-
- "**/*.ts"
78-
- "**/*.vue"
76+
- "*.js"
77+
- "*.ts"
78+
- "web_src/**"
7979

8080
docs-update-needed:
8181
- changed-files:

.github/workflows/files-changed.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,16 @@ jobs:
5151
- "options/locale/locale_en-US.ini"
5252
5353
frontend:
54-
- "**/*.js"
54+
- "*.js"
55+
- "*.ts"
5556
- "web_src/**"
57+
- "tools/*.js"
58+
- "tools/*.ts"
5659
- "assets/emoji.json"
5760
- "package.json"
5861
- "package-lock.json"
5962
- "Makefile"
60-
- ".eslintrc.yaml"
61-
- "stylelint.config.js"
63+
- ".eslintrc.cjs"
6264
- ".npmrc"
6365
6466
docs:

models/auth/access_token_scope.go

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package auth
55

66
import (
77
"fmt"
8+
"slices"
89
"strings"
910

1011
"code.gitea.io/gitea/models/perm"
@@ -14,7 +15,7 @@ import (
1415
type AccessTokenScopeCategory int
1516

1617
const (
17-
AccessTokenScopeCategoryActivityPub = iota
18+
AccessTokenScopeCategoryActivityPub AccessTokenScopeCategory = iota
1819
AccessTokenScopeCategoryAdmin
1920
AccessTokenScopeCategoryMisc // WARN: this is now just a placeholder, don't remove it which will change the following values
2021
AccessTokenScopeCategoryNotification
@@ -193,6 +194,14 @@ var accessTokenScopes = map[AccessTokenScopeLevel]map[AccessTokenScopeCategory]A
193194
},
194195
}
195196

197+
func GetAccessTokenCategories() (res []string) {
198+
for _, cat := range accessTokenScopes[Read] {
199+
res = append(res, strings.TrimPrefix(string(cat), "read:"))
200+
}
201+
slices.Sort(res)
202+
return res
203+
}
204+
196205
// GetRequiredScopes gets the specific scopes for a given level and categories
197206
func GetRequiredScopes(level AccessTokenScopeLevel, scopeCategories ...AccessTokenScopeCategory) []AccessTokenScope {
198207
scopes := make([]AccessTokenScope, 0, len(scopeCategories))
@@ -270,6 +279,9 @@ func (s AccessTokenScope) parse() (accessTokenScopeBitmap, error) {
270279

271280
// StringSlice returns the AccessTokenScope as a []string
272281
func (s AccessTokenScope) StringSlice() []string {
282+
if s == "" {
283+
return nil
284+
}
273285
return strings.Split(string(s), ",")
274286
}
275287

models/auth/access_token_scope_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ type scopeTestNormalize struct {
1717
}
1818

1919
func TestAccessTokenScope_Normalize(t *testing.T) {
20+
assert.Equal(t, []string{"activitypub", "admin", "issue", "misc", "notification", "organization", "package", "repository", "user"}, GetAccessTokenCategories())
2021
tests := []scopeTestNormalize{
2122
{"", "", nil},
2223
{"write:misc,write:notification,read:package,write:notification,public-only", "public-only,write:misc,write:notification,read:package", nil},
@@ -25,7 +26,7 @@ func TestAccessTokenScope_Normalize(t *testing.T) {
2526
{"write:activitypub,write:admin,write:misc,write:notification,write:organization,write:package,write:issue,write:repository,write:user,public-only", "public-only,all", nil},
2627
}
2728

28-
for _, scope := range []string{"activitypub", "admin", "misc", "notification", "organization", "package", "issue", "repository", "user"} {
29+
for _, scope := range GetAccessTokenCategories() {
2930
tests = append(tests,
3031
scopeTestNormalize{AccessTokenScope(fmt.Sprintf("read:%s", scope)), AccessTokenScope(fmt.Sprintf("read:%s", scope)), nil},
3132
scopeTestNormalize{AccessTokenScope(fmt.Sprintf("write:%s", scope)), AccessTokenScope(fmt.Sprintf("write:%s", scope)), nil},
@@ -59,7 +60,7 @@ func TestAccessTokenScope_HasScope(t *testing.T) {
5960
{"public-only", "read:issue", false, nil},
6061
}
6162

62-
for _, scope := range []string{"activitypub", "admin", "misc", "notification", "organization", "package", "issue", "repository", "user"} {
63+
for _, scope := range GetAccessTokenCategories() {
6364
tests = append(tests,
6465
scopeTestHasScope{
6566
AccessTokenScope(fmt.Sprintf("read:%s", scope)),

models/issues/pull_list.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,16 @@ type PullRequestsOptions struct {
2828
Labels []int64
2929
MilestoneID int64
3030
PosterID int64
31+
BaseBranch string
3132
}
3233

3334
func listPullRequestStatement(ctx context.Context, baseRepoID int64, opts *PullRequestsOptions) *xorm.Session {
3435
sess := db.GetEngine(ctx).Where("pull_request.base_repo_id=?", baseRepoID)
3536

37+
if opts.BaseBranch != "" {
38+
sess.And("pull_request.base_branch=?", opts.BaseBranch)
39+
}
40+
3641
sess.Join("INNER", "issue", "pull_request.issue_id = issue.id")
3742
switch opts.State {
3843
case "closed", "open":

models/repo/repo.go

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -646,13 +646,15 @@ func (repo *Repository) DescriptionHTML(ctx context.Context) template.HTML {
646646
type CloneLink struct {
647647
SSH string
648648
HTTPS string
649+
Tea string
649650
}
650651

651-
// ComposeHTTPSCloneURL returns HTTPS clone URL based on given owner and repository name.
652+
// ComposeHTTPSCloneURL returns HTTPS clone URL based on the given owner and repository name.
652653
func ComposeHTTPSCloneURL(ctx context.Context, owner, repo string) string {
653654
return fmt.Sprintf("%s%s/%s.git", httplib.GuessCurrentAppURL(ctx), url.PathEscape(owner), url.PathEscape(repo))
654655
}
655656

657+
// ComposeSSHCloneURL returns SSH clone URL based on the given owner and repository name.
656658
func ComposeSSHCloneURL(doer *user_model.User, ownerName, repoName string) string {
657659
sshUser := setting.SSH.User
658660
sshDomain := setting.SSH.Domain
@@ -686,11 +688,17 @@ func ComposeSSHCloneURL(doer *user_model.User, ownerName, repoName string) strin
686688
return fmt.Sprintf("%s@%s:%s/%s.git", sshUser, sshHost, url.PathEscape(ownerName), url.PathEscape(repoName))
687689
}
688690

691+
// ComposeTeaCloneCommand returns Tea CLI clone command based on the given owner and repository name.
692+
func ComposeTeaCloneCommand(ctx context.Context, owner, repo string) string {
693+
return fmt.Sprintf("tea clone %s/%s", url.PathEscape(owner), url.PathEscape(repo))
694+
}
695+
689696
func (repo *Repository) cloneLink(ctx context.Context, doer *user_model.User, repoPathName string) *CloneLink {
690-
cl := new(CloneLink)
691-
cl.SSH = ComposeSSHCloneURL(doer, repo.OwnerName, repoPathName)
692-
cl.HTTPS = ComposeHTTPSCloneURL(ctx, repo.OwnerName, repoPathName)
693-
return cl
697+
return &CloneLink{
698+
SSH: ComposeSSHCloneURL(doer, repo.OwnerName, repoPathName),
699+
HTTPS: ComposeHTTPSCloneURL(ctx, repo.OwnerName, repoPathName),
700+
Tea: ComposeTeaCloneCommand(ctx, repo.OwnerName, repoPathName),
701+
}
694702
}
695703

696704
// CloneLink returns clone URLs of repository.

options/locale/locale_en-US.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,6 @@ delete_token_success = The token has been deleted. Applications using it no long
917917
repo_and_org_access = Repository and Organization Access
918918
permissions_public_only = Public only
919919
permissions_access_all = All (public, private, and limited)
920-
select_permissions = Select permissions
921920
permission_not_set = Not set
922921
permission_no_access = No Access
923922
permission_read = Read

options/locale/locale_ga-IE.ini

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,6 +1464,8 @@ issues.filter_milestones=Cloch Mhíle Scagaire
14641464
issues.filter_projects=Tionscadal Scagaire
14651465
issues.filter_labels=Lipéad Scagaire
14661466
issues.filter_reviewers=Athbhreithneoir Scagaire
1467+
issues.filter_no_results=Gan torthaí
1468+
issues.filter_no_results_placeholder=Bain triail as do scagairí cuardaigh a choigeartú.
14671469
issues.new=Eagrán Nua
14681470
issues.new.title_empty=Ní féidir leis an teideal a bheith folamh
14691471
issues.new.labels=Lipéid
@@ -1701,7 +1703,9 @@ issues.time_estimate_invalid=Tá formáid meastachán ama neamhbhailí
17011703
issues.start_tracking_history=thosaigh ag obair %s
17021704
issues.tracker_auto_close=Stopfar ama go huathoibríoch nuair a dhúnfar an tsaincheist seo
17031705
issues.tracking_already_started=`Tá tús curtha agat cheana féin ag rianú ama ar <a href="%s">eagrán eile</a>!`
1706+
issues.stop_tracking=Stad uaineadóir
17041707
issues.stop_tracking_history=d'oibrigh do <b>%[1]s</b> %[2]s
1708+
issues.cancel_tracking=Caith amach
17051709
issues.cancel_tracking_history=`rianú ama curtha ar ceal %s`
17061710
issues.del_time=Scrios an log ama seo
17071711
issues.add_time_history=cuireadh am caite <b>%[1]s</b> %[2]s leis

options/locale/locale_pt-PT.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,6 +1464,8 @@ issues.filter_milestones=Filtrar etapa
14641464
issues.filter_projects=Filtrar planeamento
14651465
issues.filter_labels=Filtrar rótulo
14661466
issues.filter_reviewers=Filtrar revisor
1467+
issues.filter_no_results=Sem resultados
1468+
issues.filter_no_results_placeholder=Tente ajustar os seus filtros de pesquisa.
14671469
issues.new=Questão nova
14681470
issues.new.title_empty=O título não pode estar vazio
14691471
issues.new.labels=Rótulos

routers/api/v1/repo/pull.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ func ListPullRequests(ctx *context.APIContext) {
5959
// description: Name of the repo
6060
// type: string
6161
// required: true
62+
// - name: base_branch
63+
// in: query
64+
// description: Filter by target base branch of the pull request
65+
// type: string
6266
// - name: state
6367
// in: query
6468
// description: State of pull request
@@ -132,6 +136,7 @@ func ListPullRequests(ctx *context.APIContext) {
132136
Labels: labelIDs,
133137
MilestoneID: ctx.FormInt64("milestone"),
134138
PosterID: posterID,
139+
BaseBranch: ctx.FormTrim("base_branch"),
135140
})
136141
if err != nil {
137142
ctx.APIErrorInternal(err)

0 commit comments

Comments
 (0)