loading up the forgejo repo on tangled to test page performance
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Hide archived labels by default from the suggestions when assigning labels for an issue (#27451)

Followup of #27115
Finally closes #25237

## Screenshots
### Issue Sidebar
<img width="513" alt="image"
src="https://github.com/go-gitea/gitea/assets/80308335/9f7fda2f-5a03-4684-8619-fd3498a95b41">

### PR sidebar
<img width="367" alt="image"
src="https://github.com/go-gitea/gitea/assets/80308335/53db9b64-faec-4a67-91d6-76945596a469">

### PR sidebar with archived labels shown
<img width="352" alt="image"
src="https://github.com/go-gitea/gitea/assets/80308335/9dc5050f-4e69-4f76-bb83-582480a2281e">

---------

Signed-off-by: puni9869 <punitinani1@hotmail.com>
Co-authored-by: silverwind <me@silverwind.io>

authored by

puni9869
silverwind
and committed by
GitHub
4adc2a82 d98c8638

+35 -10
+2 -4
templates/repo/issue/filter_actions.tmpl
··· 29 29 <div class="divider"></div> 30 30 {{end}} 31 31 {{$previousExclusiveScope = $exclusiveScope}} 32 - <div class="item issue-action gt-df gt-items-start" data-action="toggle" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/labels"> 32 + <div class="item issue-action gt-df gt-sb" data-action="toggle" data-element-id="{{.ID}}" data-url="{{$.RepoLink}}/issues/labels"> 33 33 {{if SliceUtils.Contains $.SelLabelIDs .ID}}{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}{{end}} {{RenderLabel $.Context .}} 34 - {{if .IsArchived}} 35 - <i data-tooltip-content={{ctx.Locale.Tr "archived"}}>{{svg "octicon-info"}}</i> 36 - {{end}} 34 + {{template "repo/issue/labels/label_archived" .}} 37 35 </div> 38 36 {{end}} 39 37 </div>
+8 -4
templates/repo/issue/labels/labels_selector_field.tmpl
··· 21 21 <div class="divider"></div> 22 22 {{end}} 23 23 {{$previousExclusiveScope = $exclusiveScope}} 24 - <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}" data-scope="{{$exclusiveScope}}"><span class="octicon-check {{if not .IsChecked}}gt-invisible{{end}}">{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}</span>&nbsp;&nbsp;{{RenderLabel $.Context .}} 25 - {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}}</a> 24 + <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" {{if .IsArchived}}data-is-archived{{end}} data-id-selector="#label_{{.ID}}" data-scope="{{$exclusiveScope}}"><span class="octicon-check {{if not .IsChecked}}gt-invisible{{end}}">{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}</span>&nbsp;&nbsp;{{RenderLabel $.Context .}} 25 + {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}} 26 + <p class="archived-label-hint">{{template "repo/issue/labels/label_archived" .}}</p> 27 + </a> 26 28 {{end}} 27 29 <div class="divider"></div> 28 30 {{$previousExclusiveScope = "_no_scope"}} ··· 32 34 <div class="divider"></div> 33 35 {{end}} 34 36 {{$previousExclusiveScope = $exclusiveScope}} 35 - <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" data-id-selector="#label_{{.ID}}" data-scope="{{$exclusiveScope}}"><span class="octicon-check {{if not .IsChecked}}gt-invisible{{end}}">{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}</span>&nbsp;&nbsp;{{RenderLabel $.Context .}} 36 - {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}}</a> 37 + <a class="{{if .IsChecked}}checked{{end}} item" href="#" data-id="{{.ID}}" {{if .IsArchived}}data-is-archived{{end}} data-id-selector="#label_{{.ID}}" data-scope="{{$exclusiveScope}}"><span class="octicon-check {{if not .IsChecked}}gt-invisible{{end}}">{{if $exclusiveScope}}{{svg "octicon-dot-fill"}}{{else}}{{svg "octicon-check"}}{{end}}</span>&nbsp;&nbsp;{{RenderLabel $.Context .}} 38 + {{if .Description}}<br><small class="desc">{{.Description | RenderEmoji $.Context}}</small>{{end}} 39 + <p class="archived-label-hint">{{template "repo/issue/labels/label_archived" .}}</p> 40 + </a> 37 41 {{end}} 38 42 {{else}} 39 43 <div class="disabled item">{{ctx.Locale.Tr "repo.issues.new.no_items"}}</div>
+5
web_src/css/repo/issue-label.css
··· 45 45 .label-operation .label { 46 46 height: fit-content; 47 47 } 48 + 49 + .archived-label-hint { 50 + float: right; 51 + margin: -12px; 52 + }
+5 -1
web_src/js/features/repo-issue-list.js
··· 1 1 import $ from 'jquery'; 2 2 import {updateIssuesMeta} from './repo-issue.js'; 3 - import {toggleElem} from '../utils/dom.js'; 3 + import {toggleElem, hideElem} from '../utils/dom.js'; 4 4 import {htmlEscape} from 'escape-goat'; 5 5 import {confirmModal} from './comp/ConfirmModal.js'; 6 6 import {showErrorToast} from '../modules/toast.js'; ··· 194 194 const url = new URL(window.location.href); 195 195 const archivedLabels = document.querySelectorAll('[data-is-archived]'); 196 196 197 + if (!archivedLabels.length) { 198 + hideElem('.archived-label-filter'); 199 + return; 200 + } 197 201 const selectedLabels = (url.searchParams.get('labels') || '') 198 202 .split(',') 199 203 .map((id) => id < 0 ? `${~id + 1}` : id); // selectedLabels contains -ve ids, which are excluded so convert any -ve value id to +ve
+13
web_src/js/features/repo-issue.js
··· 680 680 initCombo($(el)); 681 681 } 682 682 } 683 + 684 + // This function used to show and hide archived label on issue/pr 685 + // page in the sidebar where we select the labels 686 + // If we have any archived label tagged to issue and pr. We will show that 687 + // archived label with checked classed otherwise we will hide it 688 + // with the help of this function. 689 + // This function runs globally. 690 + export function initArchivedLabelHandler() { 691 + if (!document.querySelector('.archived-label-hint')) return; 692 + for (const label of document.querySelectorAll('[data-is-archived]')) { 693 + toggleElem(label, label.classList.contains('checked')); 694 + } 695 + }
+2 -1
web_src/js/index.js
··· 31 31 initRepoIssueWipTitle, 32 32 initRepoPullRequestMergeInstruction, 33 33 initRepoPullRequestAllowMaintainerEdit, 34 - initRepoPullRequestReview, initRepoIssueSidebarList 34 + initRepoPullRequestReview, initRepoIssueSidebarList, initArchivedLabelHandler, 35 35 } from './features/repo-issue.js'; 36 36 import { 37 37 initRepoEllipsisButton, ··· 152 152 initRepoIssueDue(); 153 153 initRepoIssueList(); 154 154 initRepoIssueSidebarList(); 155 + initArchivedLabelHandler(); 155 156 initRepoIssueReferenceRepositorySearch(); 156 157 initRepoIssueTimeTracking(); 157 158 initRepoIssueWipTitle();