Skip to content

Commit fe201b6

Browse files
authored
feat(plugins/people): add plugin_people_identicons_hide (lowlighter#967)
1 parent 54efc40 commit fe201b6

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

source/plugins/people/index.mjs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default async function({login, data, graphql, rest, q, queries, imports,
2121
}
2222

2323
//Load inputs
24-
let {limit, types, size, identicons, thanks, shuffle, "sponsors.custom":_sponsors} = imports.metadata.plugins.people.inputs({data, account, q}, {types:context.default})
24+
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})
2525
//Filter types
2626
types = [...new Set([...types].map(type => (context.alias[type] ?? type)).filter(type => context.types.includes(type)) ?? [])]
2727
if ((types.includes("sponsorshipsAsMaintainer")) && (_sponsors?.length)) {
@@ -69,6 +69,11 @@ export default async function({login, data, graphql, rest, q, queries, imports,
6969
console.debug(`metrics/compute/${login}/plugins > people > shuffling`)
7070
imports.shuffle(result[type])
7171
}
72+
//Filter out identicons if not wanted
73+
if (_identicons_hide) {
74+
console.debug(`metrics/compute/${login}/plugins > people > filtering out user without custom avatarUrl`)
75+
result[type] = result[type].filter(user => user.avatarUrl?.includes("&u="))
76+
}
7277
//Limit people
7378
if (limit > 0) {
7479
console.debug(`metrics/compute/${login}/plugins > people > keeping only ${limit} ${type}`)

source/plugins/people/metadata.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,17 @@ inputs:
3333
type: boolean
3434
default: no
3535

36+
plugin_people_identicons_hide:
37+
description: |
38+
Hide identicons display
39+
40+
This can be used to mask user who did not setup a personal profile picture.
41+
42+
When used with `plugin_people_identicons`, users who did not setup a personal profile picture
43+
will still be filtered out, but will have their picture replaced by an identicon instead.
44+
type: boolean
45+
default: no
46+
3647
plugin_people_size:
3748
description: Profile picture display size
3849
type: number

0 commit comments

Comments
 (0)