Merge pull request #25809 from raccoongang/rg/fix/bookmarks_deletion

In the LMS, bookmarks associated to deleted units are not deleted
This commit is contained in:
Ned Batchelder
2020-12-09 06:19:27 -05:00
committed by GitHub
7 changed files with 121 additions and 28 deletions

View File

@@ -39,6 +39,7 @@ from common.djangoapps.edxmako.shortcuts import render_to_string
from openedx.core.djangoapps.schedules.config import COURSE_UPDATE_WAFFLE_FLAG
from openedx.core.lib.gating import api as gating_api
from openedx.core.lib.xblock_utils import hash_resource, request_token, wrap_xblock, wrap_xblock_aside
from openedx.core.djangoapps.bookmarks import api as bookmarks_api
from common.djangoapps.static_replace import replace_static_urls
from common.djangoapps.student.auth import has_studio_read_access, has_studio_write_access
from openedx.core.toggles import ENTRANCE_EXAMS
@@ -987,6 +988,8 @@ def _delete_item(usage_key, user):
course.tabs = [tab for tab in existing_tabs if tab.get('url_slug') != usage_key.block_id]
store.update_item(course, user.id)
# Delete user bookmarks
bookmarks_api.delete_bookmarks(usage_key)
store.delete_item(usage_key, user.id)