MDL-85369 question: fix tag collection ID in legacy‑filter upgrade.

Use the actual tag collection for the 'question' tag area instead of
the default collection.
This commit is contained in:
Artem Garanin
2025-05-29 14:08:42 -04:00
parent a52fbcced6
commit 8fa9939614
2 changed files with 60 additions and 1 deletions
@@ -104,7 +104,8 @@ class question_reference_manager {
// Get the names of the tags in the condition. Find or create corresponding tags,
// and set their ids in the new condition.
$oldtags = array_map(fn($oldtag) => explode(',', $oldtag)[1], $filtercondition['tags']);
$newtags = \core_tag_tag::create_if_missing(1, $oldtags);
$questiontagcollid = \core_tag_area::get_collection('core_question', 'question');
$newtags = \core_tag_tag::create_if_missing($questiontagcollid, $oldtags);
$newtagids = array_map(fn($newtag) => $newtag->id, $newtags);
$filtercondition['filter']['qtagids'] = [