From fed5158ec50788026500a3e280b52e01e6cec883 Mon Sep 17 00:00:00 2001 From: wn_ Date: Mon, 8 Mar 2021 15:38:52 +0000 Subject: Default to null 'rv' for plugin update check. Previously 'rv' was returned as an empty JS array, causing 'p.rv.git_status != 0' to evaluate to true and a misleading 'Ready to update' appearing for certain plugins. --- js/PrefHelpers.js | 40 +++++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 19 deletions(-) (limited to 'js/PrefHelpers.js') diff --git a/js/PrefHelpers.js b/js/PrefHelpers.js index 651e3f609..3f738aa95 100644 --- a/js/PrefHelpers.js +++ b/js/PrefHelpers.js @@ -697,28 +697,30 @@ const Helpers = { } else { reply.forEach((p) => { - if (p.rv.need_update) { - dialog.plugins_to_update.push(p.plugin); + if (p.rv) { + if (p.rv.need_update) { + dialog.plugins_to_update.push(p.plugin); - const update_button = dijit.getEnclosingWidget( - App.find(`*[data-update-btn-for-plugin="${p.plugin}"]`)); + const update_button = dijit.getEnclosingWidget( + App.find(`*[data-update-btn-for-plugin="${p.plugin}"]`)); - if (update_button) - update_button.domNode.show(); - } + if (update_button) + update_button.domNode.show(); + } - if (p.rv.need_update || p.rv.git_status != 0) { - container.innerHTML += - ` -
  • ${p.plugin}

    - ${p.rv.stderr ? `
    ${p.rv.stderr}
    ` : ''} - ${p.rv.stdout ? `
    ${p.rv.stdout}
    ` : ''} -
    - ${p.rv.git_status ? App.FormFields.icon("error_outline") + " " + __("Exited with RC: %d").replace("%d", p.rv.git_status) : - App.FormFields.icon("check") + " " + __("Ready to update")} -
    -
  • - ` + if (p.rv.need_update || p.rv.git_status != 0) { + container.innerHTML += + ` +
  • ${p.plugin}

    + ${p.rv.stderr ? `
    ${p.rv.stderr}
    ` : ''} + ${p.rv.stdout ? `
    ${p.rv.stdout}
    ` : ''} +
    + ${p.rv.git_status ? App.FormFields.icon("error_outline") + " " + __("Exited with RC: %d").replace("%d", p.rv.git_status) : + App.FormFields.icon("check") + " " + __("Ready to update")} +
    +
  • + ` + } } dialog.checkNextPlugin(); }); -- cgit v1.2.3