Browse Source

add pull_request amount

master
yuyuanshifu 4 years ago
parent
commit
b61fc9ca10
4 changed files with 5 additions and 3 deletions
  1. +1
    -1
      models/pull.go
  2. +1
    -1
      models/repo.go
  3. +1
    -1
      modules/auth/repo_form.go
  4. +2
    -0
      routers/repo/pull.go

+ 1
- 1
models/pull.go View File

@@ -407,7 +407,7 @@ func (pr *PullRequest) SetMerged() (bool, error) {
return false, fmt.Errorf("Issue.changeStatus: %v", err) return false, fmt.Errorf("Issue.changeStatus: %v", err)
} }


if _, err := sess.Where("id = ?", pr.ID).Cols("has_merged, status, merged_commit_id, merger_id, merged_unix").Update(pr); err != nil {
if _, err := sess.Where("id = ?", pr.ID).Cols("has_merged, status, merged_commit_id, merger_id, merged_unix, amount").Update(pr); err != nil {
return false, fmt.Errorf("Failed to update pr[%d]: %v", pr.ID, err) return false, fmt.Errorf("Failed to update pr[%d]: %v", pr.ID, err)
} }




+ 1
- 1
models/repo.go View File

@@ -205,7 +205,7 @@ type Repository struct {


//blockchain //blockchain
ContractAddress string `xorm:"INDEX"` ContractAddress string `xorm:"INDEX"`
Balance int64 `xorm:"NOT NULL DEFAULT 0"`
Balance string `xorm:"NOT NULL DEFAULT '0'"`
BlockChainStatus RepoBlockChainStatus `xorm:"NOT NULL DEFAULT 0"` BlockChainStatus RepoBlockChainStatus `xorm:"NOT NULL DEFAULT 0"`


CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"` CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`


+ 1
- 1
modules/auth/repo_form.go View File

@@ -489,7 +489,7 @@ type MergePullRequestForm struct {
MergeTitleField string MergeTitleField string
MergeMessageField string MergeMessageField string
ForceMerge *bool `json:"force_merge,omitempty"` ForceMerge *bool `json:"force_merge,omitempty"`
BlockChainAmount int `binding:"Required"`
BlockChainAmount int
} }


// Validate validates the fields // Validate validates the fields


+ 2
- 0
routers/repo/pull.go View File

@@ -816,6 +816,8 @@ func MergePullRequest(ctx *context.Context, form auth.MergePullRequestForm) {
return return
} }


pr.Amount = form.BlockChainAmount

if err = pull_service.Merge(pr, ctx.User, ctx.Repo.GitRepo, models.MergeStyle(form.Do), message); err != nil { if err = pull_service.Merge(pr, ctx.User, ctx.Repo.GitRepo, models.MergeStyle(form.Do), message); err != nil {
if models.IsErrInvalidMergeStyle(err) { if models.IsErrInvalidMergeStyle(err) {
ctx.Flash.Error(ctx.Tr("repo.pulls.invalid_merge_option")) ctx.Flash.Error(ctx.Tr("repo.pulls.invalid_merge_option"))


Loading…
Cancel
Save