diff options
-rw-r--r-- | RH_Data-packages.json | 4 | ||||
-rw-r--r-- | bugzillaBugTriage.js | 88 |
2 files changed, 67 insertions, 25 deletions
diff --git a/RH_Data-packages.json b/RH_Data-packages.json index cf9e334..50ab1b1 100644 --- a/RH_Data-packages.json +++ b/RH_Data-packages.json @@ -282,11 +282,11 @@ "CCmaintainer": [ { "regexp": "xorg|X11|compiz|chkfontpath|imake|libdmx|libdrm|libfontenc|libFS|libICE|libSM|libwnck|libxkbfile|mesa|pyxf86config|system-config-display|xkeyboard-config|xrestop|xsri", - "addr": "xgl-maint@redhat.com" + "addr": ["xgl-maint@redhat.com"] }, { "regexp": "epiphany.*|firefox|galeon|gecko-sharp2|htmlview|^mozilla|seamonkey|thunderbird|xulrunner|nspluginwrapper", - "addr": "gecko-bugs-nobody@fedoraproject.org" + "addr": ["gecko-bugs-nobody@fedoraproject.org" , "gecko-bugs-nobody@redhat.com" ] } ], "newUpstreamBug": [ diff --git a/bugzillaBugTriage.js b/bugzillaBugTriage.js index f19a40e..67fe8d5 100644 --- a/bugzillaBugTriage.js +++ b/bugzillaBugTriage.js @@ -78,14 +78,12 @@ function XMLRPCMessage(methodname) { } XMLRPCMessage.prototype.setMethod = function(methodName) { - if (!methodName) - return; + if (!methodName) return; this.method = methodName; }; XMLRPCMessage.prototype.addParameter = function(data) { - if (arguments.length == 0) - return; + if (arguments.length == 0) return; this.params[this.params.length] = data; }; @@ -292,10 +290,16 @@ hlpr.valToArray = function valToArray(val) { * @return String with merged lists */ hlpr.addCSVValue = function addCSVValue(str, value) { + console.log("addCSVValue: str = " + str + ", value = " + value); + console.log("addCSVValue: typeof str = " + typeof str + ", typeof value = " + typeof value); let parts = (str.trim().length > 0 ? str.split(",") : []); - if (!hlpr.isInList(parts,value)) { - parts = parts.concat(hlpr.valToArray(value)); + console.log("parts before = " + parts.toSource()); + if (!hlpr.isInList(value,parts)) { + let newValue = hlpr.valToArray(value); + console.log("newValue = " + newValue); + parts = parts.concat(newValue); } + console.log("parts on leaving = " + parts.toSource()); return parts.join(", "); }; @@ -594,9 +598,9 @@ Color.prototype.lightColor = function() { function BZPage(doc) { // constants this.SalmonPink = new Color(255, 224, 176); // RGB 255, 224, 176; HSL 36, 2, - // 85 + // 85 this.ReporterColor = new Color(255, 255, 166); // RGB 255, 255, 166; HSL 60, 2, - // 83 + // 83 this.EmptyLogsColor = new Color(0, 255, 0); this.FullLogsColor = new Color(0, 40, 103); @@ -610,10 +614,23 @@ function BZPage(doc) { this.constantData = config.gJSONData.constantData; } + if ("CCmaintainer" in config.gJSONData.constantData) { + this.defBugzillaMaintainerArr = config.gJSONData.constantData.CCmaintainer; + } + if ("submitsLogging" in config.gJSONData.configData && config.gJSONData.configData.submitsLogging) { this.setUpLoggingButtons(); } + + this.reporter = this.getReporter(); + this.product = this.getOptionValue("product"); + this.component = this.getOptionValue("component"); + this.version = this.getVersion(); + this.defaultAssignee = this.setDefaultAssignee(); + this.title = this.doc.getElementById("short_desc_nonedit_display").textContent; + this.CCList = this.getCCList(); + this.generateButtons(); } @@ -747,8 +764,11 @@ BZPage.prototype.centralCommandDispatch = function (cmdLabel, cmdParams) { * this.centralCommandDispatch to execute them. */ BZPage.prototype.executeCommand = function (cmd) { + console.log("executeCommand / cmd = " + cmd); let [pkg, id] = cmd.split("//"); let commentObj = this.packages[pkg][id]; + console.log("commentObj:\n" + commentObj.toSource()+ + "\n----------------------------------"); for (let key in commentObj) { console.log("key = " + key + @@ -1019,7 +1039,7 @@ BZPage.prototype.getISODate = function (dateStr) { * * @param list Array with regexps and return values * @param chosingMark String by which the element of array is to be matched - * @return String chosen element + * @return Object chosen element */ BZPage.prototype.filterByRegexp = function(list, chosingMark) { let chosenPair = []; @@ -1029,7 +1049,7 @@ BZPage.prototype.filterByRegexp = function(list, chosingMark) { }); } if (chosenPair.length > 0) { - return chosenPair[0].addr.trim(); + return chosenPair[0].addr; } else { return ""; } @@ -1149,6 +1169,19 @@ BZPage.prototype.getLogin = function () { }; /** + * Return maintainer which is per default by bugzilla + * (which is not necessarily the one who is default maintainer per component) + * + * @return String with the maintainer's email address + */ +BZPage.prototype.getDefaultBugzillaMaintainer = function(component) { + console.log("getDefaultBugzillaMaintainer / component = " + component); + let address = this.filterByRegexp(this.defBugzillaMaintainerArr, component); + console.log("getDefaultBugzillaMaintainer / address = " + address); + return address; +} + +/** * collect the list of attachments in a structured format * * @return Array of arrays, one for each attachments; @@ -1345,16 +1378,9 @@ RHBugzillaPage = function(doc) { let bugNoTitle = this.doc.querySelector("#title > p").textContent.trim(); this.bugNo = new RegExp("[0-9]+").exec(bugNoTitle)[0]; - this.reporter = this.getReporter(); - this.product = this.getOptionValue("product"); - this.component = this.getOptionValue("component"); - this.version = this.getVersion(); - this.defaultAssignee = this.setDefaultAssignee(); - this.title = this.doc.getElementById("short_desc_nonedit_display").textContent; let ITbutton = this.doc.getElementById("cf_issuetracker"); this.its = ITbutton ? ITbutton.value.trim() : ""; - this.CCList = this.getCCList(); - + // set default assignee on change of the component this.doc.getElementById("component").addEventListener("change", function() { @@ -1407,13 +1433,23 @@ RHBugzillaPage.prototype.constructor = RHBugzillaPage; /** * Find default assignee based on the current component * + * @return String what would be a default assignee if + * we haven't set it up. + */ +RHBugzillaPage.prototype.getDefaultAssignee = function() { + return this.filterByRegexp(this.constantData.defaultAssignee, + this.component).toLowerCase(); +} + + +/** + * Set default assignee + * * @return none * sets this.defaultAssignee property according to defaultAssignee list */ RHBugzillaPage.prototype.setDefaultAssignee = function() { - this.defaultAssignee = this.filterByRegexp( - this.constantData.defaultAssignee, - this.component).toLowerCase(); + this.defaultAssignee = this.getDefaultAssignee(); let defAss = this.defaultAssignee; // Add setting default assignee @@ -1569,7 +1605,7 @@ RHBugzillaPage.prototype.submitCallback = function(evt) { let serForm = this .serializeForm(jetpack.tabs.focused.contentWindow.document.forms .namedItem("changeform")); - console.log("serForm:\n" + serForm.toSource()); +// console.log("serForm:\n" + serForm.toSource()); } else { let serForm = this .serializeForm(jetpack.tabs.focused.contentWindow.document.forms @@ -2364,10 +2400,16 @@ RHBugzillaPage.prototype.markBugTriaged = function() { // for <F13 it is "add both" (ASSIGNED status and Triaged keyword) let ver = this.getVersion(); let assignee = this.getOwner(); - if (!hlpr.isInList(assignee, this.CCList)) { + console.log("assignee = " + assignee); + console.log("CCList = " + this.CCList); + console.log("component = " + this.getOptionValue("component")); + let defBugMaint = this.getDefaultBugzillaMaintainer(this.getOptionValue("component")) + console.log("default bugzilla maintainer = " + defBugMaint); + if ((!hlpr.isInList(assignee,defBugMaint)) && (!hlpr.isInList(assignee, this.CCList))) { this.addToCCList(assignee); } if ((!this.isEnterprise()) && (ver < TriagedDistro)) { + console.log("setting ASSIGNED"); this.selectOption("bug_status", "ASSIGNED"); } console.log("calling addStuffToTextBox in markBugTriaged with\n" + |