Skip to content

Commit b3b8b34

Browse files
authored
Merge pull request #135 from exploreriii/shared-libraries-guards
fix: attempt to fix spam messaging routing
2 parents 3de65f1 + 4faf64e commit b3b8b34

2 files changed

Lines changed: 28 additions & 4 deletions

File tree

.github/scripts/lib/comments/rejection-router.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ const { beginnerRejection } = require('./difficulty-02-beginner');
22
const { intermediateRejection } = require('./difficulty-03-intermediate');
33
const { advancedRejection } = require('./difficulty-04-advanced');
44
const { capacityLimitReached } = require('./max-assignments-reached');
5-
const { spamNonGfiAssignment } = require('./spam-restrictions');
5+
const {
6+
spamNonGfiAssignment,
7+
spamAssignmentLimitExceeded,
8+
} = require('./spam-restrictions');
69

710
const REJECTION_REASONS =
811
require('../eligibility/rejection-reasons');
@@ -28,14 +31,26 @@ const rejectionRouter = ({ reason, context = {}, username, urls = {} }) => {
2831
browseIntermediateUrl: urls.intermediate,
2932
});
3033

31-
// ───── Shared rules
34+
// ─────────────────────────────────────────
35+
// Capacity limits (branch on spam status)
36+
// ─────────────────────────────────────────
3237
case REJECTION_REASONS.CAPACITY:
38+
if (context.isSpamListed) {
39+
return spamAssignmentLimitExceeded(
40+
username,
41+
context.openAssignedCount
42+
);
43+
}
44+
3345
return capacityLimitReached({
3446
username,
3547
openAssignedCount: context.openAssignedCount,
3648
maxAllowed: context.maxAllowed,
3749
});
3850

51+
// ─────────────────────────────────────────
52+
// Spam attempting non-GFI assignment
53+
// ─────────────────────────────────────────
3954
case REJECTION_REASONS.SPAM:
4055
return spamNonGfiAssignment(username);
4156

.github/scripts/lib/eligibility/has-eligibility-01-gfi.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ const hasGfiEligibility = async ({
1616
return { eligible: true };
1717
}
1818

19-
const isSpamListed = await isOnSpamList({ github, owner, repo, username });
19+
const isSpamListed = await isOnSpamList({
20+
github,
21+
owner,
22+
repo,
23+
username,
24+
});
2025

2126
const maxAllowed = isSpamListed
2227
? MAX_OPEN_ISSUES_SPAM_LIST
@@ -33,7 +38,11 @@ const hasGfiEligibility = async ({
3338
return {
3439
eligible: false,
3540
reason: REJECTION_REASONS.CAPACITY,
36-
context: { openAssignedCount, maxAllowed },
41+
context: {
42+
openAssignedCount,
43+
maxAllowed,
44+
isSpamListed,
45+
},
3746
};
3847
}
3948

0 commit comments

Comments
 (0)