summaryrefslogtreecommitdiffstats
path: root/public
diff options
context:
space:
mode:
authorJulien Tant <julien@craftyx.fr>2018-08-13 21:04:39 +0200
committerLauris BH <lauris@nix.lv>2018-08-13 22:04:39 +0300
commit7781e8cef2dfe73d71be7804f4c5a7c5f1995d31 (patch)
tree7bbe6d2a031655478538e152912182f5ad3500eb /public
parent52c2cb15db77a381880db7e44f133a49b3516dd5 (diff)
downloadgitea-7781e8cef2dfe73d71be7804f4c5a7c5f1995d31.tar.gz
gitea-7781e8cef2dfe73d71be7804f4c5a7c5f1995d31.zip
Disable merging a WIP Pull request (#4529)
* prevent pull request to be merged when PR is a WIP * add tests * add helper to prepend WIP: in PR title * move default wip prefixes into settings * use configurable WIP prefixes in javascript and default to first one in templates * add documentation * add unit test on pull model Signed-off-by: Julien Tant <julien@craftyx.fr>
Diffstat (limited to 'public')
-rw-r--r--public/js/index.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/public/js/index.js b/public/js/index.js
index 6c710f18f6..a4702a4138 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -1655,6 +1655,23 @@ function u2fRegisterRequest() {
});
}
+function initWipTitle() {
+ $(".title_wip_desc > a").click(function (e) {
+ e.preventDefault();
+
+ var $issueTitle = $("#issue_title");
+ var value = $issueTitle.val().trim().toUpperCase();
+
+ for (var i in wipPrefixes) {
+ if (value.startsWith(wipPrefixes[i].toUpperCase())) {
+ return;
+ }
+ }
+
+ $issueTitle.val(wipPrefixes[0] + " " + $issueTitle.val());
+ });
+}
+
$(document).ready(function () {
csrf = $('meta[name=_csrf]').attr("content");
suburl = $('meta[name=_suburl]').attr("content");
@@ -1869,6 +1886,7 @@ $(document).ready(function () {
initU2FAuth();
initU2FRegister();
initIssueList();
+ initWipTitle();
initPullRequestReview();
// Repo clone url.