Skip to content

Commit

Permalink
docs: improve filtering (#5191)
Browse files Browse the repository at this point in the history
* fix: do not reload eleventy infinitely

* docs: improve filtering
  • Loading branch information
voxpelli authored Aug 6, 2024
1 parent 1528c42 commit 1ac5b55
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
2 changes: 0 additions & 2 deletions .eleventy.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@ module.exports = function (eleventyConfig) {

eleventyConfig.setLibrary('md', markdown);

eleventyConfig.setUseGitIgnore(false);

return {
passthroughFileCopy: true,
dir: {
Expand Down
24 changes: 18 additions & 6 deletions docs/_data/supporters.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const blocklist = new Set(require('./blocklist.json'));
* In addition to the blocklist, any account slug matching this regex will not
* be displayed on the website.
*/
const BLOCKED_STRINGS = /(?:[ck]a[sz]ino|seo|slots|gambl(?:e|ing)|crypto)/i;
const BLOCKED_STRINGS = /(?:[ck]a[sz]ino|seo|slot|gambl(?:e|ing)|crypto|follow|buy|cheap|instagram|hacks|tiktok|likes|youtube|subscriber|boost|deposit|mushroom|bingo|broker|promotion|bathroom|landscaping|lawn care|groundskeeping|remediation|esports|links|coupon|review|refer|promocode|rabattkod|jämför|betting|reddit|hire|fortune|equity|download|marketing|comment|rank|scrapcar|lawyer|celeb|concrete|firestick|playground)/i;

/**
* Add a few Categories exposed by Open Collective to help moderation
Expand All @@ -38,7 +38,8 @@ const BLOCKED_CATEGORIES = [
'credit',
'gambling',
'seo',
'writer'
'writer',
'review'
];

/**
Expand Down Expand Up @@ -160,10 +161,21 @@ const getAllOrders = async (slug = 'mochajs') => {
}
};

const isAllowed = ({slug, categories}) =>
!blocklist.has(slug) &&
!BLOCKED_STRINGS.test(slug) &&
!categories.some(category => BLOCKED_CATEGORIES.includes(category));
const isAllowed = ({name, slug, website, categories}) => {
const allowed = !blocklist.has(slug) &&
!BLOCKED_STRINGS.test(name) &&
!BLOCKED_STRINGS.test(slug) &&
!BLOCKED_STRINGS.test(website) &&
!categories.some(category => BLOCKED_CATEGORIES.includes(category));

if (!allowed) {
debug('filtering %o', {categories, name, slug, website});
} else {
// debug('keeping %o', {categories, name, slug, website}, BLOCKED_STRINGS.test(website));
}

return allowed;
};

const getSupporters = async () => {
const orders = await getAllOrders();
Expand Down

0 comments on commit 1ac5b55

Please sign in to comment.