-
Notifications
You must be signed in to change notification settings - Fork 154
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
[MM-420] Add feature to support multiple orgs in plugin settings #773
Conversation
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.
Looking forward to using this feature on Community!
server/plugin/utils_test.go
Outdated
@@ -298,3 +298,42 @@ func TestLastN(t *testing.T) { | |||
assert.Equal(t, tc.Expected, lastN(tc.Text, tc.N)) | |||
} | |||
} | |||
|
|||
func TestGetOrganizations(t *testing.T) { |
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.
Table tests ❤️
if len(org) != 0 { | ||
orgField = fmt.Sprintf("org:%v", org) | ||
for _, org := range orgs { | ||
if len(org) != 0 { |
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 org
be ""
?
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.
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.
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.
Should we guard for that case in getOrganizations
?
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.
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?
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.
The slice returned from getOrganizations
can never contain an empty string, right? Do we need the additional check here?
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.
@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.
…pdate function definition and minor reveiw fixes
@hanzei fixed the review comments. Please re-review. |
if len(org) != 0 { | ||
orgField = fmt.Sprintf("org:%v", org) | ||
for _, org := range orgs { | ||
if len(org) != 0 { |
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.
Should we guard for that case in getOrganizations
?
@hanzei Fixed the review comments. Please re-review |
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.
LGTM 🚀
if len(org) != 0 { | ||
orgField = fmt.Sprintf("org:%v", org) | ||
for _, org := range orgs { | ||
if len(org) != 0 { |
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.
The slice returned from getOrganizations
can never contain an empty string, right? Do we need the additional check here?
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.
Awesome work on this! 🚀 I have a few suggestions and questions to make sure we don't miss anything here. Nice work!
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.
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.
@AayushChaudhary0001 Did you also test the case of not having an org configured? |
@mickmister Yes, I have tested it with empty field as well for the org support, works fine even if no org is added. |
@AayushChaudhary0001 Got it, thank you 👍 |
@ayusht2810 There are some conflicts to resolve here |
@Kshitij-Katiyar @raghavaggarwal2308 I'm curious where this is at currently? On the community server we're currently unable to efficiently collaborate on the |
@mickmister Fixed the conflicts and updated the code with the suggestions. Please have a look. |
@mickmister Fixed the suggestions, please have a look. |
@ayusht2810 I found a issue while testing this PR: Steps to reproduce:
Actual - Multiple orgs data is not getting updated in LHS |
@AayushChaudhary0001 The above issue is fixed now. Please re-test. |
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.
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
Co-authored-by: Doug Lauder <[email protected]>
Summary
Ticket Link
Fixes #552
What to test?
Checklist
make test
Ran test cases and ensured they are passingmake check-style
Ran style check and ensured both webapp and server pass the checks