From 7e8242ddb116b6748b008c500479ca3805107959 Mon Sep 17 00:00:00 2001 From: Harshit Bansal Date: Sun, 27 Jan 2019 17:01:40 +0530 Subject: [PATCH] Fix an error while adding a dependency via UI. (#5862) Fixes: #5783 --- models/issue_comment.go | 3 +++ models/issue_dependency_test.go | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/models/issue_comment.go b/models/issue_comment.go index 6c87650a3..fb379fa94 100644 --- a/models/issue_comment.go +++ b/models/issue_comment.go @@ -749,6 +749,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 deb5dbcad..ede9e008e 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)