~martijnbraam/gitlab-draft-tab

b91e3b6ebb5e5cfccccf2d09e0d19c8131356e4d — Martijn Braam 3 months ago a0f1085
Calculate the new tab value from the sidebar issue count
1 files changed, 3 insertions(+), 0 deletions(-)

M gitlab-draft-tab.user.js
M gitlab-draft-tab.user.js => gitlab-draft-tab.user.js +3 -0
@@ 52,6 52,7 @@
        const tabBar = document.getElementsByClassName("issues-state-filters")[0];
        const oldTab = document.getElementById("state-opened");
        const oldOpenCount = document.querySelector("#state-opened span.badge").innerText.replace(',', '');
        const totalOpenCount = document.querySelector(".shortcuts-merge_requests .badge").innerText.replace(',', '');

        oldTab.style.display = 'none';



@@ 61,8 62,10 @@
        if (state == "open" || state == "opened") {
            if (draft == "no") {
                openCount = oldOpenCount;
                draftCount = totalOpenCount - oldOpenCount;
            } else {
                draftCount = oldOpenCount;
                openCount = totalOpenCount - oldOpenCount;
            }
        }