From 69a2a29c3335e0b9d76d789c95aeba266c089b65 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Fri, 17 Jan 2020 20:38:11 +0800 Subject: [PATCH] =?UTF-8?q?Fix=20wrong=20identify=20poster=20on=20a=20migr?= =?UTF-8?q?ated=20pull=20request=20when=20submi=E2=80=A6=20(#9827)=20(#983?= =?UTF-8?q?0)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/issue.go | 2 +- routers/repo/pull_review.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/models/issue.go b/models/issue.go index 8218614ed..7c7a7c295 100644 --- a/models/issue.go +++ b/models/issue.go @@ -438,7 +438,7 @@ func (issue *Issue) HashTag() string { // IsPoster returns true if given user by ID is the poster. func (issue *Issue) IsPoster(uid int64) bool { - return issue.PosterID == uid + return issue.OriginalAuthorID == 0 && issue.PosterID == uid } func (issue *Issue) hasLabel(e Engine, labelID int64) bool { diff --git a/routers/repo/pull_review.go b/routers/repo/pull_review.go index b596d2578..9e03601c7 100644 --- a/routers/repo/pull_review.go +++ b/routers/repo/pull_review.go @@ -81,7 +81,7 @@ func SubmitReview(ctx *context.Context, form auth.SubmitReviewForm) { // can not approve/reject your own PR case models.ReviewTypeApprove, models.ReviewTypeReject: - if issue.Poster.ID == ctx.User.ID { + if issue.IsPoster(ctx.User.ID) { var translated string if reviewType == models.ReviewTypeApprove { translated = ctx.Tr("repo.issues.review.self.approval")