diff --git a/source/app/mocks/api/github/graphql/achievements.default.mjs b/source/app/mocks/api/github/graphql/achievements.default.mjs index 4f0f8bd5..da64b140 100644 --- a/source/app/mocks/api/github/graphql/achievements.default.mjs +++ b/source/app/mocks/api/github/graphql/achievements.default.mjs @@ -62,6 +62,9 @@ export default function({faker, query, login = faker.internet.userName()}) { bio:faker.lorem.sentence(), status:{message:faker.lorem.paragraph()}, sponsorshipsAsSponsor:{totalCount:faker.datatype.number(100)}, + discussionsStarted:{totalCount:faker.datatype.number(1000)}, + discussionsComments:{totalCount:faker.datatype.number(1000)}, + discussionAnswers:{totalCount:faker.datatype.number(1000)}, }, }) } diff --git a/source/plugins/achievements/list/users.mjs b/source/plugins/achievements/list/users.mjs index c526ffb2..d17dc513 100644 --- a/source/plugins/achievements/list/users.mjs +++ b/source/plugins/achievements/list/users.mjs @@ -262,6 +262,36 @@ export default async function({list, login, data, computed, imports, graphql, qu }) } + //Chatter + { + const value = user.discussionsStarted.totalCount + user.discussionsComments.totalCount + const unlock = null + + list.push({ + title:"Chatter", + text:`Participated in discussions ${value} time${imports.s(value)}`, + icon:'', + ...rank(value, [1, 200, 500, 1000, 2500]), + value, + unlock:new Date(unlock?.createdAt), + }) + } + + //Helper + { + const value = user.discussionAnswers.totalCount + const unlock = null + + list.push({ + title:"Helper", + text:`Answered and solved ${value} discussion${imports.s(value)}`, + icon:'', + ...rank(value, [1, 20, 50, 100, 250]), + value, + unlock:new Date(unlock?.createdAt), + }) + } + //Verified { const value = !/This user hasn't uploaded any GPG keys/i.test((await imports.axios.get(`https://github.com/${login}.gpg`)).data) diff --git a/source/plugins/achievements/queries/achievements.graphql b/source/plugins/achievements/queries/achievements.graphql index 1834eb95..c7bcb13b 100644 --- a/source/plugins/achievements/queries/achievements.graphql +++ b/source/plugins/achievements/queries/achievements.graphql @@ -94,5 +94,14 @@ query AchievementsDefault { sponsorshipsAsSponsor { totalCount } + discussionsStarted: repositoryDiscussions { + totalCount + } + discussionsComments: repositoryDiscussionComments { + totalCount + } + discussionAnswers: repositoryDiscussionComments(onlyAnswers: true) { + totalCount + } } }