-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Share with group membership only #29241
Conversation
Codecov Report
@@ Coverage Diff @@
## master #29241 +/- ##
============================================
+ Coverage 59.39% 59.4% +<.01%
- Complexity 17165 17168 +3
============================================
Files 1027 1027
Lines 57223 57232 +9
============================================
+ Hits 33990 33998 +8
- Misses 23233 23234 +1
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #29241 +/- ##
============================================
+ Coverage 59.39% 60.53% +1.13%
- Complexity 17165 17191 +26
============================================
Files 1027 1031 +4
Lines 57223 57284 +61
============================================
+ Hits 33990 34677 +687
+ Misses 23233 22607 -626
Continue to review full report at Codecov.
|
@phil-davis @individual-it could you check if the failing test is related with this PR's changes? I'm not sure if it's "just" a random failure or if it's something that needs to be fixed. |
@jvillafanez I scanned through your code diffs and there is nothing touching the front-end that should make the test fail like it did (cannot even find the "share with" element on the page). So I restarted the job and we will see. |
@jvillafanez can you also add integration tests ? Feel free to ask @SergioBertolinSG for some assistance. |
I'll check what we can add easily during today and tomorrow. |
Need an assignment here, who continues work on this? |
Assigned to @jvillafanez |
I've found a problem with the share API (probably known) that affects to all the sharing tests. The problem is that the response of the sharing API is different depending on the number of results it needs to return. For only one group available in the results:
If there are several results:
Note that if there is only one element available, that element is returned under the "element" key, but if there are several elements, the "element" key returns an array of elements. This will likely happen with the users, although I haven't checked. This problem affects the new tests because we need at least 2 groups. In order to do so, we'll need to patch the underlying test code to accept both possibilities so the parsing is properly done (this will error prone since we can't distinguish both options in a clear way, checking if the key is an integer is ugly but there isn't any other easy way). The best option would be to fix the problem in the sharing API, but that's out of the scope of this PR (it will also need to fix the tests). |
@SergioBertolinSG could you take over for the integration tests? Note my last comment. |
And (I think) @individual-it put his hand up to add some UI tests for this. There are already UI tests of this sharing area, so it should be just a matter of setting the new system option and then testing that the sharing dropdown now contains just the expected items. |
@jvillafanez I can take care after finishing the pending tasks I have (which are several). Is that ok? Otherwise you should continue. |
Waiting for automatic testing.... other than that, this should be ready |
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.
👍 for the behat tests
@jvillafanez seems to work fine. One thing that bothers me is that the behavior will change on update. To recreate the old behavior, one needs to check both checkboxes. We should write a migration to automatically tick the second checkbox if the first one was checked on update to avoid surprising admins with a sudden change of behavior. Then the admin can decide to tweak if needed. @jvillafanez does that make sense ? |
Migration incomming! |
Migration added (not tested yet) I don't think we need to check the OC version as long as the migrations are run only once (which is what I expect). Under these circumstances, copy the value from one key to another should do the trick. |
@jvillafanez migrations are run only once, yes. Keep in mind that migrations also run at install time so make sure it also works in that situation. |
LGTM |
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.
👍
@jvillafanez seems codecov is not happy, might be missing some test coverage ? |
@jvillafanez I checked the report. Not all is coverable (ignore the migration), please write tests for the changes in ShareesController. |
@jvillafanez please backport to stable10 |
stable10 backport in #29391 |
UI tests in #29406 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
Add an option to allow user to share only with the groups they belong to. If a user isn't a member of a group, that group won't appear as an option to share with it
Related Issue
#29075
Motivation and Context
Users can share with any group. This option restricts that behaviour in a similar way the "share with users in their groups" option does.
How Has This Been Tested?
Tested quickly with the sharing dialog. Other than that, consider this PR as untested for now. New unittests will be added soon.
Screenshots (if appropriate):
Types of changes
Checklist: