Merge branch 'master' into resolved-conflicts

This commit is contained in:
Jonas Franz 2017-09-17 21:18:47 +02:00 committed by GitHub
commit 6898e46bcb
7 changed files with 217 additions and 222 deletions

View File

@ -338,9 +338,15 @@ func createComment(e *xorm.Session, opts *CreateCommentOptions) (_ *Comment, err
OldTitle: opts.OldTitle, OldTitle: opts.OldTitle,
NewTitle: opts.NewTitle, NewTitle: opts.NewTitle,
DependentIssue: opts.DependentIssue, DependentIssue: opts.DependentIssue,
DependentIssueID: depId, DependentIssueID: opts.DependentIssue.ID,
} }
//fmt.Println(comment)
// TODO: WHY ISNT THIS INSERTED??????
// 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) _, err = e.Insert(comment)
if err != nil { if err != nil {
return nil, err return nil, err
@ -527,7 +533,7 @@ func createIssueDependencyComment(e *xorm.Session, doer *User, issue *Issue, dep
Repo: issue.Repo, Repo: issue.Repo,
Issue: issue, Issue: issue,
DependentIssue: dependantIssue, DependentIssue: dependantIssue,
Content: dependantIssue.Title, Content: issue.Title,
}) })
} }

View File

@ -83,7 +83,7 @@ func CreateIssueDependency(user *User, issue, dep *Issue) (err error, exists boo
return err, exists, false return err, exists, false
} }
} }
return nil, exists, true return nil, exists, false
} }
// Removes a dependency from an issue // Removes a dependency from an issue
@ -154,21 +154,10 @@ func issueDepExists(e Engine, issueID int64, depID int64) (exists bool, err erro
} }
// check if issue can be closed // check if issue can be closed
func IssueNoDependenciesLeft(issue *Issue) bool { func IssueNoDependenciesLeft(issueID int64) bool {
// Check if the Repo is allowed to have dependencies, if not return true (= issue can be closed)
// Otherwise check for all open dependencies
r, err := getRepositoryByID(x, issue.RepoID)
if err != nil {
return false
}
if !r.UnitEnabled(UnitTypeIssueDependencies) {
return true
}
var issueDeps []IssueDependency var issueDeps []IssueDependency
err = x.Where("issue_id = ?", issue.ID).Find(&issueDeps) err := x.Where("issue_id = ?", issueID).Find(&issueDeps)
for _, issueDep := range issueDeps { for _, issueDep := range issueDeps {
issueDetails, _ := getIssueByID(x, issueDep.DependencyID) issueDetails, _ := getIssueByID(x, issueDep.DependencyID)

View File

@ -104,6 +104,7 @@ type RepoSettingForm struct {
TrackerURLFormat string TrackerURLFormat string
TrackerIssueStyle string TrackerIssueStyle string
EnablePulls bool EnablePulls bool
EnableIssueDependencies bool
EnableTimetracker bool EnableTimetracker bool
AllowOnlyContributorsToTrackTime bool AllowOnlyContributorsToTrackTime bool
EnableIssueDependencies bool EnableIssueDependencies bool

View File

@ -1,7 +1,7 @@
{{range .Issue.Comments}} {{range .Issue.Comments}}
{{ $createdStr:= TimeSince .Created $.Lang }} {{ $createdStr:= TimeSince .Created $.Lang }}
<!-- 0 = COMMENT, 1 = REOPEN, 2 = CLOSE, 3 = ISSUE_REF, 4 = COMMIT_REF, 5 = COMMENT_REF, 6 = PULL_REF, 7 = COMMENT_LABEL, 12 = START_TRACKING, 13 = STOP_TRACKING, 14 = ADD_TIME_MANUAL --> <!-- 0 = COMMENT, 1 = REOPEN, 2 = CLOSE, 3 = ISSUE_REF, 4 = COMMIT_REF, 5 = COMMENT_REF, 6 = PULL_REF, 7 = COMMENT_LABEL, 12 = START_TRACKING, 13 = STOP_TRACKING, 14 = ADD_TIME_MANUAL, 15 = CANCEL_TIME_TRACKING, 16 = ADDED_DEPENDENCY, 17 = REMOVED_DEPENDENCY -->
{{if eq .Type 0}} {{if eq .Type 0}}
<div class="comment" id="{{.HashTag}}"> <div class="comment" id="{{.HashTag}}">
<a class="avatar" {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}> <a class="avatar" {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}>
@ -58,7 +58,6 @@
{{end}} {{end}}
</div> </div>
</div> </div>
{{else if eq .Type 1}} {{else if eq .Type 1}}
<div class="event"> <div class="event">
<span class="octicon octicon-primitive-dot"></span> <span class="octicon octicon-primitive-dot"></span>