[GH-669]: "Add org selector to create issue modal" thoratvinod:issue-669 - #766
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. |
ayusht2810
left a comment
There was a problem hiding this comment.
Thanks for the contribution! @cyrusjc
I have just a few suggestions and clarifications.
| } | ||
| } | ||
|
|
||
| onChangeForOrg = (_, org) => { |
There was a problem hiding this comment.
Can't we remove the first parameter here, if it is not used anywhere?
There was a problem hiding this comment.
We could probably change it... the signature here is the same before changes:
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.
Just tested removing the first parameter and it seems like it 's vital to the functionality.
There was a problem hiding this comment.
Can you please tell us what errors or issues you had after making the changes?
|
This PR has been automatically labelled "stale" because it hasn't had recent activity. |
| 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.
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.
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?
| 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.
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.
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.
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. |
@raghavaggarwal2308 How much/time effort is needed to get this working with the current master branch? |
|
@wiggin77 I think it will take around 1 day to get this working with the master branch. Also, we will have to close this PR and create a new one, since this is created from a separate fork. |
|
@raghavaggarwal2308 let me know if/when this becomes ready for review. |
…ub into cyrusjc/optimize-github-modal
|
@wiggin77 I have resolved the conflicts on this PR, You can have a look |
| githubClient := p.githubConnectUser(c.Context.Ctx, c.GHInfo) | ||
| orgList, err := getOrganizationList(c.Ctx, "", githubClient, github.ListOptions{PerPage: 50}) | ||
| if err != nil { | ||
| c.Log.WithError(err).Warnf("Failed to list organizations") |
There was a problem hiding this comment.
Shouldn't this be an error level log? It is returning a 500 error on the request.
Same with all the other places a 500 error is written on the response.
There was a problem hiding this comment.
@cyrusjc is not actively working on this PR so I will be fixing these issuse
There was a problem hiding this comment.
@wiggin77 I have fixed these issues at multiple places
@Kshitij-Katiyar there is a problem with the logging levels. |
@wiggin77 Done with the fixes |
AayushChaudhary0001
left a comment
There was a problem hiding this comment.
The PR is tested, and code changes are working fine on adding an organisation selector in the create issue modal to filter the repositories based on organisations for both MM local and cloud server, including public and private repositories.
LGTM, Approved.
Merge upstream mattermost-plugin-github (…4b03e0c, ~40 commits up to just before the React 18 migration) into the Forgejo fork. Resolved conflicts case-by-case: upstream logic by default, Forgejo specifics preserved. Key resolutions / deviations from upstream: - Telemetry removed (upstream mattermost#952): experimental/telemetry was dropped from server/public v0.1.21, so telemetry.go deleted and all tracker call sites removed (api.go, flows.go, plugin.go). Forced by the dependency, not a choice. - graphql/ stays removed (fork already dropped it); go.mod tidied (shurcooL deps). - Ported useGitHubClient + handleRevokedToken into plugin.go (Forgejo wording) so upstream's token-revocation handling works; wired into label/assignee/ milestone fetchers. - Brought in org selector endpoints mattermost#766 (getOrganizations/getReposByOrg/ getRepository, getOrganizationList, RepoResponse/RepositoryResponse types), adapted to Forgejo names and the fork's package-level getRepositoryList/ getRepositoryListByOrg signatures. - Brought in default-repo command mattermost#938 (handlers + DefaultRepoKey/ErrNotFound), wired "default-repo" into CommandHandlers and autocomplete (was unused). - Adopted upstream log-spam fix mattermost#951 and connect error propagation mattermost#934 with Forgejo wording; kept the fork's refresh-token decryption path. - link_tooltip: openedByLink prefers user.html_url, falls back to the configured Forgejo instance (forgejo.pyn.ru) instead of github.com. - webapp TS migrations: ported Forgejo renames into the new client.ts and user_attribute.ts/.tsx (getForgejoUser, forgejoUsers, baseURL, fa-git). - post-menu create-issue/attach-comment adopted upstream's functional component form (registerPostDropdownMenuAction model) with Forgejo naming. Tests: kept the fork's api_test/command_test/webhook_test (upstream's new github-shaped suites mattermost#855 not ported in M1); updated help-command test (help no longer fetches user info) and link_tooltip fallback test for Forgejo. Gate: go build/vet/test, golangci-lint v2, webapp build/tsc/eslint/jest, make dist — all green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Fixes #669
Takes #675 to the finish line.