Skip to content

Instantly share code, notes, and snippets.

@freakynit
Last active July 28, 2025 11:30
Show Gist options
  • Save freakynit/1f472c92e01f7e77287c727c6df0436c to your computer and use it in GitHub Desktop.
Save freakynit/1f472c92e01f7e77287c727c6df0436c to your computer and use it in GitHub Desktop.
function filterNoisyGithubCommentEmails(subject, list, days) {
days = (typeof days === "undefined" || days === null || isNaN(days)) ? 1 : days;
var query = [];
if (list) query.push('list:' + list);
if (subject) query.push('subject:"' + subject + '"');
if (days) query.push('newer_than:' + days + 'd');
var searchString = query.join(' ');
const patterns = [
/(\+1|๐Ÿ‘)/i,
/i want (this|it) (feature|too)?/i,
/(this|it) (would be )?(great|useful|awesome)/i,
/please (add|implement|support)/i,
/waiting for (this|feature)/i,
/(any updates?|update)( on this)?\??/i,
/me too/i,
/following|interested/i,
/hope (this )?happens soon/i,
/hoping (this )?happens soon/i,
/any (news|updates) on (this|it)?/i,
/are we (going to )?have (anything|something) here/i,
/(do )?you have (any )?(rough )?eta/i,
/when can (i|we) use/i,
/please enable (this|it)/i,
/i'?m looking forward( to (it|this))?/i,
/looking forward( to (it|this))?/i,
];
function matchCount(text) {
text = text.trim().toLowerCase();
return patterns.reduce(function(count, regex) {
return count + (regex.test(text) ? 1 : 0);
}, 0);
}
var threads = GmailApp.search(searchString);
for (var i = 0; i < threads.length; i++) {
var messages = threads[i].getMessages();
for (var j = 0; j < messages.length; j++) {
var message = messages[j];
var body = message.getPlainBody();
if (matchCount(body) === 1) { // Only trash if exactly one pattern matched
message.moveToTrash();
Logger.log("Trashed email: " + message.getSubject());
}
}
}
}
// Example usage:
// subject, list, how many days old ... all optional
filterNoisyGithubCommentEmails('An IntelliJ-based plugin', 'cline.cline.github.com', 1);
// Reference: https://github.com/cline/cline/discussions/581#discussioncomment-12290734
@freakynit
Copy link
Author

freakynit commented Jul 28, 2025

Equivalent browser console script to dim or hide such comments:

function suppressNoisyGithubComments(dimOrHide = 'dim'/* or, hide */) {
  const patterns = [
    /(\+1|๐Ÿ‘)/i,
    /i want (this|it) (feature|too)?/i,
    /(this|it) (would be )?(great|useful|awesome)/i,
    /please (add|implement|support)/i,
    /waiting for (this|feature)/i,
    /(any updates?|update)( on this)?\??/i,
    /me too/i,
    /following|interested/i,
    /hope (this )?happens soon/i,
    /hoping (this )?happens soon/i,
    /any (news|updates) on (this|it)?/i,
    /are we (going to )?have (anything|something) here/i,
    /(do )?you have (any )?(rough )?eta/i,
    /when can (i|we) use/i,
    /please enable (this|it)/i,
    /i'?m looking forward( to (it|this))?/i,
    /looking forward( to (it|this))?/i,
  ];

  // Count number of pattern matches
  const matchCount = text => patterns.reduce(
    (count, regex) => count + (regex.test(text.trim().toLowerCase()) ? 1 : 0), 0
  );

  document.querySelectorAll('.js-comment-body').forEach(el => {
    const text = el.innerText;
    if (matchCount(text) === 1) {
      const styleProperties = dimOrHide === 'dim' ? ['opacity', 0.2, 'important'] : ['display', 'none', 'important'];
      el.closest('.js-timeline-item')?.style.setProperty(...styleProperties);
    }
  });
}

// 'hide' or 'dim'
suppressNoisyGithubComments('hide');

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment