~martijnbraam/gitlab-draft-tab

a0f10851a7720a8dd65db4bc14471f684b372fc8 — Martijn Braam 3 months ago 2d6d36d
Sometimes the state is opened instead of open
1 files changed, 6 insertions(+), 6 deletions(-)

M gitlab-draft-tab.user.js
M gitlab-draft-tab.user.js => gitlab-draft-tab.user.js +6 -6
@@ 51,25 51,25 @@
    function makeTabs(state, draft) {
        const tabBar = document.getElementsByClassName("issues-state-filters")[0];
        const oldTab = document.getElementById("state-opened");
        const oldCount = document.querySelector("#state-opened span.badge").innerText;
        const oldOpenCount = document.querySelector("#state-opened span.badge").innerText.replace(',', '');

        oldTab.style.display = 'none';

        let draftCount = '?';
        let openCount = '?';

        if (state == "open") {
        if (state == "open" || state == "opened") {
            if (draft == "no") {
                openCount = oldCount;
                openCount = oldOpenCount;
            } else {
                draftCount = oldCount;
                draftCount = oldOpenCount;
            }
        }

        const draftTab = makeTab("Draft", draftCount, makeUrl("yes"));
        const openTab = makeTab("Open", openCount, makeUrl("no"));

        if (state == "open") {
        if (state == "open" || state == "opened") {
            if (draft == "no") {
                openTab.classList.add("gl-tab-nav-item-active");
            } else {


@@ 87,7 87,7 @@
        const state = urlParams.get('state');
        const draft = urlParams.get('draft');

        if (draft === null && (state === null || state == "open")) {
        if (draft === null && (state === null || state == "open" || state == "opened")) {
            // This is the root MR list, redirect to draft==no
            location.href = makeUrl('no');
        } else {