Skip to content

Commit f5ce853

Browse files
committed
Temporary Reversion of contributions by @alexbt
This commit temporarily reverts the contributions made by @alexbt between Jan 25, 2017 and Oct 11, 2017. Reason: to merge the significant refactoring of the codebase made in: benbernard#9 The contributions made by @alexbt will be restored on top of the refactoring commits. The following is a list of the commits that have been reverted: df04f70 Bump version 11677eb Merge pull request benbernard#8 from alexbt/fix-empty-unresolved 45a7834 Track unresolved comments with Map 999adab Merge pull request benbernard#7 from alexbt/unresolved-files-bottom 30068dd Add unresolved comments at bottom of files tab f822008 Update version number 5af02ab Merge pull request benbernard#6 from alexbt/options-style ee5528a Merge pull request benbernard#5 from alexbt/files-tab 82a1975 Merge pull request benbernard#4 from alexbt/unresolved-bottom 64bcd6a Use chrome style options page 519c5e2 Display unresolved comments at the bottom 42fe47c Load thread comments from the 'files' tab
1 parent aabd942 commit f5ce853

2 files changed

Lines changed: 39 additions & 5 deletions

File tree

manifest.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
"name": "Github Comment Tracker",
55
"description": "Tracks resolved / unresolved state of comments on github pull requests",
6-
"version": "1.1.6",
6+
"version": "1.1.8",
77

88
"permissions": [
99
"https://github.com/",
@@ -16,5 +16,9 @@
1616
"css": ["main.css"]
1717
}],
1818

19-
"options_page": "options.html"
19+
"options_page": "options.html",
20+
"options_ui": {
21+
"chrome_style": true,
22+
"page": "options.html"
23+
}
2024
}

tracker.js

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// Other file forwarders
77
var Parse;
88
var waitForKeyElements;
9+
var unresolvedCommentsMap = {};
910

1011
var findAllThreads = function () {
1112
var threads = [];
@@ -32,6 +33,14 @@ var findAllThreads = function () {
3233
}
3334
});
3435

36+
$('#files .review-comment').each(function () {
37+
threads.push({
38+
id: this.id,
39+
comments: $(this),
40+
lastCommentId: this.id,
41+
});
42+
});
43+
3544
return threads;
3645
};
3746

@@ -134,7 +143,16 @@ var updateMergeButton = function () {
134143
}
135144
} else {
136145
if (!allThreadsResolved()) {
137-
$('.merge-message').before(
146+
147+
//map to array of values
148+
var unresolvedCommentsArray = []
149+
for (var key in unresolvedCommentsMap) {
150+
if (unresolvedCommentsMap.hasOwnProperty(key)) {
151+
unresolvedCommentsArray.push(unresolvedCommentsMap[key])
152+
}
153+
}
154+
155+
var commentStatus =
138156
'<div class="branch-action-item comment-track-status">' +
139157
' <div class="branch-action-item-icon completeness-indicator completeness-indicator-problem">' +
140158
' <svg aria-hidden="true" class="octicon octicon-alert" height="16" role="img" version="1.1" viewBox="0 0 16 16" width="16"><path d="M15.72 12.5l-6.85-11.98C8.69 0.21 8.36 0.02 8 0.02s-0.69 0.19-0.87 0.5l-6.85 11.98c-0.18 0.31-0.18 0.69 0 1C0.47 13.81 0.8 14 1.15 14h13.7c0.36 0 0.69-0.19 0.86-0.5S15.89 12.81 15.72 12.5zM9 12H7V10h2V12zM9 9H7V5h2V9z"></path></svg>' +
@@ -143,8 +161,14 @@ var updateMergeButton = function () {
143161
' <span class="status-meta">' +
144162
' See above for red unresolved comments' +
145163
' </span>' +
146-
' </div>'
147-
);
164+
' <lu><li>' + unresolvedCommentsArray.join('</li><li>') + "</li></lu>" +
165+
' </div>';
166+
167+
//discussions tab
168+
$('.merge-message').before(commentStatus);
169+
170+
//files tab
171+
$('#files').after(commentStatus);
148172
}
149173
}
150174
};
@@ -175,6 +199,7 @@ var makeButton = function (elem, threadInfo) {
175199
if ($elem.find(actionSelector).length === 0) {
176200
actionSelector = '.timeline-comment-actions';
177201
}
202+
delete unresolvedCommentsMap[threadInfo.id];
178203

179204
var string;
180205
if (threadInfo.resolved) {
@@ -196,6 +221,11 @@ var makeButton = function (elem, threadInfo) {
196221
string = '<span class="octicon comment-track-action comment-track-resolve"></span>';
197222
$elem.find(actionSelector).prepend(string);
198223

224+
var content = $elem.find(actionSelector)[0].innerText.trim();
225+
if (content != "") {
226+
unresolvedCommentsMap[threadInfo.id] = content;
227+
}
228+
199229
$elem.find('.comment-track-resolve').on('click', function (event) {
200230
event.preventDefault();
201231
var tracker = threadInfo.tracker || new CommentTracker();

0 commit comments

Comments
 (0)