From 921b5ca2ceb36428cab48c5da6fc6137ed79f4b2 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Fri, 19 Feb 2021 15:34:28 +0300 Subject: add onTagsUpdated similar to onLabelsUpdated --- js/Article.js | 10 +--------- js/Headlines.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 9 deletions(-) (limited to 'js') diff --git a/js/Article.js b/js/Article.js index a11004a0a..21973518c 100644 --- a/js/Article.js +++ b/js/Article.js @@ -350,15 +350,7 @@ const Article = { Notify.close(); dialog.hide(); - if (data) { - if (Headlines.headlines[data.id]) { - Headlines.headlines[data.id].tags = data.tags; - } - - App.findAll(`span[data-tags-for="${data.id}"`).forEach((ctr) => { - ctr.innerHTML = Article.renderTags(data.id, data.tags); - }); - } + Headlines.onTagsUpdated(data); } catch (e) { App.Error.report(e); } diff --git a/js/Headlines.js b/js/Headlines.js index f98b3dcce..9bc5747c2 100755 --- a/js/Headlines.js +++ b/js/Headlines.js @@ -1240,6 +1240,17 @@ const Headlines = { } } }, + onTagsUpdated: function (data) { + if (data) { + if (this.headlines[data.id]) { + this.headlines[data.id].tags = data.tags; + } + + App.findAll(`span[data-tags-for="${data.id}"`).forEach((ctr) => { + ctr.innerHTML = Article.renderTags(data.id, data.tags); + }); + } + }, // TODO: maybe this should cause article to be rendered again, although it might cause flicker etc onLabelsUpdated: function (data) { if (data) { -- cgit v1.2.3