Skip to content

Commit

Permalink
Merge pull request #30 from KWierso/924405
Browse files Browse the repository at this point in the history
Bug 924405 - Switch to the native REST bugzilla API r=graememcc
  • Loading branch information
KWierso committed Sep 3, 2015
2 parents 7f53ee1 + f42ea60 commit 16bbe25
Show file tree
Hide file tree
Showing 8 changed files with 461 additions and 255 deletions.
2 changes: 1 addition & 1 deletion index.html
Expand Up @@ -5,7 +5,7 @@
<link type="text/css" rel="stylesheet" href="thirdparty/toast/toast.css" />
<link type="text/css" rel="stylesheet" href="css/style.css" />
<script type="text/javascript" src="thirdparty/jquery/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="thirdparty/bzjs/bz-0.3.0.js"></script>
<script type="text/javascript" src="thirdparty/bzjs/bz-0.4.3.js"></script>
<script type="text/javascript" src="js/Utils.js"></script>
<script type="text/javascript" src="js/Config.js"></script>
<script type="text/javascript" src="js/Step.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion js/BugData.js
Expand Up @@ -107,7 +107,7 @@ var BugData = {
if (this.statusFlag)
bug.statusFlag = bugObj[this.statusFlag];

bug.isUnassigned = bugObj.assigned_to.name == 'nobody';
bug.isUnassigned = /^nobody@(?:mozilla.org|nss.bugs)$/.test(bugObj.assigned_to.name);

bug.intestsuite = ' ';
bug.testsuiteFlagID = -1;
Expand Down
30 changes: 13 additions & 17 deletions js/Step.js
Expand Up @@ -48,8 +48,9 @@ function Step(name, callbacks, isBackout) {
this.haveComment = [];

var options = {};
if (Step.remaps.items > 0)
options.test = true;
if (Step.remaps.items > 0) {
options.url = "https://bugzilla-dev.allizom.org/rest";
}
this.unprivilegedLoader = bz.createClient(options);

constructAttachedBugs(false);
Expand Down Expand Up @@ -104,10 +105,8 @@ Step.prototype.getSecurityBugs = function Step_getSecurityBugs() {


Step.prototype.createComment = function Step_createComment(text) {
return {creation_time: new Date().toISOString(),
creator: {email: Step.username},
is_private: 0,
text: text};
return {is_private: 0,
body: text};
};


Expand Down Expand Up @@ -140,7 +139,7 @@ Step.prototype.createBug = function Step_createBug(bugID, info) {

if (comments.length > 0) {
var text = comments.join('\n');
bug.comments = [this.createComment(text)];
bug.comment = this.createComment(text);
changed = true;
}

Expand All @@ -153,8 +152,7 @@ Step.prototype.createBug = function Step_createBug(bugID, info) {
var keywords = BugData.bugs[bugID].keywords;
var checkinIndex = keywords.indexOf('checkin-needed');
if (checkinIndex != -1) {
keywords.splice(checkinIndex, 1);
bug.keywords = keywords;
bug.keywords = { "remove" : ["checkin-needed"] };
}

// Set status flag if appropriate
Expand All @@ -175,7 +173,7 @@ Step.prototype.createBug = function Step_createBug(bugID, info) {
}
}
if (canSetAssignee)
bug.assigned_to = {name: assignee};
bug.assigned_to = assignee;
}

// Set in-testsuite if possible
Expand All @@ -190,8 +188,6 @@ Step.prototype.createBug = function Step_createBug(bugID, info) {

if (bugID in Step.remaps) {
bug.id = Step.remaps[bugID];
if ('resolution' in bug)
bug.product = 'mcMerge test product';
}
return bug;
}
Expand Down Expand Up @@ -296,10 +292,10 @@ Step.prototype.startSubmit = function Step_startSubmit(i) {
var self = this;

// Offer the chance to add a backout explanation where appropriate
if (this.name == 'notFoundBackouts' && 'comments' in this.sendData[i] &&
this.sendData[i].comments[0].text.indexOf(Config.hgBaseURL) == 0) {
if (this.name == 'notFoundBackouts' && 'comment' in this.sendData[i] &&
this.sendData[i].comment.body.indexOf(Config.hgBaseURL) == 0) {
if (this.prependChosen) {
this.sendData[i].comments[0].text = this.prependText + this.sendData[i].comments[0].text
this.sendData[i].comment.body = this.prependText + this.sendData[i].comment.body
this.midSubmit(i);
} else {
var self = this;
Expand All @@ -308,7 +304,7 @@ Step.prototype.startSubmit = function Step_startSubmit(i) {
self.prependChosen = true;
self.prependText = text;
}
self.sendData[i].comments[0].text = text + self.sendData[i].comments[0].text
self.sendData[i].comment.body = text + self.sendData[i].comment.body
self.midSubmit(i);
};
UI.acquireExplanation(callback, this.sendData[i].id);
Expand Down Expand Up @@ -407,7 +403,7 @@ Step.prototype.postSubmit = function Step_postSubmit(i) {
for (var j = 0; j < info.linkedChangesets.length; j++) {
var index = info.linkedChangesets[j];
// Disallow comments if we just sent a comment
if ('comments' in sent) {
if ('comment' in sent) {
var attached = this.attachedBugs[index][bugID];
if (attached.canComment && attached.shouldComment) {
attached.canComment = false;
Expand Down
4 changes: 2 additions & 2 deletions js/Summary.js
Expand Up @@ -23,8 +23,8 @@ var Summary = {
else
html += '&nbsp;';
html += '</td><td>';
if ('comments' in data) {
var comment = data.comments[0].text;
if ('comment' in data) {
var comment = data.comment.body;
comment = comment.replace(/\n/g, '<br>');
Config.hgRevFullRE.lastIndex = 0;
comment = comment.replace(Config.hgRevFullRE, function(str) {return UI.linkifyRevURL(str);});
Expand Down
2 changes: 1 addition & 1 deletion js/ViewerController.js
Expand Up @@ -61,7 +61,7 @@ var ViewerController = {
// Create privileged loader
var options = {username: uname, password: pwd}
if (this.remap)
options.test = true;
options.url = "https://bugzilla-dev.allizom.org/rest";

var privLoader = bz.createClient(options);

Expand Down
2 changes: 1 addition & 1 deletion test/SpecRunner.html
Expand Up @@ -13,7 +13,7 @@

<!-- include the library you want to test here... -->
<script type="text/javascript" src="../thirdparty/jquery/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="../thirdparty/bzjs/bz-0.3.0.js"></script>
<script type="text/javascript" src="../thirdparty/bzjs/bz-0.4.3.js"></script>
<script type="text/javascript" src="../js/Utils.js"></script>
<script type="text/javascript" src="../js/Config.js"></script>
<script type="text/javascript" src="../js/Step.js"></script>
Expand Down
232 changes: 0 additions & 232 deletions thirdparty/bzjs/bz-0.3.0.js

This file was deleted.

0 comments on commit 16bbe25

Please sign in to comment.