Skip to content
This repository was archived by the owner on Aug 31, 2023. It is now read-only.

Commit d3215da

Browse files
committed
Actually implement the feature
1 parent 5341b9e commit d3215da

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ A browser extension that enhance all Merge Requests lists on any instance of Git
2323
- Base Jira URL is configured in extension preferences
2424
- The ticket ID or an icon can be displayed as the link label (configured in extension preferences)
2525
- WIP toggle button (can be enabled/disabled in the extension preferences)
26-
- Show an indicator when there's unresolved discussions left on Merge Requests (can be enabled/disabled in the extension preferences)
26+
- Show an indicator when there's unresolved discussions left on Merge Requests
27+
- Can be enabled/disabled in the extension preferences
28+
- Note the **All discussions must be resolved** option must be enabled for this feature to be working as expected. This option must be enabled per project and is located in **Settings > General > Merge Requests > Merge checks**
2729
- Compatible with all GitLab editions (GitLab CE, GitLab EE, GitLab.com) (look at the prerequisites, though)
2830

2931
## Prerequisites

html/options.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
<input type="checkbox" id="enable_unresolved_discussions_indicator">
6868
</div>
6969
<div class="fluid">
70-
<label for="enable_unresolved_discussions_indicator">Show an indicator when there's unresolved discussions left</label>
70+
<label for="enable_unresolved_discussions_indicator">Show an indicator when there's unresolved discussion(s) left</label>
7171
</div>
7272
</div>
7373
<div class="txt-center pts pbs"><button type="submit" class="browser-style">Save preferences</button></div>

js/content.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,18 @@
416416
newInfoLineToInject
417417
);
418418
}
419+
420+
// -----------------------------------------------
421+
// Unresolved discussions indicator
422+
423+
if (this.preferences.enable_unresolved_discussions_indicator && !mergeRequest.blocking_discussions_resolved) {
424+
let unresolvedDiscussionsIndicatorToInject = '<li><span class="has-tooltip" title="Unresolved discussion(s) left">' + this.buildSpriteIcon('comment-dots', 'danger-title') + '</span></li>';
425+
426+
this.parseHtmlAndPrepend(
427+
mergeRequestNode.querySelector('.issuable-meta .controls'),
428+
unresolvedDiscussionsIndicatorToInject
429+
);
430+
}
419431
}, this);
420432
}
421433

@@ -597,8 +609,8 @@
597609
/**
598610
* Generate the HTML code corresponding to an SVG icon.
599611
*/
600-
buildSpriteIcon(iconName) {
601-
return '<svg class="s16" data-testid="' + iconName + '-icon">' +
612+
buildSpriteIcon(iconName, classes = '') {
613+
return '<svg class="s16 ' + classes + '" data-testid="' + iconName + '-icon">' +
602614
'<use xlink:href="' + this.baseIconsUrl + '#' + iconName + '"></use>' +
603615
'</svg>';
604616
}

screenshot.png

19.9 KB
Loading

0 commit comments

Comments
 (0)