Fix wrong identify poster on a migrated pull request when submi… (#9827)

This commit is contained in:
Lunny Xiao 2020-01-17 18:23:46 +08:00 committed by Antoine GIRARD
parent 3c07d03c03
commit 088759f180
2 changed files with 2 additions and 2 deletions

View file

@ -440,7 +440,7 @@ func (issue *Issue) HashTag() string {
// IsPoster returns true if given user by ID is the poster. // IsPoster returns true if given user by ID is the poster.
func (issue *Issue) IsPoster(uid int64) bool { 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 { func (issue *Issue) hasLabel(e Engine, labelID int64) bool {

View file

@ -83,7 +83,7 @@ func SubmitReview(ctx *context.Context, form auth.SubmitReviewForm) {
// can not approve/reject your own PR // can not approve/reject your own PR
case models.ReviewTypeApprove, models.ReviewTypeReject: case models.ReviewTypeApprove, models.ReviewTypeReject:
if issue.Poster.ID == ctx.User.ID { if issue.IsPoster(ctx.User.ID) {
var translated string var translated string
if reviewType == models.ReviewTypeApprove { if reviewType == models.ReviewTypeApprove {
translated = ctx.Tr("repo.issues.review.self.approval") translated = ctx.Tr("repo.issues.review.self.approval")