Screenshot:
Last active
June 20, 2023 14:33
-
-
Save CodeBrauer/6a290a9bb5f9f362c4fe1ba14345557b to your computer and use it in GitHub Desktop.
GitLab Userscript - Adds the count of approvals to the list view of merge requests. If more than 2, MR is
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name GitLab MR approval count | |
// @namespace http://tampermonkey.net/ | |
// @version 0.6 | |
// @description GitLab show merge request approvals count and own status in list view | |
// @author CodeBrauer | |
// @match https://gitlab.com/*/-/merge_requests* | |
// @run-at document-idle | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=gitlab.com | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
document.querySelectorAll('.issuable-meta [title*=approv]').forEach(function(row) { | |
let approvals = row.getAttribute('title'); | |
let approvalsCount = approvals.match(/\d+/)[0]; | |
row.innerHTML = row.innerHTML.replace("Approved", row.getAttribute('title')); | |
if (approvalsCount < 2) { | |
row.classList.remove("text-success"); | |
row.classList.add("text-warning"); | |
} else if (approvalsCount >= 2) { | |
row.closest('li.merge-request').style.backgroundColor = '#007f0040'; | |
} | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment