Skip to content
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

feat: configuration to block unsupported types while pasting in library [FC-0062] #35633

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2724,6 +2724,7 @@

######################## Setting for content libraries ########################
MAX_BLOCKS_PER_CONTENT_LIBRARY = 1000
LIBRARY_UNSUPPORTED_BLOCKS = ['openassessment', 'lti', 'library_content']

################# Student Verification #################
VERIFY_STUDENT = {
Expand Down
1 change: 1 addition & 0 deletions cms/envs/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ def get_env_setting(setting):

######################## Setting for content libraries ########################
MAX_BLOCKS_PER_CONTENT_LIBRARY = ENV_TOKENS.get('MAX_BLOCKS_PER_CONTENT_LIBRARY', MAX_BLOCKS_PER_CONTENT_LIBRARY)
LIBRARY_UNSUPPORTED_BLOCKS = ENV_TOKENS.get('LIBRARY_UNSUPPORTED_BLOCKS', LIBRARY_UNSUPPORTED_BLOCKS)

########################## Derive Any Derived Settings #######################

Expand Down
1 change: 1 addition & 0 deletions lms/envs/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -5202,6 +5202,7 @@ def _make_locale_paths(settings): # pylint: disable=missing-function-docstring

######################## Setting for content libraries ########################
MAX_BLOCKS_PER_CONTENT_LIBRARY = 1000
LIBRARY_UNSUPPORTED_BLOCKS = ['openassessment', 'lti', 'library_content']

######################## Setting for django-countries ########################
# django-countries provides an option to make the desired countries come up in
Expand Down
1 change: 1 addition & 0 deletions lms/envs/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -993,6 +993,7 @@ def get_env_setting(setting):

######################## Setting for content libraries ########################
MAX_BLOCKS_PER_CONTENT_LIBRARY = ENV_TOKENS.get('MAX_BLOCKS_PER_CONTENT_LIBRARY', MAX_BLOCKS_PER_CONTENT_LIBRARY)
LIBRARY_UNSUPPORTED_BLOCKS = ENV_TOKENS.get('LIBRARY_UNSUPPORTED_BLOCKS', LIBRARY_UNSUPPORTED_BLOCKS)

########################## Derive Any Derived Settings #######################

Expand Down
2 changes: 2 additions & 0 deletions openedx/core/djangoapps/content_libraries/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,8 @@ def validate_can_add_block_to_library(
block_type=block_type, library_type=content_library.type,
)
)
if block_type in settings.LIBRARY_UNSUPPORTED_BLOCKS:
raise IncompatibleTypesError(_('Libraries do not support this type of content yet.'))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should we include block_type in the message?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the current message is enough as we are using the Toast to show the message.


# If adding a component would take us over our max, return an error.
component_count = authoring_api.get_all_drafts(content_library.learning_package.id).count()
Expand Down
Loading