Skip to content

Commit

Permalink
Fix wrong identify poster on a migrated pull request when submi… (#9827
Browse files Browse the repository at this point in the history
…) (#9831)
  • Loading branch information
lunny authored and sapk committed Jan 17, 2020
1 parent 9809fe2 commit 918e640
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion models/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,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 {
Expand Down
4 changes: 1 addition & 3 deletions routers/repo/pull_review.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,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 {
Expand Down

0 comments on commit 918e640

Please sign in to comment.