-
Notifications
You must be signed in to change notification settings - Fork 152
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
base: master
Are you sure you want to change the base?
Conversation
@raghavaggarwal2308 @ayusht2810 Can you please review the community contribution? |
Codecov ReportAttention: Patch coverage is
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. |
There was a problem hiding this 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.
webapp/src/components/github_repo_selector/github_repo_selector.jsx
Outdated
Show resolved
Hide resolved
webapp/src/components/github_repo_selector/github_repo_selector.jsx
Outdated
Show resolved
Hide resolved
} | ||
} | ||
|
||
onChangeForOrg = (_, org) => { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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:
mattermost-plugin-github/webapp/src/components/github_repo_selector/github_repo_selector.jsx
Lines 36 to 39 in 6cc3429
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
webapp/src/components/github_repo_selector/github_repo_selector.jsx
Outdated
Show resolved
Hide resolved
This PR has been automatically labelled "stale" because it hasn't had recent activity. |
server/plugin/api.go
Outdated
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") |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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:
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?
server/plugin/api.go
Outdated
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}) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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}) |
This PR has been automatically labelled "stale" because it hasn't had recent activity. |
There was a problem hiding this 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
1845085
to
e958064
Compare
Ah I did a woopsies. I'll reopen this in a bit |
@Kshitij-Katiyar how does this PR relate to your recent PR handling orgs? |
@wiggin77 The PR created by us is just fixing an issue in the existing multiple org functionality on master (not released yet) and this PR is adding the functionality to just the create issue modal:
To make this PR work with the multiple org feature we will have to make some tweaks since earlier there was only one org allowed in the config but now that behavior is changed to list multiple orgs. |
Fixes #669
Takes #675 to the finish line.