aboutsummaryrefslogtreecommitdiffstats
path: root/data/tweaks
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-06-04 02:30:57 +0200
committerMatěj Cepl <mcepl@redhat.com>2011-06-05 14:53:48 +0200
commitffa6d74ddbf28c7fb7be1ad473847807d0301eac (patch)
treed10ac4afcfeb053567db51462e9695badab875ee /data/tweaks
parent7509c91794f93a5b4445239429c2b918f771b543 (diff)
downloadbugzilla-triage-ffa6d74ddbf28c7fb7be1ad473847807d0301eac.tar.gz
Moving ahead ... storing the progress for future.
Diffstat (limited to 'data/tweaks')
-rw-r--r--data/tweaks/bug-page-mod.js102
1 files changed, 43 insertions, 59 deletions
diff --git a/data/tweaks/bug-page-mod.js b/data/tweaks/bug-page-mod.js
index b8eb836..2fff501 100644
--- a/data/tweaks/bug-page-mod.js
+++ b/data/tweaks/bug-page-mod.js
@@ -205,39 +205,11 @@ function tweakBugzilla(atts, cData) {
tbplbotSpamCollapser();
}
+
// ===================================================
function processHistory(history) {
// FIXME Remove remaining code to special function ... callback
-// preprocessDuplicateMarkers(document, iframe.contentDocument);
-
- /*
- * This is an example of the history we get: { "version": "1.1", "result": {
- * "bugs": [ { "history": [ { "when": "2011-04-04T00:19:04Z", "who":
- * "cebbert@redhat.com", "changes": [ { "removed": "", "added":
- * "xgl-maint@redhat.com", "field_name": "cc", "field": "CC" }, { "removed":
- * "kernel", "added": "xorg-x11-drv-ati", "field_name": "component", "field":
- * "Component" }, { "removed": "kernel-maint@redhat.com", "added":
- * "xgl-maint@redhat.com", "field_name": "assigned_to", "field": "AssignedTo" } ] }, {
- * "when": "2011-04-12T22:48:22Z", "who": "mcepl@redhat.com", "changes": [ {
- * "attachment_id": 488889, "removed": "application/octet-stream", "added":
- * "text/plain", "field_name": "attachments.mimetype", "field": "Attachment
- * mime type" } ] }, { "when": "2011-04-13T17:07:04Z", "who":
- * "mcepl@redhat.com", "changes": [ { "removed": "", "added":
- * "needinfo?(suckfish@ihug.co.nz)", "field_name": "flagtypes.name", "field":
- * "Flags" } ] }, { "when": "2011-04-21T12:17:33Z", "who": "mcepl@redhat.com",
- * "changes": [ { "removed": "xgl-maint@redhat.com", "added":
- * "jglisse@redhat.com", "field_name": "assigned_to", "field": "AssignedTo" } ] }, {
- * "when": "2011-04-28T22:53:58Z", "who": "mcepl@redhat.com", "changes": [ {
- * "attachment_id": 488889, "removed": "text/plain", "added":
- * "application/octet-stream", "field_name": "attachments.mimetype", "field":
- * "Attachment mime type" } ] }, { "when": "2011-04-28T22:59:18Z", "who":
- * "mcepl@redhat.com", "changes": [ { "attachment_id": 488889, "removed":
- * "application/octet-stream", "added": "text/plain", "field_name":
- * "attachments.mimetype", "field": "Attachment mime type" } ] } ], "id":
- * 692250, "alias": [
- * ] } ], "faults": [
- * ] } }
- */
+ // preprocessDuplicateMarkers(document, iframe.contentDocument);
// UserNameCache
var userNameCache = {};
@@ -254,53 +226,65 @@ function processHistory(history) {
return email;
}
- if (history) {
-// console.log("processHistory: history = " + history.toSource());
- return ;
- }
-
-// var historyItems = iframe.contentDocument.querySelectorAll('#bugzilla-body
-// tr');
-// var cmtTimes = document.querySelectorAll('.bz_comment_time');
+ var comments = {};
+ commentsWalker(function (comment) {
+ var nameSpan = comment.querySelector(".bz_comment_user a.email");
+ var timeSpan = comment.getElementsByClassName("bz_comment_time")[0];
+ var commenter = parseMailto(nameSpan).trim();
+ var newDate = parseBZCommentDate(timeSpan.textContent.trim());
+ comments[commenter+ISODateString(newDate)] = timeSpan;
+ });
// Sometimes the history will stack several changes together,
// and we'll want to append the data from the Nth item to the
// div created in N-1
- var i=0, j=0, flagsFound;
if (history) {
- Array.forEach(history, function (item) {
- processHistoryItem(cmtTimes, item);
+ history.bugs.forEach(function (historyBug) {
+ historyBug.history.forEach(function (historyItem) {
+ processHistoryItem(comments, historyItem);
+ });
});
}
handleEmptyCollapsedBoxes(document);
-// // Set the latest flag links if necessary
-// for (var flagName in flagOccurrences) {
-// flags[flagName].innerHTML = '<a href="#' + flagOccurrences[flagName] + '">'
-// + flags[flagName].innerHTML + '</a>';
-// }
+ // // Set the latest flag links if necessary
+ // for (var flagName in flagOccurrences) {
+ // flags[flagName].innerHTML = '<a href="#' + flagOccurrences[flagName] + '">'
+ // + flags[flagName].innerHTML + '</a>';
+ // }
-// AttachmentFlagHandler.setupLinks(document);
+ // AttachmentFlagHandler.setupLinks(document);
// END OF load event handler
}
function processHistoryItem(commentTimes, itemRaw) {
- var item = itemRaw.querySelectorAll("td");
- if (!item[1])
- return;
+ /*
+ {
+ "when": "2011-04-13T17:07:04Z",
+ "who": "mcepl@redhat.com",
+ "changes": [
+ {
+ "removed": "",
+ "added": "needinfo?(suckfish@ihug.co.nz)",
+ "field_name": "flagtypes.name",
+ "field": "Flags"
+ }
+ ]
+ },
+ */
+ console.log("processHistoryItem: commentTimes = " + commentTimes.toSource());
+ console.log("processHistoryItem: itemRaw = " + itemRaw.toSource());
- var reachedEnd = false;
- for (; j < commentTimes.length; j++) {
- if (trimContent(item[1]) > trimContent(commentTimes[j])) {
- if (j < commentTimes.length - 1) {
- return;
- } else {
- reachedEnd = true;
- }
- }
+ var itemKey = itemRaw.who+itemRaw.when;
+ if (itemKey in commentTimes) {
+
+ // itemRaw belongs to one of comments
+ // FIXME I STOPPED MY WORK HERE §§§ $$$
+
+ }
var commentHead = commentTimes[j].parentNode;