File tree Expand file tree Collapse file tree 5 files changed +49
-2
lines changed Expand file tree Collapse file tree 5 files changed +49
-2
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright 2019 The Gitea Authors. All rights reserved.
2
+ // Use of this source code is governed by a MIT-style
3
+ // license that can be found in the LICENSE file.
4
+ package integrations
5
+
6
+ import (
7
+ "net/http"
8
+ "testing"
9
+ )
10
+
11
+ func TestPullView_ReviewerMissed (t * testing.T ) {
12
+ prepareTestEnv (t )
13
+ session := loginUser (t , "user1" )
14
+
15
+ req := NewRequest (t , "GET" , "/pulls" )
16
+ session .MakeRequest (t , req , http .StatusOK )
17
+
18
+ req = NewRequest (t , "GET" , "/user2/repo1/pulls/3" )
19
+ session .MakeRequest (t , req , http .StatusOK )
20
+ }
Original file line number Diff line number Diff line change 52
52
tree_path : " README.md"
53
53
created_unix : 946684812
54
54
invalidated : true
55
+
56
+ -
57
+ id : 7
58
+ type : 21 # code comment
59
+ poster_id : 100
60
+ issue_id : 3
61
+ content : " a review from a deleted user"
62
+ line : -4
63
+ review_id : 10
64
+ tree_path : " README.md"
65
+ created_unix : 946684812
66
+ invalidated : true
Original file line number Diff line number Diff line change 70
70
content : " New review 3 rejected"
71
71
updated_unix : 946684810
72
72
created_unix : 946684810
73
+
74
+ -
75
+ id : 10
76
+ type : 3
77
+ reviewer_id : 100
78
+ issue_id : 3
79
+ content : " a deleted user's review"
80
+ updated_unix : 946684810
81
+ created_unix : 946684810
Original file line number Diff line number Diff line change @@ -419,6 +419,7 @@ func (c *Comment) loadReview(e Engine) (err error) {
419
419
return err
420
420
}
421
421
}
422
+ c .Review .Issue = c .Issue
422
423
return nil
423
424
}
424
425
Original file line number Diff line number Diff line change @@ -753,6 +753,8 @@ func ViewIssue(ctx *context.Context) {
753
753
// Render comments and and fetch participants.
754
754
participants [0 ] = issue .Poster
755
755
for _ , comment = range issue .Comments {
756
+ comment .Issue = issue
757
+
756
758
if err := comment .LoadPoster (); err != nil {
757
759
ctx .ServerError ("LoadPoster" , err )
758
760
return
@@ -830,8 +832,11 @@ func ViewIssue(ctx *context.Context) {
830
832
continue
831
833
}
832
834
if err = comment .Review .LoadAttributes (); err != nil {
833
- ctx .ServerError ("Review.LoadAttributes" , err )
834
- return
835
+ if ! models .IsErrUserNotExist (err ) {
836
+ ctx .ServerError ("Review.LoadAttributes" , err )
837
+ return
838
+ }
839
+ comment .Review .Reviewer = models .NewGhostUser ()
835
840
}
836
841
if err = comment .Review .LoadCodeComments (); err != nil {
837
842
ctx .ServerError ("Review.LoadCodeComments" , err )
You can’t perform that action at this time.
0 commit comments