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.

Merge pull request 'Fix the WIP prefix toggling on the sidebar' (#3384) from algernon/forgejo:it-really-wips-the-prs-title into forgejo

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/3384
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>

+4 -3
+1 -1
templates/repo/issue/view_content/sidebar.tmpl
··· 114 114 </div> 115 115 </div> 116 116 {{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .HasMerged) (not .Issue.IsClosed)}} 117 - <div class="toggle-wip" data-title="{{.Issue.Title}}" data-wip-prefix="{{index .PullRequestWorkInProgressPrefixes 0}}" data-update-url="{{.Issue.Link}}/title"> 117 + <div class="toggle-wip" data-title="{{.Issue.Title}}" data-wip-prefixes="{{JsonUtils.EncodeToString .PullRequestWorkInProgressPrefixes}}" data-update-url="{{.Issue.Link}}/title"> 118 118 <a class="muted"> 119 119 {{if .IsPullWorkInProgress}} 120 120 {{ctx.Locale.Tr "repo.pulls.ready_for_review"}} {{ctx.Locale.Tr "repo.pulls.remove_prefix" (index .PullRequestWorkInProgressPrefixes 0)}}
+3 -2
web_src/js/features/repo-issue.js
··· 583 583 e.preventDefault(); 584 584 const toggleWip = e.currentTarget.closest('.toggle-wip'); 585 585 const title = toggleWip.getAttribute('data-title'); 586 - const wipPrefix = toggleWip.getAttribute('data-wip-prefix'); 586 + const wipPrefixes = JSON.parse(toggleWip.getAttribute('data-wip-prefixes')); 587 587 const updateUrl = toggleWip.getAttribute('data-update-url'); 588 + const prefix = wipPrefixes.find((prefix) => title.startsWith(prefix)); 588 589 589 590 try { 590 591 const params = new URLSearchParams(); 591 - params.append('title', title?.startsWith(wipPrefix) ? title.slice(wipPrefix.length).trim() : `${wipPrefix.trim()} ${title}`); 592 + params.append('title', prefix !== undefined ? title.slice(prefix.length).trim() : `${wipPrefixes[0].trim()} ${title}`); 592 593 593 594 const response = await POST(updateUrl, {data: params}); 594 595 if (!response.ok) {