Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 0f23363

Browse filesBrowse files
committed
Autofill new patch description based on selected thread (#30)
It's a bit silly that you have to manually enter something in the description, when you just selected a thing with that title from the thread search modal. So this starts auto-filling the description. This only happens when the field is empty, and will strip some common prefixes like `Re:` and `[PATCH]`. Fixes #16
1 parent 4636298 commit 0f23363
Copy full SHA for 0f23363

File tree

2 files changed

+27
-16
lines changed
Filter options

2 files changed

+27
-16
lines changed

‎media/commitfest/js/commitfest.js

Copy file name to clipboardExpand all lines: media/commitfest/js/commitfest.js
+27-1Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ function findLatestThreads() {
3232
sel.append(
3333
$("<option/>")
3434
.text(`${i.from}: ${i.subj} (${i.date})`)
35+
.data("subject", i.subj)
3536
.val(i.msgid),
3637
);
3738
});
@@ -60,12 +61,18 @@ function browseThreads(attachfunc, closefunc) {
6061
if (!msgid || msgid === "") {
6162
msgid = $("#attachThreadList").val();
6263
if (!msgid) return;
64+
subject = $("#attachThreadList option:selected").data("subject");
65+
subject = subject.replace(/\bre: /gi, "");
66+
subject = subject.replace(/\bfwd: /gi, "");
67+
// Strips [PATCH], [POC], etc. prefixes
68+
subject = subject.replace(/\[\w+\]: /gi, "");
69+
subject = subject.replace(/\[\w+\] /gi, "");
6370
}
6471

6572
$("#attachThreadListWrap").addClass("loading");
6673
$("#attachThreadSearchButton").addClass("disabled");
6774
$("#attachThreadButton").addClass("disabled");
68-
if (attachfunc(msgid)) {
75+
if (attachfunc(msgid, subject)) {
6976
$("#attachModal").modal("hide");
7077
}
7178
$("#attachThreadListWrap").removeClass("loading");
@@ -351,3 +358,22 @@ git fetch commitfest cf/${patchId}
351358
git checkout commitfest/cf/${patchId}
352359
`);
353360
}
361+
362+
/* Build our button callbacks */
363+
$(document).ready(() => {
364+
$("button.attachThreadButton").each((i, o) => {
365+
const b = $(o);
366+
b.click(() => {
367+
$("#attachThreadAttachOnly").val("1");
368+
browseThreads((msgid, subject) => {
369+
b.prev().val(msgid);
370+
const description_field = $("#id_name");
371+
if (description_field.val() === "") {
372+
description_field.val(subject);
373+
}
374+
return true;
375+
});
376+
return false;
377+
});
378+
});
379+
});

‎pgcommitfest/commitfest/templates/base_form.html

Copy file name to clipboardExpand all lines: pgcommitfest/commitfest/templates/base_form.html
-15Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -110,20 +110,5 @@ <h3>Search user</h3>
110110
$('#searchUserSearchField').focus();
111111
});
112112
{%endif%}
113-
114-
/* Build our button callbacks */
115-
$(document).ready(function() {
116-
$('button.attachThreadButton').each(function (i,o) {
117-
var b = $(o);
118-
b.click(function() {
119-
$('#attachThreadAttachOnly').val('1');
120-
browseThreads(function(msgid) {
121-
b.prev().val(msgid);
122-
return true;
123-
});
124-
return false;
125-
});
126-
});
127-
});
128113
</script>
129114
{%endblock%}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.