Skip to content

Commit 0336851

Browse files
committed
Merge branch 'main' into add-priority-to-ProtectedBranch
2 parents 7939780 + 2abdbe8 commit 0336851

File tree

40 files changed

+484
-303
lines changed

40 files changed

+484
-303
lines changed

cmd/admin_auth_ldap.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ func (a *authService) addLdapSimpleAuth(c *cli.Context) error {
386386
return a.createAuthSource(ctx, authSource)
387387
}
388388

389-
// updateLdapBindDn updates a new LDAP (simple auth) authentication source.
389+
// updateLdapSimpleAuth updates a new LDAP (simple auth) authentication source.
390390
func (a *authService) updateLdapSimpleAuth(c *cli.Context) error {
391391
ctx, cancel := installSignals()
392392
defer cancel()

custom/conf/app.example.ini

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,24 @@ LEVEL = Info
907907
;; Valid site url schemes for user profiles
908908
;VALID_SITE_URL_SCHEMES=http,https
909909

910+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
911+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
912+
;[service.explore]
913+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
914+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
915+
;;
916+
;; Only allow signed in users to view the explore pages.
917+
;REQUIRE_SIGNIN_VIEW = false
918+
;;
919+
;; Disable the users explore page.
920+
;DISABLE_USERS_PAGE = false
921+
;;
922+
;; Disable the organizations explore page.
923+
;DISABLE_ORGANIZATIONS_PAGE = false
924+
;;
925+
;; Disable the code explore page.
926+
;DISABLE_CODE_PAGE = false
927+
;;
910928

911929
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
912930
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

models/git/protected_branch.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ type ProtectedBranch struct {
6464
RequireSignedCommits bool `xorm:"NOT NULL DEFAULT false"`
6565
ProtectedFilePatterns string `xorm:"TEXT"`
6666
UnprotectedFilePatterns string `xorm:"TEXT"`
67+
BlockAdminMergeOverride bool `xorm:"NOT NULL DEFAULT false"`
6768

6869
CreatedUnix timeutil.TimeStamp `xorm:"created"`
6970
UpdatedUnix timeutil.TimeStamp `xorm:"updated"`

models/issues/issue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ func GetPinnedIssues(ctx context.Context, repoID int64, isPull bool) (IssueList,
872872
return issues, nil
873873
}
874874

875-
// IsNewPinnedAllowed returns if a new Issue or Pull request can be pinned
875+
// IsNewPinAllowed returns if a new Issue or Pull request can be pinned
876876
func IsNewPinAllowed(ctx context.Context, repoID int64, isPull bool) (bool, error) {
877877
var maxPin int
878878
_, err := db.GetEngine(ctx).SQL("SELECT COUNT(pin_order) FROM issue WHERE repo_id = ? AND is_pull = ? AND pin_order > 0", repoID, isPull).Get(&maxPin)

models/issues/pull.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -701,7 +701,7 @@ func GetPullRequestByIssueID(ctx context.Context, issueID int64) (*PullRequest,
701701
return pr, pr.LoadAttributes(ctx)
702702
}
703703

704-
// GetPullRequestsByBaseHeadInfo returns the pull request by given base and head
704+
// GetPullRequestByBaseHeadInfo returns the pull request by given base and head
705705
func GetPullRequestByBaseHeadInfo(ctx context.Context, baseID, headID int64, base, head string) (*PullRequest, error) {
706706
pr := &PullRequest{}
707707
sess := db.GetEngine(ctx).

models/migrations/migrations.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,8 @@ var migrations = []Migration{
604604
// v305 -> v306
605605
NewMigration("Add Repository Licenses", v1_23.AddRepositoryLicenses),
606606
// v306 -> v307
607+
NewMigration("Add BlockAdminMergeOverride to ProtectedBranch", v1_23.AddBlockAdminMergeOverrideBranchProtection),
608+
// v307 -> v308
607609
NewMigration("Add Priority to ProtectedBranch", v1_23.AddPriorityToProtectedBranch),
608610
}
609611

models/migrations/v1_23/v306.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,11 @@
33

44
package v1_23 //nolint
55

6-
import (
7-
"xorm.io/xorm"
8-
)
6+
import "xorm.io/xorm"
97

10-
func AddPriorityToProtectedBranch(x *xorm.Engine) error {
8+
func AddBlockAdminMergeOverrideBranchProtection(x *xorm.Engine) error {
119
type ProtectedBranch struct {
12-
Priority int64 `xorm:"NOT NULL DEFAULT 0"`
10+
BlockAdminMergeOverride bool `xorm:"NOT NULL DEFAULT false"`
1311
}
14-
1512
return x.Sync(new(ProtectedBranch))
1613
}

models/migrations/v1_23/v307.go

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

modules/setting/service.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,10 @@ var Service = struct {
9090

9191
// Explore page settings
9292
Explore struct {
93-
RequireSigninView bool `ini:"REQUIRE_SIGNIN_VIEW"`
94-
DisableUsersPage bool `ini:"DISABLE_USERS_PAGE"`
93+
RequireSigninView bool `ini:"REQUIRE_SIGNIN_VIEW"`
94+
DisableUsersPage bool `ini:"DISABLE_USERS_PAGE"`
95+
DisableOrganizationsPage bool `ini:"DISABLE_ORGANIZATIONS_PAGE"`
96+
DisableCodePage bool `ini:"DISABLE_CODE_PAGE"`
9597
} `ini:"service.explore"`
9698
}{
9799
AllowedUserVisibilityModesSlice: []bool{true, true, true},

modules/structs/repo_branch.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ type BranchProtection struct {
5353
RequireSignedCommits bool `json:"require_signed_commits"`
5454
ProtectedFilePatterns string `json:"protected_file_patterns"`
5555
UnprotectedFilePatterns string `json:"unprotected_file_patterns"`
56+
BlockAdminMergeOverride bool `json:"block_admin_merge_override"`
5657
// swagger:strfmt date-time
5758
Created time.Time `json:"created_at"`
5859
// swagger:strfmt date-time
@@ -92,6 +93,7 @@ type CreateBranchProtectionOption struct {
9293
RequireSignedCommits bool `json:"require_signed_commits"`
9394
ProtectedFilePatterns string `json:"protected_file_patterns"`
9495
UnprotectedFilePatterns string `json:"unprotected_file_patterns"`
96+
BlockAdminMergeOverride bool `json:"block_admin_merge_override"`
9597
}
9698

9799
// EditBranchProtectionOption options for editing a branch protection
@@ -124,6 +126,7 @@ type EditBranchProtectionOption struct {
124126
RequireSignedCommits *bool `json:"require_signed_commits"`
125127
ProtectedFilePatterns *string `json:"protected_file_patterns"`
126128
UnprotectedFilePatterns *string `json:"unprotected_file_patterns"`
129+
BlockAdminMergeOverride *bool `json:"block_admin_merge_override"`
127130
}
128131

129132
// UpdateBranchProtectionPriories a list to update the branch protection rule priorities

0 commit comments

Comments
 (0)