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 @@ -447,6 +447,7 @@ func (c *Comment) loadReview(e Engine) (err error) {
447
447
return err
448
448
}
449
449
}
450
+ c .Review .Issue = c .Issue
450
451
return nil
451
452
}
452
453
Original file line number Diff line number Diff line change @@ -773,6 +773,8 @@ func ViewIssue(ctx *context.Context) {
773
773
// Render comments and and fetch participants.
774
774
participants [0 ] = issue .Poster
775
775
for _ , comment = range issue .Comments {
776
+ comment .Issue = issue
777
+
776
778
if err := comment .LoadPoster (); err != nil {
777
779
ctx .ServerError ("LoadPoster" , err )
778
780
return
@@ -850,8 +852,11 @@ func ViewIssue(ctx *context.Context) {
850
852
continue
851
853
}
852
854
if err = comment .Review .LoadAttributes (); err != nil {
853
- ctx .ServerError ("Review.LoadAttributes" , err )
854
- return
855
+ if ! models .IsErrUserNotExist (err ) {
856
+ ctx .ServerError ("Review.LoadAttributes" , err )
857
+ return
858
+ }
859
+ comment .Review .Reviewer = models .NewGhostUser ()
855
860
}
856
861
if err = comment .Review .LoadCodeComments (); err != nil {
857
862
ctx .ServerError ("Review.LoadCodeComments" , err )
You can’t perform that action at this time.
0 commit comments