aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarshit Bansal <harshitbansal2015@gmail.com>2019-01-28 18:21:30 +0530
committerzeripath <art27@cantab.net>2019-01-28 12:51:30 +0000
commitd3a334d99ad5a95001c29468fc0b7326e24b080d (patch)
treecce65171c5dfa2e19b0a943d9386ccefecf9981e
parent28d9305ea3b0c6a0294258d207e80053af4137d6 (diff)
downloadgitea-d3a334d99ad5a95001c29468fc0b7326e24b080d.tar.gz
gitea-d3a334d99ad5a95001c29468fc0b7326e24b080d.zip
Fix an error while adding a dependency via UI. (Backport #5862) (#5876)
Fixes: #5783.
-rw-r--r--models/issue_comment.go3
-rw-r--r--models/issue_dependency_test.go2
2 files changed, 3 insertions, 2 deletions
diff --git a/models/issue_comment.go b/models/issue_comment.go
index 651cbdfad1..b675990dd0 100644
--- a/models/issue_comment.go
+++ b/models/issue_comment.go
@@ -748,6 +748,9 @@ func createIssueDependencyComment(e *xorm.Session, doer *User, issue *Issue, dep
if !add {
cType = CommentTypeRemoveDependency
}
+ if err = issue.loadRepo(e); err != nil {
+ return
+ }
// Make two comments, one in each issue
_, err = createComment(e, &CreateCommentOptions{
diff --git a/models/issue_dependency_test.go b/models/issue_dependency_test.go
index deb5dbcad7..ede9e008eb 100644
--- a/models/issue_dependency_test.go
+++ b/models/issue_dependency_test.go
@@ -19,11 +19,9 @@ func TestCreateIssueDependency(t *testing.T) {
issue1, err := GetIssueByID(1)
assert.NoError(t, err)
- issue1.LoadAttributes()
issue2, err := GetIssueByID(2)
assert.NoError(t, err)
- issue2.LoadAttributes()
// Create a dependency and check if it was successful
err = CreateIssueDependency(user1, issue1, issue2)