From 23f0ba8e0b8c96ce9fcce4f463255c0505ef5330 Mon Sep 17 00:00:00 2001 From: Simon Lecoq <22963968+lowlighter@users.noreply.github.com> Date: Wed, 3 Nov 2021 23:19:32 -0400 Subject: [PATCH] fix(plugins/code,habits,languages): support basic login as authoring (#650) --- source/plugins/code/index.mjs | 3 ++- source/plugins/habits/index.mjs | 2 +- source/plugins/languages/analyzers.mjs | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/source/plugins/code/index.mjs b/source/plugins/code/index.mjs index 8bc93800..903d5f83 100644 --- a/source/plugins/code/index.mjs +++ b/source/plugins/code/index.mjs @@ -32,7 +32,8 @@ export default async function({login, q, imports, data, rest, account}, {enabled .filter(event => visibility === "public" ? event.public : true) .flatMap(({payload}) => Promise.all(payload.commits.map(async commit => (await rest.request(commit.url)).data)))])] .flat() - .filter(({author}) => data.shared["commits.authoring"].filter(authoring => author?.email?.toLocaleLowerCase().includes(authoring)||author?.name?.toLocaleLowerCase().includes(authoring))) + .filter(({parents}) => parents.length <= 1) + .filter(({author}) => data.shared["commits.authoring"].filter(authoring => author?.login?.toLocaleLowerCase().includes(authoring)||author?.email?.toLocaleLowerCase().includes(authoring)||author?.name?.toLocaleLowerCase().includes(authoring)).length) ) } } diff --git a/source/plugins/habits/index.mjs b/source/plugins/habits/index.mjs index 658e386e..1257980f 100644 --- a/source/plugins/habits/index.mjs +++ b/source/plugins/habits/index.mjs @@ -45,7 +45,7 @@ export default async function({login, data, rest, imports, q, account}, {enabled ...await Promise.allSettled( commits .flatMap(({payload}) => payload.commits) - .filter(({author}) => data.shared["commits.authoring"].filter(authoring => author?.email?.toLocaleLowerCase().includes(authoring)||author?.name?.toLocaleLowerCase().includes(authoring)).length) + .filter(({author}) => data.shared["commits.authoring"].filter(authoring => author?.login?.toLocaleLowerCase().includes(authoring)||author?.email?.toLocaleLowerCase().includes(authoring)||author?.name?.toLocaleLowerCase().includes(authoring)).length) .map(async commit => (await rest.request(commit)).data.files), ), ] diff --git a/source/plugins/languages/analyzers.mjs b/source/plugins/languages/analyzers.mjs index 9a7e6fac..3daa5641 100644 --- a/source/plugins/languages/analyzers.mjs +++ b/source/plugins/languages/analyzers.mjs @@ -86,7 +86,7 @@ export async function recent({login, data, imports, rest, account}, {skipped = [ ...await Promise.allSettled( commits .flatMap(({payload}) => payload.commits) - .filter(({author}) => data.shared["commits.authoring"].filter(authoring => author?.email?.toLocaleLowerCase().includes(authoring)||author?.name?.toLocaleLowerCase().includes(authoring)).length) + .filter(({author}) => data.shared["commits.authoring"].filter(authoring => author?.login?.toLocaleLowerCase().includes(authoring)||author?.email?.toLocaleLowerCase().includes(authoring)||author?.name?.toLocaleLowerCase().includes(authoring)).length) .map(commit => commit.url) .map(async commit => (await rest.request(commit)).data), )