feat(plugins/people): add plugin_people_identicons_hide (#967)

This commit is contained in:
Simon Lecoq
2022-03-24 04:01:47 +01:00
committed by GitHub
parent 54efc406fd
commit fe201b6730
2 changed files with 17 additions and 1 deletions

View File

@@ -21,7 +21,7 @@ export default async function({login, data, graphql, rest, q, queries, imports,
} }
//Load inputs //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 //Filter types
types = [...new Set([...types].map(type => (context.alias[type] ?? type)).filter(type => context.types.includes(type)) ?? [])] types = [...new Set([...types].map(type => (context.alias[type] ?? type)).filter(type => context.types.includes(type)) ?? [])]
if ((types.includes("sponsorshipsAsMaintainer")) && (_sponsors?.length)) { 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`) console.debug(`metrics/compute/${login}/plugins > people > shuffling`)
imports.shuffle(result[type]) 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 //Limit people
if (limit > 0) { if (limit > 0) {
console.debug(`metrics/compute/${login}/plugins > people > keeping only ${limit} ${type}`) console.debug(`metrics/compute/${login}/plugins > people > keeping only ${limit} ${type}`)

View File

@@ -33,6 +33,17 @@ inputs:
type: boolean type: boolean
default: no 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: plugin_people_size:
description: Profile picture display size description: Profile picture display size
type: number type: number