summaryrefslogtreecommitdiffstats
path: root/js/bugzilla-readable-status-min.js
diff options
context:
space:
mode:
Diffstat (limited to 'js/bugzilla-readable-status-min.js')
-rw-r--r--js/bugzilla-readable-status-min.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/js/bugzilla-readable-status-min.js b/js/bugzilla-readable-status-min.js
new file mode 100644
index 000000000..b808a9e84
--- /dev/null
+++ b/js/bugzilla-readable-status-min.js
@@ -0,0 +1,7 @@
+(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.bugzillaReadableStatus = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
+var set_error=function(t){return{error:t}},Bug=function(t){return this.data=t,this};Bug.prototype.parse=function(){try{return this._parse()}catch(t){return set_error("CANNOT_PARSE_BUG")}},Bug.prototype._parse=function(){var t,e="",r="",s="";if("undefined"==typeof this.data.id||"undefined"==typeof this.data.status||"undefined"==typeof this.data.resolution)return set_error("NO_STRING_FOR_BUG");if(s=this.hasKeyword("regression")?"regression bug":"bug","VERIFIED"===this.data.status.toUpperCase())e=s+" has been fixed and VERIFIED",t=this.getTargetMilestone(),t&&(e+=" for Firefox "+t);else if(["CLOSED","RESOLVED"].indexOf(this.data.status.toUpperCase())>-1){if(e=s+" "+this.data.status.toUpperCase()+" as "+this.data.resolution,"DUPLICATE"===this.data.resolution.toUpperCase())return e+=" of "+this.data.dupe_of;if("FIXED"!==this.data.resolution.toUpperCase())return e;t=this.getTargetMilestone(),t&&(e+=" for Firefox "+t)}else e=this.data.status.toUpperCase()+" "+s;return this.data.triage&&"untriaged"===this.data.triage.toLowerCase()&&(e="UNTRIAGED "+e),r=this.firstAffected(),r&&(e+=" found in Firefox "+r),firstTracked=this.firstTracked(),firstTracked?e+=" which is tracked for Firefox "+firstTracked:"FIXED"!=this.data.resolution&&(e+=this.getPriority()),this.hasNeedInfo()&&(e+=" awaiting an answer on a request for information"),e},Bug.prototype.getPriority=function(){var t;switch(this.data.priority){case"--":t=" with no priority";break;case"P1":t=" which should be worked on in the current release/iteration";break;case"P2":t=" which should be worked on in the next release/iteration";break;case"P3":t=" which is a feature request";break;case"P4":t=" which is a long term backlog item";break;case"P5":t=" which will not be worked on by staff, but a patch will be accepted";break;default:t=""}return t},Bug.prototype.hasKeyword=function(t){return this.data.keywords&&this.data.keywords.indexOf(t)>-1},Bug.prototype.hasFlag=function(t,e){return this.data.flags&&this.data.flags.some(function(r,s,i){return r.name===t&&r.status===e})},Bug.prototype.hasNeedInfo=function(){return this.hasFlag("needinfo","?")},Bug.prototype.getFields=function(t){var e,r=Object.keys(this.data);return e=r.filter(function(e,r,s){return 0===e.indexOf(t)}),e.sort()},Bug.prototype.getAffectedReleases=function(){return"undefined"==typeof this.statusFlags&&(this.statusFlags=this.getFields("cf_status_firefox")),this.statusFlags.filter(function(t,e,r){return["affected"].indexOf(this.data[t])>-1},this)},Bug.prototype.firstAffected=function(){var t;return"undefined"==typeof this.statusFlags&&(this.statusFlags=this.getFields("cf_status_firefox")),t=this.getAffectedReleases(),t.length>0?t[0].split("cf_status_firefox")[1]:""},Bug.prototype.getTargetMilestone=function(){return"undefined"!=typeof this.data.target_milestone&&"---"!=this.data.target_milestone&&0===this.data.target_milestone.indexOf("mozilla")?this.data.target_milestone.slice(7):""},Bug.prototype.getTrackedReleases=function(){return"undefined"==typeof this.trackingFlags&&(this.trackingFlags=this.getFields("cf_tracking_firefox")),this.trackingFlags.filter(function(t,e,r){return["+"].indexOf(this.data[t])>-1},this)},Bug.prototype.firstTracked=function(){var t;return"undefined"==typeof this.trackingFlags&&(this.trackingFlags=this.getFields("cf_tracking_firefox")),t=this.getTrackedReleases(),t.length>0?t[0].split("cf_tracking_firefox")[1]:""},exports.readable=function(t){if(void 0===t)return set_error("NO_BUG_INFO");if(Array.isArray(t)){var e={statuses:[]};return t.forEach(function(t){var r={},s=new Bug(t),i=s.parse();"undefined"!=typeof i.error?r.error=i.error:r.status=i,r.id=s.data.id,e.statuses.push(r)}),e}var r=new Bug(t);return r.parse()};
+},{}]},{},[1])(1)
+});
+
+
+//# sourceMappingURL=bugzilla-readable-status-min.js.map \ No newline at end of file