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 reviewers notification #28543

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Fix reviewers notification
- In `PullRequestCodeOwnersReview` use the correct functions that will
notify added reviewers.

Refs: https://codeberg.org/forgejo/forgejo/pulls/1970

(cherry picked from commit c3bdc5698901768c6a3f016cde9ff03072a5cc77)
  • Loading branch information
Gusted authored and earl-warren committed Dec 19, 2023
commit 9389a20b6bbcca544c3f075db010fbb714874a59
4 changes: 2 additions & 2 deletions services/issue/assignee.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,14 @@ func PullRequestCodeOwnersReview(ctx context.Context, pull *issues_model.Issue,

for _, u := range uniqUsers {
if u.ID != pull.Poster.ID {
if _, err := issues_model.AddReviewRequest(ctx, pull, u, pull.Poster); err != nil {
if _, err := ReviewRequest(ctx, pull, pull.Poster, u, true); err != nil {
Copy link
Member

Choose a reason for hiding this comment

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

On services/pull/pull.go:129, the transaction hasn't been submitted but the notifications on ReviewRequest and TeamReviewRequest will be sent immediately. It's not safe enough.

log.Warn("Failed add assignee user: %s to PR review: %s#%d, error: %s", u.Name, pr.BaseRepo.Name, pr.ID, err)
return err
}
}
}
for _, t := range uniqTeams {
if _, err := issues_model.AddTeamReviewRequest(ctx, pull, t, pull.Poster); err != nil {
if _, err := TeamReviewRequest(ctx, pull, pull.Poster, t, true); err != nil {
log.Warn("Failed add assignee team: %s to PR review: %s#%d, error: %s", t.Name, pr.BaseRepo.Name, pr.ID, err)
return err
}
Expand Down