Improved Comments

Signed-off-by: Konrad <konrad@kola-entertainments.de>
This commit is contained in:
Konrad Langenberg 2017-08-29 18:26:59 +02:00 committed by Jonas Franz
parent 39f7f92b84
commit 475c539fee
3 changed files with 18 additions and 7 deletions

View File

@ -96,6 +96,7 @@ type Comment struct {
OldAssignee *User `xorm:"-"`
OldTitle string
NewTitle string
DependentIssue int64
CommitID int64
Line int64

View File

@ -6,7 +6,6 @@ package models
import (
"time"
"strconv"
)
// IssueDependency is connection request for receiving issue notification.
@ -76,17 +75,22 @@ func CreateIssueDependency(userID, issueID int64, depID int64) (err error, exist
IssueID: issueID,
PosterID: userID,
Type: CommentTypeAddedDependency,
Content: strconv.FormatInt(depID, 10),
Content: issue.Title,
DependentIssue: depID,
}
if _, err := x.Insert(comment); err != nil {
return err, exists, false
}
var depIssue = Issue{}
_, err = x.Id(issueID).Get(&depIssue)
comment = &Comment{
IssueID: depID,
PosterID: userID,
Type: CommentTypeAddedDependency,
Content: strconv.FormatInt(issueID, 10),
Content: depIssue.Title,
DependentIssue: issueID,
}
if _, err := x.Insert(comment); err != nil {
@ -129,22 +133,28 @@ func RemoveIssueDependency(userID, issueID int64, depID int64, depType int64) (e
}
// Add comment referencing the removed dependency
var issue = Issue{}
_, err = x.Id(depID).Get(&issue)
comment := &Comment{
IssueID: issueID,
PosterID: userID,
Type: CommentTypeRemovedDependency,
Content: strconv.FormatInt(depID, 10),
Content: issue.Title,
DependentIssue: depID,
}
if _, err := x.Insert(comment); err != nil {
return err
}
var depIssue = Issue{}
_, err = x.Id(issueID).Get(&depIssue)
comment = &Comment{
IssueID: depID,
PosterID: userID,
Type: CommentTypeRemovedDependency,
Content: strconv.FormatInt(issueID, 10),
Content: depIssue.Title,
DependentIssue: issueID,
}
if _, err := x.Insert(comment); err != nil {

View File

@ -197,7 +197,7 @@
<span class="text"><strong>{{.i18n.Tr "repo.issues.dependency.title"}}</strong></span>
<br>
{{if .BlockedByDependencies}}
<span class="text">This issue is blocked by:</span>
<span class="text">Closing this issue is blocked by:</span>
<div class="ui relaxed divided list">
{{range .BlockedByDependencies}}
<div class="item">
@ -224,7 +224,7 @@
{{if .BlockingDependencies}}
<div class="ui relaxed divided list">
<span class="text">This issue blocks the following issues:</span>
<span class="text">This issue blocks closing of the following issues:</span>
{{range .BlockingDependencies}}
<div class="item">
<div class="right floated content">