Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 80abdf6

Browse files
authored
Merge pull request #55 from afrisalyp/issue-328
Create copilot payment flag.
2 parents 1768ee8 + 7ffee6d commit 80abdf6

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

models/Project.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ const schema = new Schema({
4141
updatedAt: {
4242
type: Date,
4343
default: Date.now
44-
}
44+
},
45+
createCopilotPayments: {type: String, required: false}
4546
});
4647

4748
module.exports = schema;

services/IssueService.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ async function handleIssueClose(event, issue) { // eslint-disable-line
466466

467467
const copilotAlreadySet = await topcoderApiHelper.roleAlreadySet(dbIssue.challengeId, 'Copilot');
468468

469-
if (!copilotAlreadySet) {
469+
if (!copilotAlreadySet && project.createCopilotPayments === 'true') {
470470
logger.debugWithContext(`Getting the topcoder member ID for copilot name : ${event.copilot.topcoderUsername}`, event, issue);
471471
// get copilot tc user id
472472
const copilotTopcoderUserId = await topcoderApiHelper.getTopcoderMemberId(event.copilot.topcoderUsername);
@@ -481,7 +481,7 @@ async function handleIssueClose(event, issue) { // eslint-disable-line
481481
};
482482
await topcoderApiHelper.addResourceToChallenge(dbIssue.challengeId, copilotResourceBody);
483483
} else {
484-
logger.debugWithContext('Copilot is already set, so skipping', event, issue);
484+
logger.debugWithContext('Copilot is already set or the project create copilot payments option is disabled, so skipping', event, issue);
485485
}
486486

487487
logger.debugWithContext(`Getting the topcoder member ID for member name: ${assigneeMember.topcoderUsername}`, event, issue);
@@ -905,7 +905,8 @@ process.schema = Joi.object().keys({
905905
repository: Joi.object().keys({
906906
id: Joi.alternatives().try(Joi.string(), Joi.number()).required(),
907907
name: Joi.string().required(),
908-
full_name: Joi.string().required()
908+
full_name: Joi.string().required(),
909+
repoUrl: Joi.string().optional()
909910
}).required(),
910911
comment: Joi.object().keys({
911912
id: Joi.number().required(),

0 commit comments

Comments
 (0)