diff --git a/source/app/web/statics/app.placeholder.js b/source/app/web/statics/app.placeholder.js index 52249bd2..71dbf2d0 100644 --- a/source/app/web/statics/app.placeholder.js +++ b/source/app/web/statics/app.placeholder.js @@ -105,7 +105,7 @@ createdAt: `${faker.date.past(10)}`, avatarUrl: set.avatar, websiteUrl: options["pagespeed.url"] || "(attached website)", - isHireable: false, + isHireable: options["base.hireable"], twitterUsername: options["tweets.user"] || "(attached Twitter account)", repositories: {totalCount: faker.datatype.number(100), totalDiskUsage: faker.datatype.number(100000), nodes: []}, packages: {totalCount: faker.datatype.number(10)}, diff --git a/source/plugins/base/index.mjs b/source/plugins/base/index.mjs index caae64b1..e5d003fe 100644 --- a/source/plugins/base/index.mjs +++ b/source/plugins/base/index.mjs @@ -7,7 +7,7 @@ export default async function({login, graphql, rest, data, q, queries, imports}, conf) { //Load inputs console.debug(`metrics/compute/${login}/base > started`) - let {indepth, "repositories.forks": _forks, "repositories.affiliations": _affiliations, "repositories.batch": _batch} = imports.metadata.plugins.base.inputs({data, q, account: "bypass"}) + let {indepth, hireable, "repositories.forks": _forks, "repositories.affiliations": _affiliations, "repositories.batch": _batch} = imports.metadata.plugins.base.inputs({data, q, account: "bypass"}) const extras = conf.settings.extras?.features ?? conf.settings.extras?.default const repositories = conf.settings.repositories || 100 const forks = _forks ? "" : ", isFork: false" @@ -134,6 +134,11 @@ export default async function({login, graphql, rest, data, q, queries, imports}, console.debug(`metrics/compute/${login}/base > falling back to last year commits history`) } } + //Hireable status + if (hireable) { + console.debug(`metrics/compute/${login}/base > is hireable`) + data.user.isHireable = hireable + } } //Query repositories from GitHub API for (const type of ({user: ["repositories", "repositoriesContributedTo"], organization: ["repositories"]}[account] ?? [])) { @@ -213,6 +218,7 @@ const postprocess = { console.debug(`metrics/compute/${login}/base > applying postprocessing`) data.account = "user" Object.assign(data.user, { + isHireable: false, isVerified: false, repositories: {}, contributionsCollection: {}, diff --git a/source/plugins/base/metadata.yml b/source/plugins/base/metadata.yml index 740873cc..8b66d60f 100644 --- a/source/plugins/base/metadata.yml +++ b/source/plugins/base/metadata.yml @@ -50,6 +50,12 @@ inputs: type: boolean default: no + base_hireable: + description: | + Display `Available for hire!` in header section + type: boolean + default: no + repositories: description: | Repositories to fetch diff --git a/source/plugins/base/queries/user.graphql b/source/plugins/base/queries/user.graphql index 89284de5..fd42a9dc 100644 --- a/source/plugins/base/queries/user.graphql +++ b/source/plugins/base/queries/user.graphql @@ -7,7 +7,6 @@ query BaseUser { createdAt avatarUrl websiteUrl - isHireable twitterUsername } } diff --git a/source/plugins/core/index.mjs b/source/plugins/core/index.mjs index 78ddfcc7..5752a979 100644 --- a/source/plugins/core/index.mjs +++ b/source/plugins/core/index.mjs @@ -139,10 +139,6 @@ export default async function({login, q}, {conf, data, rest, graphql, plugins, q console.debug(`metrics/compute/${login} > applying dflag --cakeday`) computed.cakeday = true } - if (dflags.includes("--hireable")) { - console.debug(`metrics/compute/${login} > applying dflag --hireable`) - data.user.isHireable = true - } if (dflags.includes("--halloween")) { console.debug(`metrics/compute/${login} > applying dflag --halloween`) //Haloween color replacer diff --git a/source/plugins/core/metadata.yml b/source/plugins/core/metadata.yml index b16930cd..88be4a38 100644 --- a/source/plugins/core/metadata.yml +++ b/source/plugins/core/metadata.yml @@ -467,7 +467,6 @@ inputs: description: | Debug flags - `--cakeday`: simulate registration anniversary - - `--hireable`: simulate "Available for hire" account setting - `--halloween`: enable halloween colors - `--error`: force render error type: array @@ -475,7 +474,6 @@ inputs: default: "" values: - --cakeday - - --hireable - --halloween - --error testing: yes diff --git a/tests/mocks/api/github/graphql/base.user.mjs b/tests/mocks/api/github/graphql/base.user.mjs index 1804e336..f7ba0159 100644 --- a/tests/mocks/api/github/graphql/base.user.mjs +++ b/tests/mocks/api/github/graphql/base.user.mjs @@ -9,7 +9,6 @@ export default function({faker, query, login = faker.internet.userName()}) { createdAt: `${faker.date.past(10)}`, avatarUrl: faker.image.people(), websiteUrl: faker.internet.url(), - isHireable: faker.datatype.boolean(), twitterUsername: login, }, })