Skip to content

Conversation

@ChrisChV
Copy link
Contributor

@ChrisChV ChrisChV commented Mar 22, 2025

Description

  • Added publish_status field to Container document in search index.
  • Created content_libraries/api/dataclass.py and moved API Data classes to this file.
  • Added get_containers_contains_component in containers API.
  • Added send_container_updated_events in library context
  • Call LIBRARY_CONTAINER_UPDATED in
    • set_library_block_olx
    • delete_library_block
  • Which edX user roles will this change impact? "Developer".

Supporting information

Testing instructions

  • Verify that the test covers the new code.
  • On cms python shell run this code to create a library, create components, create units and add the components to the units:
from openedx.core.djangoapps.content_libraries import api
from organizations.models import Organization
from opaque_keys.edx.keys import UsageKey
from openedx_learning.api import authoring as authoring_api
from datetime import datetime, timezone
org = Organization.objects.get(name='SampleTaxonomyOrg1')
lib = api.create_library(org, 'lib1', 'Lib 1')
html_block = api.create_library_block(lib.key, 'html', 'html1')
problem_block = api.create_library_block(lib.key, 'problem', 'problem1')
unit1 = api.create_container(lib.key, api.ContainerType.Unit, 'unit-1', 'Unit 1', None)
unit2 = api.create_container(lib.key, api.ContainerType.Unit, 'unit-2', 'Unit 2', None)
api.update_container_children(
    unit1.container_key,
    [problem_block.usage_key, html_block.usage_key],
    None,
)
api.update_container_children(
    unit2.container_key,
    [html_block.usage_key],
    None,
)

  • Run tutor dev exec cms ./manage.py cms reindex_studio --experimental
  • Go to http://meilisearch.local.openedx.io:7700/ and verify the num_children of the units.
  • On cms python shell run: api.delete_library_block(problem_block.usage_key)
  • Go to meilisearch and verify the num_children of the units.
  • On cms python shell run: api.set_library_block_olx(html_block.usage_key, "<html><b>Hello world!</b></html>")
  • Check that there are no errors, as units cannot be published yet, the meilisearch does not change because it has never been published.

Deadline

None

Other information

N/A

@openedx-webhooks openedx-webhooks added the open-source-contribution PR author is not from Axim or 2U label Mar 22, 2025
@openedx-webhooks
Copy link

openedx-webhooks commented Mar 22, 2025

Thanks for the pull request, @ChrisChV!

This repository is currently maintained by @openedx/wg-maintenance-edx-platform.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are 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.

Details
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.

Copy link
Contributor

@pomegranited pomegranited left a comment

Choose a reason for hiding this comment

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

@ChrisChV One suggestion, but this change looks good. 👍

  • I tested this by ensuring that the added tests cover the expected behaviour.
  • I read through the code on open-craft#756
  • I checked for accessibility issues N/A
  • Includes documentation
  • User-facing strings are extracted for translation N/A

@ChrisChV ChrisChV force-pushed the chris/FAL-4110-unit-component-changes branch from c3406d8 to a5bcc11 Compare April 1, 2025 23:26
@ChrisChV ChrisChV changed the title feat: Update containers in search index on components update/delete feat: Update containers in search index on components update/delete [FC-0083] Apr 1, 2025
@ChrisChV ChrisChV marked this pull request as ready for review April 1, 2025 23:44
Copy link
Contributor

@navinkarkera navinkarkera left a comment

Choose a reason for hiding this comment

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

@ChrisChV Looks good. 👍

  • I tested this: (Played with tests)
  • I read through the code
  • I checked for accessibility issues
  • Includes documentation

@navinkarkera navinkarkera merged commit 1c14c3a into openedx:master Apr 2, 2025
49 checks passed
@navinkarkera navinkarkera deleted the chris/FAL-4110-unit-component-changes branch April 2, 2025 13:16
@github-project-automation github-project-automation bot moved this from Waiting on Author to Done in Contributions Apr 2, 2025
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

1 similar comment
@edx-pipeline-bot
Copy link
Contributor

2U Release Notice: This PR has been deployed to the edX production environment.

irtazaakram pushed a commit that referenced this pull request Apr 10, 2025
…FC-0083] (#36432)

* feat: Added get_containers_contains_component in containers api with tests

* feat: Add publish_status to containers search document

* feat: Add LIBRARY_CONTAINER_UPDATED whend deleted a component inside a container

* feat: Send LIBRARY_CONTAINER_UPDATED signal when updating component of container

* fix: Bugs sending LIBRARY_CONTAINER_UPDATED signal

* feat: Add publish_status of container as PublishStatus.Never by default

* refactor: ContentLibraryContainersTest to use update_container_children to add components

* style: Clean code after fix conflicts

* fix: Broken lint

* fix: lint
tonybusa pushed a commit to tonybusa/edx-platform that referenced this pull request Apr 23, 2025
…FC-0083] (openedx#36432)

* feat: Added get_containers_contains_component in containers api with tests

* feat: Add publish_status to containers search document

* feat: Add LIBRARY_CONTAINER_UPDATED whend deleted a component inside a container

* feat: Send LIBRARY_CONTAINER_UPDATED signal when updating component of container

* fix: Bugs sending LIBRARY_CONTAINER_UPDATED signal

* feat: Add publish_status of container as PublishStatus.Never by default

* refactor: ContentLibraryContainersTest to use update_container_children to add components

* style: Clean code after fix conflicts

* fix: Broken lint

* fix: lint
@mphilbrick211 mphilbrick211 added the FC Relates to an Axim Funded Contribution project label May 12, 2025
UsamaSadiq pushed a commit that referenced this pull request May 14, 2025
…FC-0083] (#36432)

* feat: Added get_containers_contains_component in containers api with tests

* feat: Add publish_status to containers search document

* feat: Add LIBRARY_CONTAINER_UPDATED whend deleted a component inside a container

* feat: Send LIBRARY_CONTAINER_UPDATED signal when updating component of container

* fix: Bugs sending LIBRARY_CONTAINER_UPDATED signal

* feat: Add publish_status of container as PublishStatus.Never by default

* refactor: ContentLibraryContainersTest to use update_container_children to add components

* style: Clean code after fix conflicts

* fix: Broken lint

* fix: lint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

FC Relates to an Axim Funded Contribution project 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.

6 participants