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

[GH-669]: "Add org selector to create issue modal" thoratvinod:issue-669 #766

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

cyrusjc
Copy link
Contributor

@cyrusjc cyrusjc commented Apr 9, 2024

Fixes #669
Takes #675 to the finish line.

@mattermost-build
Copy link
Contributor

Hello @cyrusjc,

Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here.

@hanzei hanzei requested review from ayusht2810 and raghavaggarwal2308 and removed request for mickmister and hanzei April 9, 2024 06:54
@hanzei
Copy link
Contributor

hanzei commented Apr 9, 2024

@raghavaggarwal2308 @ayusht2810 Can you please review the community contribution?

@hanzei hanzei added 2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester labels Apr 9, 2024
@codecov-commenter
Copy link

codecov-commenter commented Apr 9, 2024

Codecov Report

Attention: Patch coverage is 2.00000% with 98 lines in your changes are missing coverage. Please review.

Project coverage is 15.93%. Comparing base (da4c4df) to head (aecfd27).
Report is 3 commits behind head on master.

Current head aecfd27 differs from pull request most recent head a95d58b

Please upload reports for the commit a95d58b to get more accurate results.

Files Patch % Lines
server/plugin/api.go 2.00% 98 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #766      +/-   ##
==========================================
- Coverage   16.16%   15.93%   -0.23%     
==========================================
  Files          17       17              
  Lines        6021     6117      +96     
==========================================
+ Hits          973      975       +2     
- Misses       5003     5097      +94     
  Partials       45       45              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@ayusht2810 ayusht2810 left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! @cyrusjc
I have just a few suggestions and clarifications.

server/plugin/api.go Outdated Show resolved Hide resolved
server/plugin/api.go Outdated Show resolved Hide resolved
server/plugin/api.go Show resolved Hide resolved
server/plugin/api.go Outdated Show resolved Hide resolved
server/plugin/api.go Outdated Show resolved Hide resolved
}
}

onChangeForOrg = (_, org) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't we remove the first parameter here, if it is not used anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could probably change it... the signature here is the same before changes:

onChange = (_, name) => {
const repo = this.props.yourRepos.find((r) => r.full_name === name);
this.props.onChange({name, permissions: repo.permissions});
}

Not sure exactly why it was written this way but I'll remove placeholder from here and the other onChange signature mention in the another suggestion

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just tested removing the first parameter and it seems like it 's vital to the functionality.

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please tell us what errors or issues you had after making the changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The repository now displays what I think are the local files on the server after removing the first parameter as shown:

Suggested change
onChangeForOrg = (_, org) => {
onChangeForOrg = (org) => {

image

@mattermost-build
Copy link
Contributor

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

c.Log.WithError(err).Warnf("Failed to list repositories")
p.writeAPIError(w, &APIErrorResponse{Message: "Failed to fetch repositories", StatusCode: http.StatusInternalServerError})
err := errors.New("Organization query param is empty")
c.Log.WithError(err).Warnf("Organization query param is empty")
Copy link
Contributor

Choose a reason for hiding this comment

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

Why have we made this change? We will be printing the same message twice in the logs with this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right, I've changed it to the following:

Suggested change
c.Log.WithError(err).Warnf("Organization query param is empty")
c.Log.Warnf("Organization query param is empty")

I'm not sure what best practices are here but I haven't seen an example of context logging without an error. Would this be okay?

p.writeAPIError(w, &APIErrorResponse{Message: "Failed to fetch repositories", StatusCode: http.StatusInternalServerError})
err := errors.New("Organization query param is empty")
c.Log.WithError(err).Warnf("Organization query param is empty")
p.writeAPIError(w, &APIErrorResponse{Message: "Bad request, must include organization name ", StatusCode: http.StatusBadRequest})
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to write Bad request in the error, as it is already stated in the status code. Also, can we use the message as present in line 1289, as it tells us where we must include the organization name? What are your thoughts on this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think you make a good point, we can just use the logging message as it's more descriptive. I've changed it include the message in line 1289.

Suggested change
p.writeAPIError(w, &APIErrorResponse{Message: "Bad request, must include organization name ", StatusCode: http.StatusBadRequest})
p.writeAPIError(w, &APIErrorResponse{Message: "Organization query is empty, must include organization name ", StatusCode: http.StatusBadRequest})

server/plugin/api.go Outdated Show resolved Hide resolved
webapp/src/action_types/index.js Outdated Show resolved Hide resolved
@mattermost-build
Copy link
Contributor

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

Copy link
Member

@mickmister mickmister left a comment

Choose a reason for hiding this comment

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

Thanks for this contribution @cyrusjc 👍 LGTM

There are some merge conflicts caused by typescript migration. Can you please take a look at this? Thank you

@cyrusjc cyrusjc closed this May 30, 2024
@cyrusjc cyrusjc force-pushed the cyrusjc/optimize-github-modal branch from 1845085 to e958064 Compare May 30, 2024 09:42
@cyrusjc
Copy link
Contributor Author

cyrusjc commented May 30, 2024

Ah I did a woopsies. I'll reopen this in a bit

@cyrusjc cyrusjc reopened this May 31, 2024
@mickmister mickmister self-requested a review May 31, 2024 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester Contributor Lifecycle/1:stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve performance of Create Issue modal repository selector
6 participants