Last active
October 21, 2023 07:43
-
-
Save PiDelport/74453fa91872a9e51c7858550ff3cab3 to your computer and use it in GitHub Desktop.
GitLab Draft Comments (User Script)
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 Draft Comments | |
// @description Alert for and list forgotten GitLab draft comments. | |
// @namespace https://github.com/PiDelport/ | |
// @author Pi Delport <[email protected]> | |
// @version 1.0 | |
// @license MIT | |
// @homepageURL https://gist.github.com/PiDelport/74453fa91872a9e51c7858550ff3cab3 | |
// | |
// @grant GM.registerMenuCommand | |
// @match https://gitlab.com/* | |
// ==/UserScript== | |
'use strict'; | |
// See: https://gitlab.com/gitlab-org/gitlab/-/issues/24391 | |
function workaround() { | |
const entries = Object.entries(localStorage).filter(([key, value]) => key.startsWith('autosave/')); | |
if (0 < entries.length) { | |
const summary = entries.map(([key, value]) => `${key}:\n${value}\n\n`).concat(); | |
alert(`Warning: ${entries.length} draft comments (see console)\n\n${summary}`); | |
entries.forEach(([key, value]) => console.log({key, value})) | |
} | |
} | |
(function() { | |
GM.registerMenuCommand('List draft comments (see console)', workaround); | |
workaround(); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment