* fix: "[created] received a naive datetime"
* fix: leaky "isolation" of events was causing test failures
* fix: make lib events more specific, emit them async, handle hierarchy correctly
* chore: bump openedx-events to 10.2.0 for new library PUBLISHED events
* feat: store content.child_usage_keys in Container search document
Stores the draft children + published children (if applicable)
Related fixes:
* fix: lib_api.get_container does not take a "user" arg
* refactor: fetch_customizable_fields_from_container does not need a "user" arg
* refactor: moves tags_count into LibraryItem
because anything that appears in a library may be tagged.
* refactor: remove get_container_from_key from public API
API users must use get_container and ContainerMetadata.
* refactor: made set_library_item_collections take an entity_key string instead of
a PublishableEntity instance, so we don't need to fetch a Container object to call it.
* refactor: changed ContainerLink.update_or_create to take the container PK
instead of a Container object, since this is enough.
Added container_pk to ContainerMetadata to support this.
* refactor: update sync model helper function docs
Adds some comments to explain certain confusing sections
* refactor: sync library content method
* feat: use edited_on block field
* test: modified field in course block index
* fix: extract uncommon methods to child class from base
* Added publish_display_name and last_published on container search document.
* This change is used in feat: Add unit from library in course [FC-0083] frontend-app-authoring#1829 to show only published units in the unit picker, also to show the published_display_name in the picker, and avoid empty titles.
* Which edX user roles will this change impact? "Developer".
efactors the content_libraries.api to use LibraryCollectionLocator and LibraryContainerLocator keys, instead of passing separate LibraryUsageKeyV2 keys along with the collection/container locators.
Renames misleading uses of collection_usage_key to collection_locator, including in the content_libraries.api and content.search.api method names and parameters.
This change impacts Developers, but should not affect end users.
This refactoring seems reasonable to do without going through deprecation, given the minimal use of these APIs.
* 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
* feat: add components to container api
* feat: remove and replace components in container api
* refactor: container childern api
* chore: fix lint issues
* temp: install openedx-learning dev branch
* feat: update publish_status and children count in index
* chore: fix mypy issues
* test: fix reindex test
* refactor: rebase and fix conflicts
* test: update test to check signals
* docs: document can_stand_alone flag
* chore: bump openedx-learning version
* refactor: convert libraries API from attr.s to dataclass, fix types
* fix: make corresponding updates to 'search' code
* feat: use new version of openedx-learning with containers support
* temp: Use opencraft branch of opaquekeys
* refactor: Use LibraryElementKey instead of LibraryCollectionKey
* refactor: split libraries API & REST API up into smaller modules
* feat: new REST API for units in content libraries
* feat: python+REST API to get a unit
* feat: auto-generate slug/key/ID from title of units
* feat: generate search index documents for containers
* refactor: rename LibraryElementKey to LibraryItemKey
* fix: lint error
* feat: adds new units to search index on create/update
and when running reindex_studio.
Updates requirements for openedx-events and openedx-learning to support
these changes.
* fix: pylint
* fix: temp requirement
* fix: search index container events/tasks
* feat: add get_library_container_usage_key to libraries API
and use it when search indexing containers
* fix: index all containers during reindex_studio
* chore: bump openedx-events requirement
* fix: address review comments
* chore: bumps openedx-learning to 0.19.1
* fix: rename api method to library_container_locator
since container keys are locators, not usage keys
* chore: bumps opaque-keys dependency
* test: fix misnamed unit_usage_key
* feat: adds APIs to update or delete a container (#757)
* feat: adds python and REST APIs to update a container's display_name
* refactor: adds _get_container method to api to reduce code duplication
* feat: adds python and REST APIs to delete a container
* test: add container permission tests
---------
Co-authored-by: XnpioChV <xnpiochv@gmail.com>
Co-authored-by: Jillian Vogel <jill@opencraft.com>
Co-authored-by: Rômulo Penido <romulo.penido@gmail.com>
Adds the publish status field to the libraries v2 meilisearch index in order to support filtering by component publish status: published, modified, never.
Fixed component counter synchronization in these cases:
* When deleting a component inside a collection.
* With the library published, when adding a new component in a collection and reverting library changes.
* With the library published, when deleting a component inside a collection and reverting library changes.
Also adds a published > num_counts field in collections in the search index.
PII Annotations are very out of date, this commit adds most that were
missing in edx-platform, and some additional annotations to the
safelist. It is not comprehensive, several other upstream Open edX
packages also need to be updated. It also does not include removing
annotations that have been moved upstream, or been removed entirely.
Those are separate follow-on tasks.
We don't call the modulestore or update the cache here now that we are
backed by the database model. Previously the cache would change because
the `_encode_root_cache_key` function in `BlockStructureStore` class
used the `BlockstoreBlockData.VERSION` as a part of the cache key when
the data was not being cached in a DB model.
Previously, we were not caching BlockStructures to the database when we
were adding them to the store by default. Now that we are doing that,
the BlockStructureFactory test failed because it was taking a shortcut
that would no longer work. It was just creating a blockstructure that
had relations but not any block information.
Now that we're always persisting updates to the database, this broke
because to persist the structure to the database, we have to look up the
block information from the block_structure which now fails.
This change updates the test mixin to add more data so that the content
can be persisted to the database successfully as a part of this test.
This work is part of DEPR https://github.com/openedx/public-engineering/issues/32
Now that we've removed all uses for this switch remove the decleration
as well.
BREAKING CHANGE: The `block_structure.storage_backing_for_cache` will no
longer exist and its value will be ignored. If you have this switch set
in your instance you can remove it. The backing cache is now always ON.
Remove the `enable_storage_backing_for_cache_in_request` function and
its uses in the platform. The function is no longer needed because the
storage backing for the block_structure cache will be ON by default
moving forward.
BREAKING CHANGE: This `enable_storage_backing_for_cache_in_request`
function no longer exists and any calls to it should be removed. The
cache it enables is now always ON.
At one point, we envisioned having different kinds of libraries, e.g.
a "Video" library would be distinct from a "Problem" library. Later on,
we decided on a more generalized form of Libraries, where any given
library can hold any combination of content–which would then be
organized using collections and tagging.
Due to this shift in perspective, these values haven't actually been
used for a long time. This is just getting rid of them altogether.
* refactor: use django signals to trigger LIBRARY_COLLECTION events
* refactor: use collection usage_key as search document id
This change standardises the search document "id" to be a meilisearch ID
generated from the usage key, for all types of indexed objects.
This is important for collections so we can locate the collection
document in the search index solely from the data provided by the
LIBRARY_COLLECTION_DELETED event (library_key + collection_key), even if
the collection has been deleted from the database.
* refactor: avoid fetching more data than we have to.
* get_library_collection_usage_key and
searchable_doc_tags_for_collection do not need a Collection object;
the usage key can be created from the library_key and collection_key.
* updated searchable_doc_for_collection to require the parts of the
collection usage key + an optional collection. This allows us to
identify the collection's search document from its usage key without
requiring an existing Collection object (in case it's been deleted).
Also removes the edge case for indexing Collections not associated
with a ContentLibrary -- this won't ever really happen.
* feat: remove soft- and hard-deleted collections from search index
* feat: adds library_component_usage_key to content_libraries.api
* refactor: send CONTENT_OBJECT_ASSOCIATON_CHANGED on django model signals
so that added/removed collections are removed/re-added to component documents.
Special case: When a collection is soft-deleted/restored, we detect this
in the search index and update the collection's component documents
directly, without a CONTENT_OBJECT_ASSOCIATON_CHANGED signal.
* chore: bumps openedx-learning to 0.13.0