-
Notifications
You must be signed in to change notification settings - Fork 32
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
fix: assorted groups bug fixes #1225
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1225 +/- ##
==========================================
+ Coverage 85.35% 85.43% +0.08%
==========================================
Files 537 537
Lines 11709 11739 +30
Branches 2478 2457 -21
==========================================
+ Hits 9994 10029 +35
+ Misses 1664 1658 -6
- Partials 51 52 +1 ☔ View full report in Codecov by Sentry. |
const { data: appliesToAllContexts } = useEnterpriseGroup(subsidyAccessPolicy); | ||
|
||
const catalogGroupView = subsidyAccessPolicy?.groupAssociations?.length > 0 | ||
&& !appliesToAllContexts.appliesToAllContexts; |
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.
nit
const { data: appliesToAllContexts } = useEnterpriseGroup(subsidyAccessPolicy); | |
const catalogGroupView = subsidyAccessPolicy?.groupAssociations?.length > 0 | |
&& !appliesToAllContexts.appliesToAllContexts; | |
const { data: { appliesToAllContexts } } = useEnterpriseGroup(subsidyAccessPolicy); | |
const catalogGroupView = subsidyAccessPolicy?.groupAssociations?.length > 0 | |
&& !appliesToAllContexts; |
@@ -12,7 +12,7 @@ import LmsApiService from '../../../../data/services/LmsApiService'; | |||
* @returns The enterprise group object | |||
*/ | |||
const getEnterpriseGroup = async ({ subsidyAccessPolicy }) => { | |||
if (!subsidyAccessPolicy.groupAssociations || isEmpty(subsidyAccessPolicy.groupAssociations)) { | |||
if (subsidyAccessPolicy === undefined || isEmpty(subsidyAccessPolicy.groupAssociations)) { |
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.
nit
if (subsidyAccessPolicy === undefined || isEmpty(subsidyAccessPolicy.groupAssociations)) { | |
if (isEmpty(subsidyAccessPolicy?.groupAssociations)) { |
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.
If the policy didn't have any group associations, with the ? it would return undefined, and isEmpty(undefined) == false ramda/ramda#2507
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're using lodash's isEmpty here, and when I tried it out on the lodash site, passing in undefined
resulted in true.
Couple changes in this PR - Jira ticket
For all changes
Only if submitting a visual change