1
0
mirror of https://git.tt-rss.org/git/tt-rss.git synced 2025-12-13 15:25:59 +00:00

only show plugin update buttons when needed

This commit is contained in:
Andrew Dolgov
2021-02-27 17:29:41 +03:00
parent cf5c7c4f29
commit de63e3799a
2 changed files with 97 additions and 11 deletions

View File

@@ -295,7 +295,34 @@ const Helpers = {
});
}
},
updateLocal: function(name = null) {
checkForUpdate: function(name = null) {
Notify.progress("Checking for plugin updates...");
xhr.json("backend.php", {op: "pref-prefs", method: "checkForPluginUpdates", name: name}, (reply) => {
Notify.close();
if (reply) {
let plugins_with_updates = 0;
reply.forEach((p) => {
if (p.rv.o) {
const button = dijit.getEnclosingWidget(App.find(`*[data-update-btn-for-plugin="${p.plugin}"]`));
if (button) {
button.domNode.show();
++plugins_with_updates;
}
}
});
if (plugins_with_updates > 0)
App.find(".update-all-plugins-btn").show();
} else {
Notify.error("Unable to check for plugin updates.");
}
});
},
update: function(name = null) {
const msg = name ? __("Update %p using git?").replace("%p", name) :
__("Update all local plugins using git?");