summaryrefslogtreecommitdiffstats
path: root/models/pull.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/pull.go')
-rw-r--r--models/pull.go27
1 files changed, 18 insertions, 9 deletions
diff --git a/models/pull.go b/models/pull.go
index e04263af9f..437b202d3f 100644
--- a/models/pull.go
+++ b/models/pull.go
@@ -69,15 +69,16 @@ type PullRequest struct {
Issue *Issue `xorm:"-"`
Index int64
- HeadRepoID int64 `xorm:"INDEX"`
- HeadRepo *repo_model.Repository `xorm:"-"`
- BaseRepoID int64 `xorm:"INDEX"`
- BaseRepo *repo_model.Repository `xorm:"-"`
- HeadBranch string
- HeadCommitID string `xorm:"-"`
- BaseBranch string
- ProtectedBranch *ProtectedBranch `xorm:"-"`
- MergeBase string `xorm:"VARCHAR(40)"`
+ HeadRepoID int64 `xorm:"INDEX"`
+ HeadRepo *repo_model.Repository `xorm:"-"`
+ BaseRepoID int64 `xorm:"INDEX"`
+ BaseRepo *repo_model.Repository `xorm:"-"`
+ HeadBranch string
+ HeadCommitID string `xorm:"-"`
+ BaseBranch string
+ ProtectedBranch *ProtectedBranch `xorm:"-"`
+ MergeBase string `xorm:"VARCHAR(40)"`
+ AllowMaintainerEdit bool `xorm:"NOT NULL DEFAULT false"`
HasMerged bool `xorm:"INDEX"`
MergedCommitID string `xorm:"VARCHAR(40)"`
@@ -711,6 +712,14 @@ func (pr *PullRequest) GetHeadBranchHTMLURL() string {
return pr.HeadRepo.HTMLURL() + "/src/branch/" + util.PathEscapeSegments(pr.HeadBranch)
}
+// UpdateAllowEdits update if PR can be edited from maintainers
+func UpdateAllowEdits(ctx context.Context, pr *PullRequest) error {
+ if _, err := db.GetEngine(ctx).ID(pr.ID).Cols("allow_maintainer_edit").Update(pr); err != nil {
+ return err
+ }
+ return nil
+}
+
// Mergeable returns if the pullrequest is mergeable.
func (pr *PullRequest) Mergeable() bool {
// If a pull request isn't mergable if it's: