-
Notifications
You must be signed in to change notification settings - Fork 1
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
[Libraries] [Collections] [Backend] Soft Delete collections #231
Comments
@sdaitzman @lizc577 CC @jmakowski1123 Would one of you be able to answer @pomegranited's question here? When a collection is deleted, is it "gone gone", or should we kind of disable it and hide it, but keep the ability to potentially un-deleted it again in the future? Just straight-up deleting it is the easiest to implement. Keeping it around but enabled may have issues if someone later tries to import a collection that has the same name/ID/key (though we can find a way to handle that). |
@bradenmacdonald @pomegranited I'll defer to @jmakowski1123 since this is more a product question, but here are some general thoughts. We can also talk more at our meeting later today. If there's limited incremental cost in retaining collections for e.g. 90 days, I think it would make sense to implement that way. Even if collections are only recoverable by administrators/not through the UI initially, the ability to recover deleted content is important. Some trash/recovery workflow is common/borderline expected in a lot of authoring software with similar UI. At some point in the future, it would make sense to design and introduce a restore workflow. The existing "publish library" screen and publishing workflow are very simple right now, and we could add restoring/archiving content to that workflow in a future version. Smaller details like a temporary "Undo" button could also improve the experience. If implementing soft-delete will add scope or more significant cost/delay, I think I'm okay with holding off for the libraries MVP. I'd prioritize shipping and getting real user feedback over a restore-collection workflow or recovery option. |
@pomegranited How much work will soft delete be? We discussed this on a call, and if you can find a relatively simple way to implement soft delete (so that e.g. an admin could un-delete it if needed), let's go with that for now. The main problem to solve is that if someone later imports (or creates) a new collection with the same key, we need to not throw an error (either by permanently deleting the soft-deleted collection or changing its key?). |
Hiya @bradenmacdonald @sdaitzman Soft-deleting is simple to implement, and a Django-Admin-only UI for managing the details seems sufficient for now.
Our current solution for creating collections handles auto-assigning and de-duplicating the key for new collections, so this won't be an issue unless we change the create flow. I think we can implement this with 3 tickets:
openedx-learning
edx-platform:
frontend-authoring:
Out of scope
|
@pomegranited Yeah I'm more worried about imports in the future (where we need to keep the key the same as whatever's in the imported data file) than creating collections. We can solve that problem down the road; we're not implementing imports for MVP.
I wouldn't spend much time on this. We don't actually have a requirement to allow soft-deleting collections via the admin or any other means. It's just if we have the option of implementing it as soft-delete or hard-delete on the backend, for now we'll go with soft-delete, but we don't have to implement the whole delete-then-recover workflow in the admin UI.
Good point. I think that's fine. We can just make all collection deletions async in terms of updating the items. |
Thanks @bradenmacdonald .
Cool -- that drops us down to two tickets for this change. I've updated the description here to describe the backend changes needed.
That's the problem -- currently the Still ok to leave that part out of scope here? |
@pomegranited I think we can leave it out of scope for now and plan in the future to include some data in the event to indicate if it's part of a mass change like a mass-delete that should be handled async. |
@pomegranited CC @rpenido Something cool I just learned about: The newest version of Meilisearch has a (beta) feature that lets you use a function to update documents. So for example, you can say "filter by: type = block AND collections includes collection 15" and "apply function: collections = collections.remove(15)" See "Experimental: Edit documents with a Rhai function" at https://github.com/meilisearch/meilisearch/releases/tag/v1.10.0 We may want to think about a way to make that sort of update possible in the future, because I bet you it's a lot faster than re-indexing every document fully. But of course, it only works if you're using Meilisearch and we may need to support other search engines in the future. |
That's great!
Do you think it is worth starting to use it for our CONTENT_OBJECT_ASSOCIATIONS_CHANGED event, or should we at least wait for it to be a non-experimental feature? The delete and update events will be super fast (we don't even need to iterate the objects). |
@rpenido I think we should wait until the feature is stable. Meilisearch is developed fairly fast so I would expect them to stabilize it in their next release. |
@bradenmacdonald We've got an implementation working for this feature, but there's an issue with the Django Admin: if you modify a collection from the LMS Django Admin, the Studio Search handlers don't get run (because content/search isn't installed in the LMS), and so the search index doesn't get updated. But if you modify the collection from the Studio Django Admin (which not everyone even knows they have), then it works just fine. I think this will be resolved in production where people use the event bus? But it's an issue in dev and where there's no event bus. Is this ok for now? |
@pomegranited Can we add a little notice that appears in the Django admin, warning users about it? We certainly don't need to fix that as we don't really need to support changes in the django admin. It's just nice to have. But we might as well put a notice into the admin HTML if we can, at the least to save developers and admins some confusion. |
Yep I can on the edit page, but can't do anything without custom templates on the list page. |
@pomegranited That's fine! Thanks. |
Currently, only "enabled" collections are displayed in the frontend, so "disabled" collections can be considered to be "soft deleted".
Implement APIs and views to support "soft deleting" collections, and add Django Admin pages for our collection models.
openedx-learning
Python API:
Add Collections model Django Admin, using basic configuration options to:
Don't worry about making a Collection's components add/removable here (because there can be lots), we're just worried about Collection editing for now.
edx-platform
Use async tasks since there may be a lot of components to update.
Add library collection views:
Out of scope
The text was updated successfully, but these errors were encountered: