Add "no label" and "no milestone" filters #1475

Closed
opened 2025-11-02 04:01:57 -06:00 by GiteaMirror · 9 comments
Owner

Originally created by @lofidevops on GitHub (Jan 24, 2018).

  • Gitea version (or commit ref):
  • Git version: N/A
  • Operating system: N/A
  • Database (use [x]): N/A
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL) - URL pending
  • Log gist: N/A

Description

I am a project manager triaging issues. I want to filter for all issues without any label, and for all issues without any milestone, so that I know which issues I haven't yet triaged.

Related Gogs issues:

Suggested solution

  • To the label filter list:
    • Add "No label" option
    • Rename "No selected label" to "All labels"
  • To the milestone filter list:
    • Add "No milestone" option
    • Rename "No selected milestone" to "All milestones"
Originally created by @lofidevops on GitHub (Jan 24, 2018). - Gitea version (or commit ref): - Git version: N/A - Operating system: N/A - Database (use `[x]`): N/A - Can you reproduce the bug at https://try.gitea.io: - [x] Yes (provide example URL) - URL pending - Log gist: N/A ## Description I am a project manager triaging issues. I want to filter for all issues without any label, and for all issues without any milestone, so that I know which issues I haven't yet triaged. Related Gogs issues: * https://github.com/gogits/gogs/issues/2622 * https://github.com/gogits/gogs/issues/1833 * https://github.com/gogits/gogs/issues/5014 ## Suggested solution * To the label filter list: * Add "No label" option * Rename "No selected label" to "All labels" * To the milestone filter list: * Add "No milestone" option * Rename "No selected milestone" to "All milestones"
GiteaMirror added the type/featuretype/proposal labels 2025-11-02 04:01:57 -06:00
Author
Owner

@dakira commented on GitHub (Jan 25, 2018):

Yes, we need this. It would be such a time saver!

@dakira commented on GitHub (Jan 25, 2018): Yes, we need this. It would be such a time saver!
Author
Owner

@bobemoe commented on GitHub (May 10, 2019):

Any progress on this? Is there a workaround? Can I use the API to list the no-label and no-milestone issues or something?

@bobemoe commented on GitHub (May 10, 2019): Any progress on this? Is there a workaround? Can I use the API to list the no-label and no-milestone issues or something?
Author
Owner

@lunny commented on GitHub (May 11, 2019):

Nobody are working on this I think.

@lunny commented on GitHub (May 11, 2019): Nobody are working on this I think.
Author
Owner

@bobemoe commented on GitHub (May 11, 2019):

Shame, it would be very useful.

I have found a way to do it with the API and the Linux JSON parser jq

curl -sX GET "https://gitea.example.com/api/v1/repos/USER/REPO/issues" -H "accept: application/json" | jq '.[] | select(.labels|length==0) | .number'

This will list the issue numbers of all issues with no labels. It can quite easily be modified to work with milestones rather than labels.

@bobemoe commented on GitHub (May 11, 2019): Shame, it would be very useful. I have found a way to do it with the API and the Linux JSON parser `jq` ```curl -sX GET "https://gitea.example.com/api/v1/repos/USER/REPO/issues" -H "accept: application/json" | jq '.[] | select(.labels|length==0) | .number'``` This will list the issue numbers of all issues with no labels. It can quite easily be modified to work with milestones rather than labels.
Author
Owner

@zeripath commented on GitHub (May 11, 2019):

It's likely a very easy pr...

@zeripath commented on GitHub (May 11, 2019): It's likely a very easy pr...
Author
Owner

@bobemoe commented on GitHub (May 11, 2019):

Maybe if you've got a dev env set up and are familiar with go and gitea ;) I'm thinking it would be much easier for me to extend the script to use the API to add a "needs attention" label to all the issues with no label OR milestone.

If I did that, could I add it to Gitea as a maintenance task or hook somehow without having to modify the code? (or cron it lol)

@bobemoe commented on GitHub (May 11, 2019): Maybe if you've got a dev env set up and are familiar with go and gitea ;) I'm thinking it would be much easier for me to extend the script to use the API to add a "needs attention" label to all the issues with no label OR milestone. If I did that, could I add it to Gitea as a maintenance task or hook somehow without having to modify the code? (or cron it lol)
Author
Owner

@kraptor commented on GitHub (Jul 31, 2019):

This feature would be very nice to have...

@kraptor commented on GitHub (Jul 31, 2019): This feature would be very nice to have...
Author
Owner

@j123b567 commented on GitHub (Nov 10, 2021):

Also "no assignee" would be very helpfull.

@j123b567 commented on GitHub (Nov 10, 2021): Also "no assignee" would be very helpfull.
Author
Owner

@tyroneyeh commented on GitHub (Jun 17, 2022):

Hello

