From fe201b6730e3d53d006565fd2ce232e32d9db2f4 Mon Sep 17 00:00:00 2001 From: Simon Lecoq <22963968+lowlighter@users.noreply.github.com> Date: Thu, 24 Mar 2022 04:01:47 +0100 Subject: [PATCH] feat(plugins/people): add `plugin_people_identicons_hide` (#967) --- source/plugins/people/index.mjs | 7 ++++++- source/plugins/people/metadata.yml | 11 +++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/source/plugins/people/index.mjs b/source/plugins/people/index.mjs index 5b4110f5..1446dfa0 100644 --- a/source/plugins/people/index.mjs +++ b/source/plugins/people/index.mjs @@ -21,7 +21,7 @@ export default async function({login, data, graphql, rest, q, queries, imports, } //Load inputs - let {limit, types, size, identicons, thanks, shuffle, "sponsors.custom":_sponsors} = imports.metadata.plugins.people.inputs({data, account, q}, {types:context.default}) + let {limit, types, size, identicons, "identicons.hide":_identicons_hide, thanks, shuffle, "sponsors.custom":_sponsors} = imports.metadata.plugins.people.inputs({data, account, q}, {types:context.default}) //Filter types types = [...new Set([...types].map(type => (context.alias[type] ?? type)).filter(type => context.types.includes(type)) ?? [])] if ((types.includes("sponsorshipsAsMaintainer")) && (_sponsors?.length)) { @@ -69,6 +69,11 @@ export default async function({login, data, graphql, rest, q, queries, imports, console.debug(`metrics/compute/${login}/plugins > people > shuffling`) imports.shuffle(result[type]) } + //Filter out identicons if not wanted + if (_identicons_hide) { + console.debug(`metrics/compute/${login}/plugins > people > filtering out user without custom avatarUrl`) + result[type] = result[type].filter(user => user.avatarUrl?.includes("&u=")) + } //Limit people if (limit > 0) { console.debug(`metrics/compute/${login}/plugins > people > keeping only ${limit} ${type}`) diff --git a/source/plugins/people/metadata.yml b/source/plugins/people/metadata.yml index 9e9e787f..bac8782a 100644 --- a/source/plugins/people/metadata.yml +++ b/source/plugins/people/metadata.yml @@ -33,6 +33,17 @@ inputs: type: boolean default: no + plugin_people_identicons_hide: + description: | + Hide identicons display + + This can be used to mask user who did not setup a personal profile picture. + + When used with `plugin_people_identicons`, users who did not setup a personal profile picture + will still be filtered out, but will have their picture replaced by an identicon instead. + type: boolean + default: no + plugin_people_size: description: Profile picture display size type: number