feat: Enable taxonomy/tagging feature in MFE by default (#34633)

* feat: make tagging feature enabled by default

* fix: use the correct flag for tagging enabled

* fix: make compatible with other changes from master

* fix: more compatibility fixes

* fix: show tag counts at all levels of the outline, not just units

* chore: typo

* test: fix counts in test suite now that tagging is on by default

---------

Co-authored-by: Braden MacDonald <braden@opencraft.com>
Co-authored-by: Yusuf Musleh <yusuf@opencraft.com>
This commit is contained in:
Rômulo Penido
2024-05-09 16:27:05 +03:00
committed by GitHub
parent 7f6133c940
commit b42da7429f
17 changed files with 84 additions and 76 deletions

View File

@@ -33,13 +33,16 @@ function(
},
renderTagCount: function() {
if (this.model.get('is_tagging_feature_disabled')) {
return; // Tagging feature is disabled; don't initialize the tag count view.
}
const contentId = this.model.get('id');
const tagCountsByBlock = this.model.get('tag_counts_by_block')
// Skip the course block since that is handled elsewhere in course_manage_tags
if (contentId.includes('@course')) {
return
return;
}
const tagsCount = tagCountsByBlock !== undefined ? tagCountsByBlock[contentId] : 0
const tagCountsByBlock = this.model.get('tag_counts_by_block');
const tagsCount = tagCountsByBlock !== undefined ? tagCountsByBlock[contentId] : 0;
const tagCountElem = this.$(`.tag-count[data-locator="${contentId}"]`);
var countModel = new TagCountModel({
content_id: contentId,

View File

@@ -107,12 +107,14 @@ function($, _, Backbone, gettext, BasePage,
});
this.viewLiveActions.render();
this.tagListView = new ContainerSubviews.TagList({
el: this.$('.unit-tags'),
model: this.model
});
this.tagListView.setupMessageListener();
this.tagListView.render();
if (!this.model.get('is_tagging_feature_disabled')) {
this.tagListView = new ContainerSubviews.TagList({
el: this.$('.unit-tags'),
model: this.model
});
this.tagListView.setupMessageListener();
this.tagListView.render();
}
this.unitOutlineView = new UnitOutlineView({
el: this.$('.wrapper-unit-overview'),

View File

@@ -138,7 +138,7 @@ function($, _, gettext, BasePage, XBlockViewUtils, CourseOutlineView, ViewUtils,
}
// if tagging enabled
if (this.model.get('use_tagging_taxonomy_list_page')) {
if (!this.model.get('is_tagging_feature_disabled')) {
this.courseManageTagsView = new CourseManageTagsView({
el: this.$('.status-manage-tags'),
model: this.model

View File

@@ -115,8 +115,8 @@ function($, _, gettext, BaseView, ViewUtils, XBlockViewUtils, XBlockStringFieldE
hideFromTOCMessage: this.model.get('hide_from_toc_message'),
enableHideFromTOC: this.model.get('hide_from_toc'),
course: course,
enableCopyPasteUnits: this.model.get("enable_copy_paste_units"), // ENABLE_COPY_PASTE_UNITS waffle flag
useTaggingTaxonomyListPage: this.model.get("use_tagging_taxonomy_list_page"), // ENABLE_TAGGING_TAXONOMY_LIST_PAGE waffle flag
enableCopyPasteUnits: this.model.get('enable_copy_paste_units'), // ENABLE_COPY_PASTE_UNITS waffle flag
isTaggingFeatureDisabled: this.model.get('is_tagging_feature_disabled'), // DISABLE_TAGGING_FEATURE waffle flag
};
},