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

Conversation

navinkarkera
Copy link
Contributor

@navinkarkera navinkarkera commented Oct 10, 2024

Description

Adds setting to stop authors from pasting unsupported block types in libraries

  • Which edX user roles will this change impact?: "Course Author"

Supporting information

Testing instructions

See openedx/frontend-app-authoring#1378 for test instructions.

Deadline

ASAP

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Oct 10, 2024
@openedx-webhooks
Copy link

openedx-webhooks commented Oct 10, 2024

Thanks for the pull request, @navinkarkera!

What's next?

Please work through the following steps to get your changes ready for engineering review:

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.

🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads

🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

🔘 Let us know that your PR is ready for review:

Who will review my changes?

This repository is currently maintained by @openedx/wg-maintenance-edx-platform. Tag them in a comment and let them know that your changes are ready for review.

Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@openedx-webhooks
Copy link

Thanks for the pull request, @navinkarkera!

What's next?

Please work through the following steps to get your changes ready for engineering review:

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.

🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads

🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

🔘 Update the status of your PR

Your PR is currently marked as a draft. After completing the steps above, update its status by clicking "Ready for Review", or removing "WIP" from the title, as appropriate.

🔘 Let us know that your PR is ready for review:

Who will review my changes?

This repository is currently maintained by @openedx/wg-maintenance-edx-platform. Tag them in a comment and let them know that your changes are ready for review.

Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

Adds setting to stop authors from pasting unsupported block types in
libraries
@navinkarkera navinkarkera force-pushed the navin/configure-unsupported-block-types branch from 37cef00 to 3459209 Compare October 11, 2024 06:56
@navinkarkera navinkarkera marked this pull request as ready for review October 11, 2024 07:06
@navinkarkera navinkarkera changed the title feat: configuration to block unsupported types in paste feat: configuration to block unsupported types while pasting in library Oct 11, 2024
@navinkarkera navinkarkera changed the title feat: configuration to block unsupported types while pasting in library feat: configuration to block unsupported types while pasting in library [FC-0062] Oct 11, 2024
@@ -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.

Copy link
Contributor

@rpenido rpenido left a comment

Choose a reason for hiding this comment

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

LGTM 👍
Thank you for your work, @navinkarkera!

@@ -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

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.

@bradenmacdonald
Copy link
Contributor

I think this should be an allowlist, not a denylist. Anything other than Problem, Text, or Video is not going to work in libraries at the moment. But the reason for that is mostly that the frontend doesn't yet support the editors for those types, so I am almost inclined to have this check only on the frontend. [If you're using the backend only through APIs and OLX, almost any type of XBlock should work fine in content libraries v2. It's just the new frontend that doesn't support editors/previews for most XBlocks yet.]

@DanielVZ96
Copy link
Contributor

I agree with braden's inclination. It feels weird that in the future when a new type is supported by the frontend it'll need a PR for both the frontend and the backend.

@navinkarkera
Copy link
Contributor Author

I think this should be an allowlist, not a denylist.

@bradenmacdonald Yes, if the allowed blocks are fixed than it is better to have an allowlist. My impression was that only few blocks are not supported.

But the reason for that is mostly that the frontend doesn't yet support the editors for those types, so I am almost inclined to have this check only on the frontend.

Makes sense, I'll close this PR and move this check in frontend.

It feels weird that in the future when a new type is supported by the frontend it'll need a PR for both the frontend and the backend.

@DanielVZ96 It won't need a PR in both frontend and backend as it is configured only in backend, frontend is only displaying the server error message. But it does make sense to move this check to frontend as it is limited by frontend's ability to edit them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
open-source-contribution PR author is not from Axim or 2U
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

5 participants