add onTagsUpdated similar to onLabelsUpdated

This commit is contained in:
Andrew Dolgov 2021-02-19 15:34:28 +03:00
parent e73779fec1
commit 921b5ca2ce
2 changed files with 12 additions and 9 deletions

View File

@ -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);
}

View File

@ -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) {