Fix bug: deleted unit remains in bookmarks.

Description

*Background*: This PR fixes a bug related to bookmarks. If a unit is added to bookmarks and then deleted, it remains on the bookmarks page anyway. Clicking the bookmark causes a 404 error.

*openedx/core/ updates:* Bookmarks api has been extended by the `delete_bookmarks` method, which picks all bookmarks with specific `usage_key` (i.e. bookmarks made by different users but targeting the same unit), and deletes them.

*Studio updates:* The `delete_bookmarks` api method is invoked on xblock deletion (by `cms.djangoapps.contentstore.views.item._delete_item`).

The above changes have been covered by tests (3 tests added):
`openedx.core.djangoapps.bookmarks.tests.test_api.test_delete_bookmarks`
`cms.djangoapps.contentstore.views.tests.test_item.test_delete_item`
`cms.djangoapps.contentstore.views.tests.test_item.test_delete_bookmarked_item`

*Test plan:*
Before fix:
In cms, create a course with several units. Set up the course start date (in the past).
In lms, enroll in course, add one of the units to bookmarks.
In cms, delete the same unit that you bookmarked.
In lms, the bookmark of this unit still exists on the bookmarks page .
After fix:
The same flow, but the bookmark gets deleted together with a unit it points to.

Assignee

David Ormsbee

Reporter

Open Source Pull Request Bot

Contributor Name

Iana

Repo

edx/edx-platform

Customer

None

Epic Link

None

OSCM Assignee

None

Platform Map Area (Levels 1 & 2)

Learner Experiences - Course Experience

Platform Map Area (Levels 3 & 4)

None

Blended Hour Utilization Percentage

None

Priority

Unset
Configure