From e947fa7accb2d2b9919f3add62cb58ad4c882a2c Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Tue, 23 Apr 2024 01:21:28 +0200 Subject: [PATCH] Fix the WIP prefix toggling on the sidebar The WIP prefix toggling link on the sidebar only supported toggling the *first* prefix specified in `[repository.pullrequest].WORK_IN_PROGRESS_PREFIXES`. If the pull request had a title with any other prefix, the first prefix listed in the config was added (and then removed on toggling it off). This little change makes all of the prefixes available for the JavaScript function that does the toggling, and changes said function to find the used prefix first, and toggle that. When adding the prefix, it will still default to adding the first one listed in the configuration, but it will happily remove any others if those are present. Fixes #3377. Signed-off-by: Gergely Nagy (cherry picked from commit a93a99eef39af9855b2d1a75c15ee855a2667a0f) --- templates/repo/issue/view_content/sidebar.tmpl | 2 +- web_src/js/features/repo-issue.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index 62b79e28a0..a4b505e91a 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -114,7 +114,7 @@ {{if and (or .HasIssuesOrPullsWritePermission .IsIssuePoster) (not .HasMerged) (not .Issue.IsClosed)}} -