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 5252 tree_path : " README.md"
5353 created_unix : 946684812
5454 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 7070 content : " New review 3 rejected"
7171 updated_unix : 946684810
7272 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) {
419419 return err
420420 }
421421 }
422+ c .Review .Issue = c .Issue
422423 return nil
423424}
424425
Original file line number Diff line number Diff line change @@ -753,6 +753,8 @@ func ViewIssue(ctx *context.Context) {
753753 // Render comments and and fetch participants.
754754 participants [0 ] = issue .Poster
755755 for _ , comment = range issue .Comments {
756+ comment .Issue = issue
757+
756758 if err := comment .LoadPoster (); err != nil {
757759 ctx .ServerError ("LoadPoster" , err )
758760 return
@@ -830,8 +832,11 @@ func ViewIssue(ctx *context.Context) {
830832 continue
831833 }
832834 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 ()
835840 }
836841 if err = comment .Review .LoadCodeComments (); err != nil {
837842 ctx .ServerError ("Review.LoadCodeComments" , err )
You can’t perform that action at this time.
0 commit comments