Skip to content

Commit 918e640

Browse files
lunnysapk
authored andcommitted
Fix wrong identify poster on a migrated pull request when submi… (#9827) (#9831)
1 parent 9809fe2 commit 918e640

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

models/issue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,7 @@ func (issue *Issue) HashTag() string {
429429

430430
// IsPoster returns true if given user by ID is the poster.
431431
func (issue *Issue) IsPoster(uid int64) bool {
432-
return issue.PosterID == uid
432+
return issue.OriginalAuthorID == 0 && issue.PosterID == uid
433433
}
434434

435435
func (issue *Issue) hasLabel(e Engine, labelID int64) bool {

routers/repo/pull_review.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,7 @@ func SubmitReview(ctx *context.Context, form auth.SubmitReviewForm) {
117117

118118
// can not approve/reject your own PR
119119
case models.ReviewTypeApprove, models.ReviewTypeReject:
120-
121-
if issue.Poster.ID == ctx.User.ID {
122-
120+
if issue.IsPoster(ctx.User.ID) {
123121
var translated string
124122

125123
if reviewType == models.ReviewTypeApprove {

0 commit comments

Comments
 (0)