Merge pull request #1 from kolaente/resolved-conflicts

Resolved conflicts
This commit is contained in:
kolaente 2017-09-17 21:19:16 +02:00 committed by GitHub
commit 05ad1bb4a8
2 changed files with 23 additions and 1 deletions

View File

@ -315,6 +315,12 @@ func createComment(e *xorm.Session, opts *CreateCommentOptions) (_ *Comment, err
if opts.Label != nil {
LabelID = opts.Label.ID
}
var depId int64 = 0
if opts.DependentIssue != nil {
depId = opts.DependentIssue.ID
}
comment := &Comment{
Type: opts.Type,
PosterID: opts.Doer.ID,
@ -341,7 +347,6 @@ func createComment(e *xorm.Session, opts *CreateCommentOptions) (_ *Comment, err
// It seems to be inserted, but isnt. (Doesn't return an error, raw pasting
// the sql query in a database console does work). But after the function
// is called, there is no entry in the database. At least for type 12 and 13.
_, err = e.Insert(comment)
if err != nil {
return nil, err

View File

@ -919,6 +919,23 @@ func NewComment(ctx *context.Context, form auth.CreateCommentForm) {
(form.Status == "reopen" || form.Status == "close") &&
!(issue.IsPull && issue.PullRequest.HasMerged) {
// Check for open dependencies
if form.Status == "close"{
canbeClosed := models.IssueNoDependenciesLeft(issue)
if !canbeClosed {
if issue.IsPull{
ctx.Flash.Error("You need to close all issues blocking this pull request before you can merge it!")
ctx.Redirect(fmt.Sprintf("%s/pulls/%d", ctx.Repo.RepoLink, issue.Index))
} else {
ctx.Flash.Error("You need to close all issues blocking this issue before you can close it!")
ctx.Redirect(fmt.Sprintf("%s/issues/%d", ctx.Repo.RepoLink, issue.Index))
}
return
}
}
// Duplication and conflict check should apply to reopen pull request.
var pr *models.PullRequest