|
13 | 13 | * @param {string} params.browseBeginnerUrl - URL to browse Beginner issues |
14 | 14 | * @returns {string} Formatted markdown message explaining the restriction |
15 | 15 | */ |
| 16 | +const { |
| 17 | + ISSUE_TYPES, |
| 18 | + ELIGIBILITY_REQUIREMENTS, |
| 19 | +} = require('../eligibility/requirements'); |
| 20 | + |
16 | 21 | const INTERMEDIATE_GUARD_MARKER = '<!-- Intermediate Issue Guard -->'; |
17 | 22 |
|
18 | 23 | const intermediateRejection = ({ |
19 | 24 | username, |
20 | | - completedGfiCount, |
21 | | - hasBeginner, |
22 | | - browseGfiUrl, |
| 25 | + completedBeginnerCount, |
23 | 26 | browseBeginnerUrl, |
24 | 27 | }) => { |
25 | | - const gfiPlural = completedGfiCount === 1 ? '' : 's'; |
26 | | - const reasons = []; |
| 28 | + const req = |
| 29 | + ELIGIBILITY_REQUIREMENTS[ISSUE_TYPES.INTERMEDIATE]; |
27 | 30 |
|
28 | | - if (completedGfiCount === 0) { |
29 | | - reasons.push('• You have not completed a **Good First Issue** yet'); |
30 | | - } |
| 31 | + const beginnerReq = |
| 32 | + req.prerequisites.find(p => p.type === 'beginner'); |
31 | 33 |
|
32 | | - if (!hasBeginner) { |
33 | | - reasons.push('• You have not completed a **Beginner issue** yet'); |
34 | | - } |
| 34 | + const requiredCount = beginnerReq.requiredCount; |
| 35 | + const met = completedBeginnerCount >= requiredCount; |
35 | 36 |
|
36 | 37 | return `${INTERMEDIATE_GUARD_MARKER} |
37 | 38 | Hi @${username}, thank you for your interest in this issue. |
38 | 39 |
|
39 | | -This issue is labeled **Intermediate**, which means it requires some prior experience with the project. |
| 40 | +This issue is labeled **Intermediate**, which requires prior experience working on **Beginner issues**. |
40 | 41 |
|
41 | | -**Why you can’t be assigned right now:** |
42 | | -${reasons.join('\n')} |
| 42 | +**Requirements:** |
| 43 | +- Completion of **${requiredCount} Beginner issue${requiredCount === 1 ? '' : 's'}** |
43 | 44 |
|
44 | | -**Your progress so far:** |
45 | | -- Completed **${completedGfiCount}** Good First Issue${gfiPlural} |
46 | | -- Beginner issue completed: **${hasBeginner ? 'Yes' : 'No'}** |
| 45 | +**Your progress:** |
| 46 | +- Beginner issues completed: **${completedBeginnerCount} / ${requiredCount}** ${met ? '✅' : '❌'} |
47 | 47 |
|
48 | | -**Suggested next steps:** |
49 | | -- [Browse unassigned Good First Issues](${browseGfiUrl}) |
| 48 | +**Suggested next steps:** |
50 | 49 | - [Browse unassigned Beginner issues](${browseBeginnerUrl}) |
51 | 50 |
|
52 | | -Once you meet the requirements, you’re welcome to come back and request this issue again.`; |
| 51 | +Once the requirement is met, you’re welcome to come back and request this issue again.`; |
53 | 52 | }; |
54 | 53 |
|
55 | 54 | module.exports = { |
|
0 commit comments