Skip to content

[MM-420] Add feature to support multiple orgs in plugin settings - #773

Merged
raghavaggarwal2308 merged 15 commits into
masterfrom
MM-420
Jul 30, 2024
Merged

[MM-420] Add feature to support multiple orgs in plugin settings#773
raghavaggarwal2308 merged 15 commits into
masterfrom
MM-420

Conversation

@ayusht2810

Copy link
Copy Markdown
Contributor

Summary

  • Added feature to support multiple orgs in plugin settings
  • Updated Readme

Ticket Link

Fixes #552

What to test?

  • Add comma separated organizations name in plugin settings.
  • Test all the features required with the above change and check if we get all the details related to different organization

Checklist

  • Completed dev testing
  • make test Ran test cases and ensured they are passing
  • make check-style Ran style check and ensured both webapp and server pass the checks

@ayusht2810 ayusht2810 self-assigned this Apr 30, 2024
@ayusht2810 ayusht2810 added the 2: Dev Review Requires review by a core committer label Apr 30, 2024

@hanzei hanzei left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looking forward to using this feature on Community!

Comment thread server/plugin/utils_test.go Outdated
}
}

func TestGetOrganizations(t *testing.T) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Table tests ❤️

Comment thread server/plugin/api.go Outdated
Comment thread server/plugin/plugin.go Outdated
Comment thread server/plugin/utils.go Outdated
Comment thread server/plugin/utils.go Outdated
Comment thread server/plugin/utils.go
if len(org) != 0 {
orgField = fmt.Sprintf("org:%v", org)
for _, org := range orgs {
if len(org) != 0 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can org be ""?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, if a user enters orgA,orgB, as values in the system console, the last value after splitting the string will be an empty string.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we guard for that case in getOrganizations?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Should we guard for that case in getOrganizations?

@hanzei Can you please elaborate more on this comment? We have already added the guard to the getOrganizations function. Do you mean to remove it from here and apply the condition separately, wherever it is required?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The slice returned from getOrganizations can never contain an empty string, right? Do we need the additional check here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@hanzei There was an additional check present in the lhs_request.go file, which I have removed now. Now, we only have this check present in the getOrganizations function.

Comment thread server/plugin/utils.go Outdated
Comment thread server/plugin/plugin.go Outdated
Comment thread server/plugin/api.go Outdated
Comment thread server/plugin/utils.go Outdated
…pdate function definition and minor reveiw fixes
@ayusht2810

Copy link
Copy Markdown
Contributor Author

@hanzei fixed the review comments. Please re-review.

@ayusht2810
ayusht2810 requested a review from hanzei May 1, 2024 16:57
Comment thread server/plugin/utils.go Outdated
Comment thread server/plugin/utils.go
if len(org) != 0 {
orgField = fmt.Sprintf("org:%v", org)
for _, org := range orgs {
if len(org) != 0 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we guard for that case in getOrganizations?

Comment thread server/plugin/plugin.go Outdated
@ayusht2810

Copy link
Copy Markdown
Contributor Author

@hanzei Fixed the review comments. Please re-review

@ayusht2810
ayusht2810 requested a review from hanzei May 7, 2024 12:01

@hanzei hanzei left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 🚀

Comment thread server/plugin/plugin.go Outdated
Comment thread server/plugin/utils.go
if len(org) != 0 {
orgField = fmt.Sprintf("org:%v", org)
for _, org := range orgs {
if len(org) != 0 {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The slice returned from getOrganizations can never contain an empty string, right? Do we need the additional check here?

@mickmister mickmister left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Awesome work on this! 🚀 I have a few suggestions and questions to make sure we don't miss anything here. Nice work!

Comment thread README.md Outdated
Comment thread plugin.json Outdated
Comment thread server/plugin/configuration.go
Comment thread server/plugin/graphql/lhs_request.go
Comment thread webapp/src/components/sidebar_right/sidebar_right.jsx
Comment thread webapp/src/components/sidebar_right/sidebar_right.jsx Outdated
Comment thread webapp/src/reducers/index.js Outdated
Comment thread server/plugin/plugin.go
Comment thread server/plugin/plugin.go Outdated

@AayushChaudhary0001 AayushChaudhary0001 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This PR has been tested for the following scenario:

  • Support for multiple orgs
  • Data updated for multiple orgs in LHS
  • Notification for all the orgs for which subscription is created

The PR was wroking fine for all the above scenarios, LGTM. Approved.

@mickmister

Copy link
Copy Markdown
Contributor

@AayushChaudhary0001 Did you also test the case of not having an org configured?

@AayushChaudhary0001

Copy link
Copy Markdown

@mickmister Yes, I have tested it with empty field as well for the org support, works fine even if no org is added.

@mickmister

Copy link
Copy Markdown
Contributor

@AayushChaudhary0001 Got it, thank you 👍

@mickmister

Copy link
Copy Markdown
Contributor

@ayusht2810 There are some conflicts to resolve here

@mickmister

Copy link
Copy Markdown
Contributor

@Kshitij-Katiyar @raghavaggarwal2308 I'm curious where this is at currently? On the community server we're currently unable to efficiently collaborate on the mattermost-community projects. Not super urgent, but I don't want this to fall through here. Just checking in

@raghavaggarwal2308 raghavaggarwal2308 added this to the v2.3.0 milestone Jun 21, 2024
@Kshitij-Katiyar

Copy link
Copy Markdown
Contributor

@mickmister Fixed the conflicts and updated the code with the suggestions. Please have a look.

Comment thread webapp/src/reducers/index.ts
Comment thread webapp/src/types/github_types.ts
@Kshitij-Katiyar

Copy link
Copy Markdown
Contributor

@mickmister Fixed the suggestions, please have a look.

@AayushChaudhary0001

Copy link
Copy Markdown

@ayusht2810 I found a issue while testing this PR:
Issue: Data is not getting updated for multiple orgs in LHS

Steps to reproduce:

  1. Connect a github account to Mattermost
  2. Go to plugin settings of Github on Mattermost
  3. Add multiple orgs
  4. Check the data in LHS

Actual - Multiple orgs data is not getting updated in LHS
Expected - Multiple orgs data should get updated in LHS

@hanzei hanzei added the 3: QA Review Requires review by a QA tester label Jul 8, 2024
@raghavaggarwal2308 raghavaggarwal2308 modified the milestones: v2.3.0, v2.4.0 Jul 8, 2024
@raghavaggarwal2308

Copy link
Copy Markdown

@AayushChaudhary0001 The above issue is fixed now. Please re-test.

@arush-vashishtha arush-vashishtha left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This PR has been tested for the following scenarios:

  • Support for multiple orgs
  • Data updated for multiple orgs in LHS
  • Notification for all the orgs for which subscription is created

The PR was working fine for all the above mentioned conditions, LGTM. Approved

Comment thread plugin.json Outdated
Co-authored-by: Doug Lauder <wiggin77@warpmail.net>
@wiggin77 wiggin77 removed the 2: Dev Review Requires review by a core committer label Jul 29, 2024
@raghavaggarwal2308
raghavaggarwal2308 merged commit d1a6d8d into master Jul 30, 2024
@raghavaggarwal2308
raghavaggarwal2308 deleted the MM-420 branch July 30, 2024 07:52
@hanzei hanzei added 4: Reviews Complete All reviewers have approved the pull request and removed 3: QA Review Requires review by a QA tester labels Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4: Reviews Complete All reviewers have approved the pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement: Make it possible to configure multiple GitHub Organizations

8 participants