diff --git a/cms/static/js/views/pages/container_subviews.js b/cms/static/js/views/pages/container_subviews.js index 2fe33df88eee..b32c86ae8dec 100644 --- a/cms/static/js/views/pages/container_subviews.js +++ b/cms/static/js/views/pages/container_subviews.js @@ -376,15 +376,14 @@ function($, _, gettext, BaseView, ViewUtils, XBlockViewUtils, MoveXBlockUtils, H "message", (event) => { // Listen any message from Manage tags drawer. var data = event.data; - var courseAuthoringUrl = this.model.get("course_authoring_url") + var courseAuthoringUrl = new URL(this.model.get("course_authoring_url")).origin; if (event.origin == courseAuthoringUrl - && data.includes('[Manage tags drawer] Tags updated:')) { + && data.type == 'authoring.events.tags.updated') { // This message arrives when there is a change in the tag list. // The message contains the new list of tags. - let jsonData = data.replace(/\[Manage tags drawer\] Tags updated: /g, ""); - jsonData = JSON.parse(jsonData); - if (jsonData.contentId == this.model.id) { - this.model.set('tags', this.buildTaxonomyTree(jsonData)); + data = data.data + if (data.contentId == this.model.id) { + this.model.set('tags', this.buildTaxonomyTree(data)); this.render(); } } diff --git a/cms/static/js/views/tag_count.js b/cms/static/js/views/tag_count.js index c7ba4d79e5ed..b95df3abeb7b 100644 --- a/cms/static/js/views/tag_count.js +++ b/cms/static/js/views/tag_count.js @@ -21,15 +21,14 @@ function($, _, BaseView, HtmlUtils) { 'message', (event) => { // Listen any message from Manage tags drawer. var data = event.data; - var courseAuthoringUrl = this.model.get("course_authoring_url") + var courseAuthoringUrl = new URL(this.model.get("course_authoring_url")).origin; if (event.origin == courseAuthoringUrl - && data.includes('[Manage tags drawer] Count updated:')) { + && data.type == 'authoring.events.tags.count.updated') { // This message arrives when there is a change in the tag list. // The message contains the new count of tags. - let jsonData = data.replace(/\[Manage tags drawer\] Count updated: /g, ""); - jsonData = JSON.parse(jsonData); - if (jsonData.contentId == this.model.get("content_id")) { - this.model.set('tags_count', jsonData.count); + data = data.data + if (data.contentId == this.model.get("content_id")) { + this.model.set('tags_count', data.count); this.render(); } }