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 Konrad
parent 1583a20f18
commit 707551785f
4 changed files with 26 additions and 11 deletions

View File

@ -88,6 +88,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

@ -150,8 +150,10 @@
{{$.i18n.Tr "repo.issues.dependency.added_dependency" .Poster.HomeLink .Poster.Name $createdStr | Safe}}
</span>
<div class="detail">
<span class="octicon octicon-plus"></span>
<span class="text grey">{{.Content}}</span>
<span class="text grey">
<i class="octicon octicon-plus"></i>
<a href="{{$.RepoLink}}/issues/{{.DependentIssue}}">#{{.DependentIssue}} {{.Content}}</a>
</span>
</div>
</div>
{{else if eq .Type 13}}
@ -164,8 +166,10 @@
{{$.i18n.Tr "repo.issues.dependency.removed_dependency" .Poster.HomeLink .Poster.Name $createdStr | Safe}}
</span>
<div class="detail">
<span class="text grey octicon octicon-trashcan"></span>
<span class="text grey">{{.Content}}&nbsp;</span>
<span class="text grey">
<i class="octicon octicon-trashcan"></i>
<a href="{{$.RepoLink}}/issues/{{.DependentIssue}}">#{{.DependentIssue}} {{.Content}}</a>
</span>
</div>
</div>
{{end}}

View File

@ -128,7 +128,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">
@ -155,7 +155,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">