@@ -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 ( / \b r e : / gi, "" ) ;
66+ subject = subject . replace ( / \b f w d : / 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}
351358git 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+ } ) ;
0 commit comments