Skip to content

Instantly share code, notes, and snippets.

@hallvors
Last active December 22, 2015 23:38
Show Gist options
  • Save hallvors/6547811 to your computer and use it in GitHub Desktop.
Save hallvors/6547811 to your computer and use it in GitHub Desktop.
Bugzilla has a "mass processing" feature but it only supports updating all bugs with the same data. I.e. if you want to *add* something to the *existing* data in summary or short description, it won't work. Here is a workaround. Use at your own risk and vet the search result carefully first :-)
/* adapt as required and paste into console to mass-modify bugs in a search result */
/* naturally, this script will take a while to run... */
(function(){
var elms = document.getElementsByClassName('bz_id_column')
var i=0;
iframe = document.createElement('iframe');
document.body.appendChild(iframe);
iframe.setAttribute('style', 'position:fixed; bottom:0;width:100%;height:200px')
iframe.onload = function(){
var submitted = false; for(var j=0; j<iframe.contentDocument.links.length; j++)if((iframe.contentDocument.links[j].getAttribute('onclick')||'').indexOf('toggleBugmailRecipients')>-1)submitted=true;
if(submitted && elms[i]){
iframe.contentWindow.location.href = elms[i].firstElementChild.href;
i++;
return;
}else if(!submitted){
// This is the section you need to customize to change relevant fields in the bug form before submitting it..
iframe.contentDocument.getElementById('status_whiteboard').value+=' [contactready]';
// end of bug form data modification code
iframe.contentDocument.getElementById('status_whiteboard').form.submit();
}else if(!elms[i]){
alert('Done! Supposedly modified '+i+' bugs successfully.');
iframe.parentNode.removeChild(iframe);
}
}
iframe.src = elms[i].firstElementChild.href;
i++;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment