Commit Graph

529 Commits

Author SHA1 Message Date
Daniel Valenzuela
182bfc4031 feat: add publish status to library meilisearch index [FC-0076] (#36031)
Adds the publish status field to the libraries v2 meilisearch index in order to support filtering by component publish status: published, modified, never.
2025-02-05 17:30:19 +00:00
Navin Karkera
cd9b90fc21 feat: show math in plain text in library cards (#36055)
Converts mathjax equations to unicode to be rendered as plain text in library card previews
2025-01-13 13:09:47 -05:00
Kyle D. McCormick
50944e9d75 build: Very explicitly annotate a model field so that it passes mypy
This clunky yet type-safe workaround to this django-stubs issue, which
arose when we upgraded django-stubs in the previous commits:
https://github.com/typeddjango/django-stubs/issues/1802
2025-01-02 14:42:09 -05:00
Navin Karkera
971afe6095 feat: api to restore soft-deleted component [FC-0076] (#35993)
Adds API to handle restoring soft-deleted library blocks.
2024-12-13 13:17:46 -05:00
Tim McCormack
b6774f59f3 docs: Remove mention of storage_backing_for_cache flag
The Waffle switch `block_structure.storage_backing_for_cache` was removed in https://github.com/openedx/edx-platform/pull/35185 -- this is just a lingering reference in a setting comment.
2024-12-09 17:20:34 -05:00
Daniel Valenzuela
b07464ba2d feat: incremental reindex_studio management command (#35864)
This allows large instances to run an (interruptable, resumable) reindex task that can cover thousands of courses.
2024-12-06 12:30:38 -08:00
Chris Chávez
d5850c812c fix: keep library collection card component count in sync (#35734)
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.
2024-11-19 15:45:34 -05:00
Irtaza Akram
ec2a698604 cleanup references of python 2 & <3.11 (#35799)
* chore: cleanup of old python references
2024-11-15 16:58:20 +05:00
Peter Pinch
5d1566c4c2 Merge pull request #35655 from mitodl/asad/bypass-access-checks-when-populating-cache
fix: bypass access checks when populating course blocks cache
2024-11-06 12:22:25 -05:00
Brian Mesick
767e1a2c07 Merge pull request #35779 from openedx/bmtcril/pii_safelist_update
chore: Add missing PII annotations, update safelist
2024-11-06 16:27:09 +00:00
Brian Mesick
e478975105 chore: Add missing PII annotations, update safelist
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.
2024-11-05 12:58:36 -05:00
Feanil Patel
4768568b5a fixup! feat!: Drop the block_structure.storage_backing_for_cache waffle switch. 2024-11-05 10:44:17 -05:00
Feanil Patel
8741417806 docs: Cross link to wiki docs related to block structures.
Provide a link to more docs from the code in case we need more context
in the future.
2024-11-05 10:44:17 -05:00
Feanil Patel
e5f698a5a7 feat: Remove the unused StubModel class.
Now that the model backed cache is on by default, we don't need to keep
the StubModel object around.
2024-11-05 10:44:16 -05:00
Feanil Patel
e52253d3e1 test: Change call counts with model back as default.
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.
2024-11-05 10:44:16 -05:00
Feanil Patel
9164e92465 test: Update a BlockStructureFactory test mixin.
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.
2024-11-05 10:44:16 -05:00
Feanil Patel
fab0267757 feat!: Drop the block_structure.storage_backing_for_cache waffle switch.
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.
2024-11-05 10:44:16 -05:00
Feanil Patel
261b4985cd feat!: Drop an unnecessary function.
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.
2024-11-05 10:44:16 -05:00
Feanil Patel
57cdbfa013 test: Remove test variants that test without a cache.
Since the cache is now always on, remove test cases that test the case
when it's disabled.
2024-11-05 10:44:16 -05:00
Feanil Patel
16d440a4e9 feat: Turn ON the storage backing for cache by default.
Any places where the storage backing cache for block structures was on
conditionally previously it will be ON by default.
2024-11-05 10:44:16 -05:00
Asad Ali
65fd18bdcf refactor: revert imports 2024-10-31 23:26:23 +05:00
Asad Ali
d81c2d8be5 refactor: revert imports 2024-10-31 23:24:40 +05:00
Asad Ali
9ed41b0759 test: add tests for known and unknown user 2024-10-31 23:20:41 +05:00
Asad Ali
d9a27b6ba7 style: pylint 2024-10-31 23:20:40 +05:00
Asad Ali
cf3c10ba34 test: add tests 2024-10-31 23:20:40 +05:00
Asad Ali
1f86786b15 fix: bypass access checks when populating course blocks cache 2024-10-31 23:20:40 +05:00
Cristhian Garcia
e8cdb06410 feat!: remove all references to content library types (#35726)
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.
2024-10-25 14:16:56 -04:00
Chris Chávez
fb25a5d635 feat: Store published name and description in studio search index (#35678) 2024-10-21 12:25:49 -07:00
Navin Karkera
70df3deea6 feat: set collections for a library component [FC-0062] (#35600)
* feat: add & remove collections to component

Co-authored-by: Rômulo Penido <romulo.penido@gmail.com>
Co-authored-by: Chris Chávez <xnpiochv@gmail.com>
2024-10-15 15:11:54 +00:00
Braden MacDonald
8f47c0b274 fix: whitespace issues in some capa problem index_dictionary content (#35543) 2024-09-26 09:34:58 -07:00
Jillian
5446877a86 Soft delete collections (#35496)
* 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
2024-09-25 13:29:18 -05:00
Navin Karkera
c71414a247 feat: add block_id field to filterable attributes of meilisearch (#35493) 2024-09-20 12:12:41 -05:00
Braden MacDonald
00632d9cae feat: When editing a v2 library xblock, update search index synchronously (#35495) 2024-09-18 10:06:36 -07:00
Chris Chávez
5927be7e0e feat: Add collection tags to index [FC-0062] (#35483)
* feat: Add collection tags to index

* feat: Add api functions to update tags in collections

* feat: Update tags on index when tag_object
2024-09-17 11:52:02 -05:00
Jillian
c41fe89918 Store content object collections in search index [FC-0062] (#35469)
* feat: Add Library Collections REST endpoints

* test: Add tests for Collections REST APIs

* chore: Add missing __init__ files

* docs: Add warning about unstable REST APIs

* feat: emit CONTENT_OBJECT_ASSOCIATIONS_CHANGED
whenever a content object's tags or collections have changed,
and handle that event in content/search.

The deprecated CONTENT_OBJECT_TAGS_CHANGED event is still emitted when
tags change; to be removed after Sumac.

* docs: replaces CONTENT_OBJECT_TAGS_CHANGED with CONTENT_OBJECT_ASSOCIATIONS_CHANGED

* chore: updates openedx-events==9.14.0

* chore: updates openedx-learning==0.11.4

Co-authored-by: Yusuf Musleh <yusuf@opencraft.com>
Co-authored-by: Chris Chávez <xnpiochv@gmail.com>
Co-authored-by: Rômulo Penido <romulo@thinkdash.dev>
2024-09-13 08:20:54 -05:00
Yusuf Musleh
7665f13547 feat: Add Library Collections REST endpoints [FC-0062] (#35321)
* feat: Add Library Collections REST endpoints

* test: Add tests for Collections REST APIs

* chore: Add missing __init__ files

* feat: Add events emitting for Collections

* feat: Add REST endpoints to update Components in a Collections (temp) (#674)

* feat: add/remove components to/from a collection

* docs: Add warning about unstable REST APIs

* chore: updates openedx-events==9.14.0

* chore: updates openedx-learning==0.11.4

* fix: assert collection doc have unique id

---------

Co-authored-by: Jillian <jill@opencraft.com>
Co-authored-by: Chris Chávez <xnpiochv@gmail.com>
Co-authored-by: Rômulo Penido <romulo.penido@gmail.com>
2024-09-11 13:21:10 -05:00
Navin Karkera
ec34753043 fix: update library v2 search index synchronously (#35367)
Discarded components need to be removed from index in sync to make sure
that users see the latest updated data.
2024-08-30 12:16:02 -07:00
Navin Karkera
c65478e487 feat: index library collections in studio meilisearch index (#35324) 2024-08-27 10:45:46 -07:00
Chris Chávez
2e77e65d1c feat: Problem types added as filterable attribute [FC-0059] (#35242) 2024-08-27 11:43:29 -05:00
Navin Karkera
c3480b8f0b chore: add comment 2024-08-19 17:01:25 +05:30
Navin Karkera
fed8a803f1 test: delete documents that were never published on discard 2024-08-19 17:01:25 +05:30
Navin Karkera
e1495398e2 refactor: delete documents that were never published on discard 2024-08-19 17:01:25 +05:30
Navin Karkera
140b9bb968 refactor: delete all documents on discard 2024-08-19 17:01:25 +05:30
Navin Karkera
2efff2697b refactor: parallelize content block update on discard 2024-08-19 17:01:25 +05:30
Navin Karkera
65258117d8 fix: delete discarded drafts from meilisearch index 2024-08-19 17:01:25 +05:30
Jillian
6b5d812d38 feat: adds sortable fields to studio content search index (#35103) 2024-07-25 18:18:49 +00:00
Rômulo Penido
238dca732e fix: skip block indexing if it raises an error while loading (#35139)
* fix: skip block indexing if it raises an error while loading
* test: add tests to the issue
2024-07-26 02:15:57 +09:30
Braden MacDonald
e1e3c87a95 fix: searching tag refinement was sometimes not working (#34933) 2024-06-07 09:30:05 +09:30
Braden MacDonald
6bfe08c147 fix: reindex_studio was crashing if instance had too many courses (#34905) 2024-06-07 09:29:01 +09:30
Kyle McCormick
11626148d9 refactor: switch from mock to unittest.mock (#34844)
As of Python 3.3, the 3rd-party `mock` package has been subsumed into the
standard `unittest.mock` package. Refactoring tests to use the latter will
allow us to drop `mock` as a dependency, which is currently coming in
transitively through requirements/edx/paver.in.

We don't actually drop the `mock` dependency in this PR. That will happen
naturally in:

* https://github.com/openedx/edx-platform/pull/34830
2024-05-22 13:52:24 -04:00