Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wrong identify poster on a migrated pull request when submit review #9827

Merged
merged 1 commit into from
Jan 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion models/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to confirm from what I have understand when migrating if the user exist OriginalAuthorID is not and set and issue.PosterID is not the doer (like it is by default) but found user ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If OriginalAuthorID > 0, PosterID means migrator but not poster id. OriginalAuthorID is an external system id not gitea user id.

}

func (issue *Issue) hasLabel(e Engine, labelID int64) bool {
Expand Down
2 changes: 1 addition & 1 deletion routers/repo/pull_review.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,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")
Expand Down