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

Add reviewers selection to new pull request fixes #26289 #32403

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

CalK16
Copy link

@CalK16 CalK16 commented Nov 2, 2024

Hi, I've not done this before, so bear with me. I tried to make changes on @splitt3r 's pull request but was rejected due to a permission issue. Therefore, I had to fork my own repository and incorporate what was done in that pull request. In addition to @splitt3r and @sebastian-sauer's commits, I've also added a commit to resolve the conflicts. Furthermore, I have included two other commits to address @jpraet 's comments.

Please let me know if there is anything else I need to address. Thank you!

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Nov 2, 2024
@pull-request-size pull-request-size bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Nov 2, 2024
@github-actions github-actions bot added modifies/translation modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files modifies/frontend labels Nov 2, 2024
@pull-request-size pull-request-size bot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Nov 2, 2024
@CalK16 CalK16 changed the title Add reviewers selection to new pull request form #26596 Add reviewers selection to new pull request fixes #26289 Nov 2, 2024
@wxiaoguang
Copy link
Contributor

Thank you all for the work.

Actually IMO there are still problems in this PR, for example: incorrect CSS classes like gt-df.

There is also a blocker in repo-legacy.ts, I have proposed a refactoring PR "Refactor repo legacy #32404", after #32404, I could help to resolve the conflicts here and fix the problems.

@lunny
Copy link
Member

lunny commented Nov 2, 2024

Does this replace #26596 ?

Comment on lines 1264 to 1265
if isPull {
if len(form.ReviewerIDs) > 0 {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if isPull {
if len(form.ReviewerIDs) > 0 {
if isPull && len(form.ReviewerIDs) > 0 {

@lunny
Copy link
Member

lunny commented Nov 2, 2024

Looks like team reviewers checked by default before I chose anyone.

Some gt-* classes were replaced by the crossponding tw-* classes.
Team has negative ID while Users has positive.
We need to use TeamReviewRequest for teams and
ReviewRequest for a individual user.

Also, we have to validate the permissions before
send out the notification
@CalK16
Copy link
Author

CalK16 commented Nov 3, 2024

Looks like team reviewers checked by default before I chose anyone.

It's because of the gt-invisible HTML tag in the template. I've updated that to tw-invisible, and I've tested locally, it should be fine now. And I've also modify some gt-* classes to tw-* according to some previous commits done by other contributors.

@@ -243,7 +243,8 @@ export function initRepoCommentForm() {
initListSubmits('select-label', 'labels');
initListSubmits('select-assignees', 'assignees');
initListSubmits('select-assignees-modify', 'assignees');
initListSubmits('select-reviewers-modify', 'assignees');
initListSubmits('select-reviewers', 'reviewers');
initListSubmits('select-reviewers-modify', 'reviewers');
Copy link
Contributor

@wxiaoguang wxiaoguang Nov 3, 2024

Choose a reason for hiding this comment

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

What is select-reviewers-modify? Why it was changed to 'reviewers'?

(see below: #32403 (comment))

@@ -265,10 +267,12 @@ export function initRepoIssueSidebar() {
initListSubmits('select-label', 'labels');
initListSubmits('select-assignees', 'assignees');
initListSubmits('select-assignees-modify', 'assignees');
initListSubmits('select-reviewers', 'reviewers');
initListSubmits('select-reviewers-modify', 'assignees');
Copy link
Contributor

Choose a reason for hiding this comment

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

I have resolved some conflicts. But here I haven't read it carefully.

This PR ever changed it to initListSubmits('select-reviewers-modify', 'reviewers');

Was it done intentionally? If yes, what's the reason behind it?

Copy link
Author

@CalK16 CalK16 Nov 5, 2024

Choose a reason for hiding this comment

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

Hi, the class for reviewer list has changed to ui reviewers list so I was expecting the initListSubmits should init that list too.

https://github.com/CalK16/gitea/blob/941f7fdf806c706af3bcc5e3d4960cb4a0856a1f/templates/repo/issue/new_form.tmpl#L89C17-L89C17

Copy link
Contributor

@wxiaoguang wxiaoguang Nov 5, 2024

Choose a reason for hiding this comment

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

I do not think changing select-reviewers-modify is right. I do not see any change related to select-reviewers-modify in this PR

Copy link
Author

Choose a reason for hiding this comment

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

You are probably right. I double checked the select-reviewers-modify and found that it only applied to the sidebar for a created pull request. And that is distinguished from the select-reviewers.While this is true, I think I've done something wrong based on my previous understanding. Allow me to spend sometime working on it. Thanks for the correction.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/api This PR adds API routes or modifies them modifies/frontend modifies/go Pull requests that update Go code modifies/templates This PR modifies the template files modifies/translation size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants