@@ -463,32 +463,14 @@ func UpdateIssueStatus(ctx *context.Context) {
463463 ctx .JSONOK ()
464464}
465465
466- func renderExclusiveLabelScopes (ctx * context.Context ) {
467- labels , err := issues_model .GetLabelsByRepoID (ctx , ctx .Repo .Repository .ID , "" , db.ListOptions {})
468- if err != nil {
469- ctx .ServerError ("GetAllRepoLabels" , err )
470- return
471- }
472-
473- if ctx .Repo .Owner .IsOrganization () {
474- orgLabels , err := issues_model .GetLabelsByOrgID (ctx , ctx .Repo .Owner .ID , "" , db.ListOptions {})
475- if err != nil {
476- ctx .ServerError ("GetAllRepoLabels" , err )
477- return
478- }
479-
480- labels = append (labels , orgLabels ... )
481- }
482-
483- // This treats org- and repo-level label scopes equivalently.
484- scopeSet := make (map [string ]bool , 0 )
485- for _ , label := range labels {
466+ func prepareIssueFilterExclusiveOrderScopes (ctx * context.Context , allLabels []* issues_model.Label ) {
467+ scopeSet := make (map [string ]bool )
468+ for _ , label := range allLabels {
486469 scope := label .ExclusiveScope ()
487470 if len (scope ) > 0 && label .ExclusiveOrder > 0 {
488471 scopeSet [scope ] = true
489472 }
490473 }
491-
492474 scopes := slices .Collect (maps .Keys (scopeSet ))
493475 sort .Strings (scopes )
494476 ctx .Data ["ExclusiveLabelScopes" ] = scopes
@@ -556,16 +538,18 @@ func prepareIssueFilterAndList(ctx *context.Context, milestoneID, projectID int6
556538 mileIDs = []int64 {milestoneID }
557539 }
558540
559- labelIDs := issue .PrepareFilterIssueLabels (ctx , repo .ID , ctx .Repo .Owner )
541+ preparedLabelFilter := issue .PrepareFilterIssueLabels (ctx , repo .ID , ctx .Repo .Owner )
560542 if ctx .Written () {
561543 return
562544 }
563545
546+ prepareIssueFilterExclusiveOrderScopes (ctx , preparedLabelFilter .AllLabels )
547+
564548 var keywordMatchedIssueIDs []int64
565549 var issueStats * issues_model.IssueStats
566550 statsOpts := & issues_model.IssuesOptions {
567551 RepoIDs : []int64 {repo .ID },
568- LabelIDs : labelIDs ,
552+ LabelIDs : preparedLabelFilter . SelectedLabelIDs ,
569553 MilestoneIDs : mileIDs ,
570554 ProjectID : projectID ,
571555 AssigneeID : assigneeID ,
@@ -657,7 +641,7 @@ func prepareIssueFilterAndList(ctx *context.Context, milestoneID, projectID int6
657641 ProjectID : projectID ,
658642 IsClosed : isShowClosed ,
659643 IsPull : isPullOption ,
660- LabelIDs : labelIDs ,
644+ LabelIDs : preparedLabelFilter . SelectedLabelIDs ,
661645 SortType : sortType ,
662646 IssueIDs : keywordMatchedIssueIDs ,
663647 }))
@@ -761,7 +745,7 @@ func prepareIssueFilterAndList(ctx *context.Context, milestoneID, projectID int6
761745 ctx .Data ["IssueStats" ] = issueStats
762746 ctx .Data ["OpenCount" ] = issueStats .OpenCount
763747 ctx .Data ["ClosedCount" ] = issueStats .ClosedCount
764- ctx .Data ["SelLabelIDs" ] = labelIDs
748+ ctx .Data ["SelLabelIDs" ] = preparedLabelFilter . SelectedLabelIDs
765749 ctx .Data ["ViewType" ] = viewType
766750 ctx .Data ["SortType" ] = sortType
767751 ctx .Data ["MilestoneID" ] = milestoneID
@@ -812,11 +796,6 @@ func Issues(ctx *context.Context) {
812796 return
813797 }
814798
815- renderExclusiveLabelScopes (ctx )
816- if ctx .Written () {
817- return
818- }
819-
820799 ctx .Data ["CanWriteIssuesOrPulls" ] = ctx .Repo .CanWriteIssuesOrPulls (isPullList )
821800
822801 ctx .HTML (http .StatusOK , tplIssues )
0 commit comments