Could try this patch

  • 909cdc360f657daedf9a6cf23ad98f86e51eb1f6
  • c0d8f5a8edb5963b4732abedc54d714f52d92e75
  • 304025c69b3e7749dbfd97fcb10b7e5773373a88
  • 4e0b9d6b53fab8b890957cfe4d92f9544929c862

image
image

and in custom/templates/footer.tmpl add below script

    var btn, a;
    if (btn = document.querySelector(".label-filter a")) {
        a = document.createElement("a");
        a.className = "item";
        a.textContent = "No labels";
        a.addEventListener("click", function() {
            const labelids = "-"+ [...document.querySelectorAll(".label-filter-item")].map(function(i) { return i.getAttribute("data-label-id"); }).join(",-");;
            var labelsurl = "labels=", labelpos;
            if ((labelpos = location.search.indexOf(labelsurl)) > 0) {
                labelsurl = location.search.slice(labelpos);
                if ((labelpos = labelsurl.indexOf("&")) > 0)
                    return location.search = location.search.replace(labelsurl.slice(0, labelpos), "labels="+ labelids);
                return location.search = location.search.replace(labelsurl, "labels="+ labelids);
            }
            return location.search += (location.search.indexOf("?") == -1 ? "?" : "&") + labelsurl + labelids;
        });
        btn.parentNode.insertBefore(a, btn.nextSibling);
    }
    if (btn = document.querySelector(".assignee-filter a")) {
        a = document.createElement("a");
        a.className = "item";
        a.textContent = "No assignees";
        a.addEventListener("click", function() {
            const assigneeids = "-"+ [...document.querySelectorAll(".assignee-filter-item")].map(function(i) { return i.getAttribute("data-assignee-id"); }).join(",-");
            var assigneeurl = "assignee=", assigneepos;
            if ((assigneepos = location.search.indexOf(assigneeurl)) > 0) {
                assigneeurl = location.search.slice(assigneepos);
                if ((assigneepos = assigneeurl.indexOf("&")) > 0)
                    return location.search = location.search.replace(assigneeurl.slice(0, assigneepos), "assignee="+ assigneeids);
                return location.search = location.search.replace(assigneeurl, "assignee="+ assigneeids);
            }
            return location.search += (location.search.indexOf("?") == -1 ? "?" : "&") + assigneeurl + assigneeids;
        });
        btn.parentNode.insertBefore(a, btn.nextSibling);
    }
@tyroneyeh commented on GitHub (Jun 17, 2022): Hello Could try this patch - 909cdc360f657daedf9a6cf23ad98f86e51eb1f6 - c0d8f5a8edb5963b4732abedc54d714f52d92e75 - 304025c69b3e7749dbfd97fcb10b7e5773373a88 - 4e0b9d6b53fab8b890957cfe4d92f9544929c862 ![image](https://user-images.githubusercontent.com/1255041/174267605-33d62579-1e99-4502-b5be-bd88fe1b3100.png) ![image](https://user-images.githubusercontent.com/1255041/174267614-92857858-53f2-4819-9024-c1dd77ab3d65.png) and in custom/templates/footer.tmpl add below script ```js var btn, a; if (btn = document.querySelector(".label-filter a")) { a = document.createElement("a"); a.className = "item"; a.textContent = "No labels"; a.addEventListener("click", function() { const labelids = "-"+ [...document.querySelectorAll(".label-filter-item")].map(function(i) { return i.getAttribute("data-label-id"); }).join(",-");; var labelsurl = "labels=", labelpos; if ((labelpos = location.search.indexOf(labelsurl)) > 0) { labelsurl = location.search.slice(labelpos); if ((labelpos = labelsurl.indexOf("&")) > 0) return location.search = location.search.replace(labelsurl.slice(0, labelpos), "labels="+ labelids); return location.search = location.search.replace(labelsurl, "labels="+ labelids); } return location.search += (location.search.indexOf("?") == -1 ? "?" : "&") + labelsurl + labelids; }); btn.parentNode.insertBefore(a, btn.nextSibling); } if (btn = document.querySelector(".assignee-filter a")) { a = document.createElement("a"); a.className = "item"; a.textContent = "No assignees"; a.addEventListener("click", function() { const assigneeids = "-"+ [...document.querySelectorAll(".assignee-filter-item")].map(function(i) { return i.getAttribute("data-assignee-id"); }).join(",-"); var assigneeurl = "assignee=", assigneepos; if ((assigneepos = location.search.indexOf(assigneeurl)) > 0) { assigneeurl = location.search.slice(assigneepos); if ((assigneepos = assigneeurl.indexOf("&")) > 0) return location.search = location.search.replace(assigneeurl.slice(0, assigneepos), "assignee="+ assigneeids); return location.search = location.search.replace(assigneeurl, "assignee="+ assigneeids); } return location.search += (location.search.indexOf("?") == -1 ? "?" : "&") + assigneeurl + assigneeids; }); btn.parentNode.insertBefore(a, btn.nextSibling); } ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1475