Use contains_content_type_gated_content attribute, rather than the graded attribute, to determine if the content type gating paywall should be displayed. (#349)

The issue was that items with the graded attribute are not always going to be paywalled by content type gating.
AA-613
This commit is contained in:
Matthew Piatetsky
2021-02-05 12:29:08 -05:00
committed by GitHub
parent 50e649daa3
commit 7e2f495f52
4 changed files with 6 additions and 4 deletions

View File

@@ -130,7 +130,7 @@ function Unit({
isBookmarked={unit.bookmarked}
isProcessing={unit.bookmarkedUpdateState === 'loading'}
/>
{ contentTypeGatingEnabled && unit.graded && (
{contentTypeGatingEnabled && unit.containsContentTypeGatedContent && (
<Suspense
fallback={(
<PageLoading

View File

@@ -17,10 +17,10 @@ describe('Unit', () => {
{ courseId: courseMetadata.id },
), Factory.build(
'block',
{ type: 'vertical', graded: true, bookmarked: true },
{ type: 'vertical', contains_content_type_gated_content: true, bookmarked: true },
{ courseId: courseMetadata.id },
)];
const [unit, gradedUnit] = unitBlocks;
const [unit, unitThatContainsGatedContent] = unitBlocks;
beforeAll(async () => {
await initializeTestStore({ courseMetadata, unitBlocks });
@@ -43,7 +43,7 @@ describe('Unit', () => {
});
it('renders proper message for gated content', () => {
render(<Unit {...mockData} id={gradedUnit.id} />);
render(<Unit {...mockData} id={unitThatContainsGatedContent.id} />);
expect(screen.getByText('Loading learning sequence...')).toBeInTheDocument();
expect(screen.getByText('Loading locked content messaging...')).toBeInTheDocument();