From 8a2ff0bad24d461b1302fd50b358bdb73f5ed4d8 Mon Sep 17 00:00:00 2001 From: Vikas Agarwal Date: Fri, 4 Aug 2017 15:26:42 +0530 Subject: [PATCH 1/4] Github issue#893, CoderBot message changes --- src/common/constants.js | 5 +++-- src/handlers/projectEvents.js | 17 ++++++++++------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/common/constants.js b/src/common/constants.js index 4933723..4e13b4f 100644 --- a/src/common/constants.js +++ b/src/common/constants.js @@ -150,10 +150,11 @@ module.exports = { created: { title: 'Your project has been created, and we\'re ready for your specification', content: data => `Hello, Coder here! Your project '${data.projectName}' has been created successfully. For your next step, please head over to the Specification section and answer all of the required questions. If you already have a document with your requirements, just verify it against our checklist and then upload it. Once you're done, hit the "Submit for Review" button on the Specification. Get stuck or need help? Email us at support@topcoder.com.`, + disabled: true, }, submittedForReview: { - title: 'Your project has been submitted for review', - content: data => `Hello, it's Coder again. Thanks for submitting your project ${data.projectName}! I've used my super computational powers to route it to one of our trusty humans. They'll get back to you in 1-2 business days.`, + title: 'Your project is being reviewed. Provide additional info if you have it.', + content: data => `Hello, Coder here! Thanks for submitting your project ${data.projectName}! I've used my super computational powers to route it to one of our trusty humans. They'll get back to you in 1-2 business days. Meanwhile, if have any additional project information or documents to upload, please head over to the Specification section. Get stuck or need help? Email us at support@topcoder.com.`, }, activated: { title: 'Work on your project has begun', diff --git a/src/handlers/projectEvents.js b/src/handlers/projectEvents.js index 81a7412..4f9405d 100644 --- a/src/handlers/projectEvents.js +++ b/src/handlers/projectEvents.js @@ -18,19 +18,22 @@ const util = require('./util'); * @return {Array} the array of notifications */ function projectDraftCreated(logger, project) { + const notifications = { + discourse: [], + }; const topic = constants.notifications.discourse.project.created; const topicData = { projectName: project.name, projectUrl: `https://connect.${config.get('AUTH_DOMAIN')}/projects/${project.id}/`, }; - // return notificaiton object with discourse data - const notifications = { - discourse: [{ + if (topic && !topic.disabled) { + // return notificaiton object with discourse data + notifications.discourse.push({ projectId: project.id, title: topic.title, content: topic.content(topicData), - }], - }; + }); + } return notifications; } @@ -88,8 +91,8 @@ function* projectUpdated(logger, data) { topic = constants.notifications.discourse.project.completed; } - // post to discourse if topic is set - if (topic) { + // post to discourse if topic is set and is not disabled + if (topic && !topic.disabled) { const topicData = { projectName: project.name, projectUrl: `https://connect.${config.get('AUTH_DOMAIN')}/projects/${project.id}/`, From 2171bb5c552f7bb176abb7804ac58da146d47ffb Mon Sep 17 00:00:00 2001 From: Vikas Agarwal Date: Fri, 4 Aug 2017 15:27:29 +0530 Subject: [PATCH 2/4] temp change to check deployment to dev --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index 8503cee..bd1d858 100644 --- a/circle.yml +++ b/circle.yml @@ -29,7 +29,7 @@ test: deployment: development: - branch: dev + branch: ["dev", "feature/logged-out-project-creation"] owner: topcoder-platform commands: - docker build -t $DEV_AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$AWS_REPOSITORY:$CIRCLE_SHA1 . From ea1d3b95d8a98a9703a3ffcbde79c81eb14e99fa Mon Sep 17 00:00:00 2001 From: Vikas Agarwal Date: Fri, 4 Aug 2017 15:52:04 +0530 Subject: [PATCH 3/4] =?UTF-8?q?Github=20issue#893,=20CoderBot=20message=20?= =?UTF-8?q?changes=20=E2=80=94=20fixed=20unit=20tests?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/app.test.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/test/app.test.js b/src/test/app.test.js index fec3579..e75f18d 100644 --- a/src/test/app.test.js +++ b/src/test/app.test.js @@ -237,14 +237,10 @@ describe('app', () => { }); describe('`project.draft-created` event', () => { - it('should create `Project.Created` notification', (done) => { + it('should not create `Project.Created` notification as it is disabled now', (done) => { sendTestEvent(sampleEvents.draftCreated, 'project.draft-created'); setTimeout(() => { - const expectedTitle = 'Your project has been created, and we\'re ready for your specification'; - const expectedBody = 'Hello, Coder here! Your project \'test\' has been created successfully. For your next step, please head over to the Specification section and answer all of the required questions. If you already have a document with your requirements, just verify it against our checklist and then upload it. Once you\'re done, hit the "Submit for Review" button on the Specification. Get stuck or need help? Email us at support@topcoder.com.'; - const params = spy.lastCall.args; - assert.equal(params[2], expectedTitle); - assert.equal(params[3], expectedBody); + sinon.assert.notCalled(spy); done(); }, testTimeout); }); @@ -262,8 +258,8 @@ describe('app', () => { sendTestEvent(sampleEvents.updatedInReview, 'project.updated'); setTimeout(() => { assertCount += 1; - const expectedTitle = 'Your project has been submitted for review'; - const expectedBody = 'Hello, it\'s Coder again. Thanks for submitting your project test! I\'ve used my super computational powers to route it to one of our trusty humans. They\'ll get back to you in 1-2 business days.'; + const expectedTitle = 'Your project is being reviewed. Provide additional info if you have it.'; + const expectedBody = 'Hello, Coder here! Thanks for submitting your project test! I\'ve used my super computational powers to route it to one of our trusty humans. They\'ll get back to you in 1-2 business days. Meanwhile, if have any additional project information or documents to upload, please head over to the Specification section. Get stuck or need help? Email us at support@topcoder.com.'; let params = spy.lastCall.args; assert.equal(params[2], expectedTitle); assert.equal(params[3], expectedBody); From f381e46ee60085d27e855bf12b1d41023c3bee54 Mon Sep 17 00:00:00 2001 From: Vikas Agarwal Date: Fri, 4 Aug 2017 19:11:21 +0530 Subject: [PATCH 4/4] Reverted temp change for deploy on dev --- circle.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/circle.yml b/circle.yml index bd1d858..8503cee 100644 --- a/circle.yml +++ b/circle.yml @@ -29,7 +29,7 @@ test: deployment: development: - branch: ["dev", "feature/logged-out-project-creation"] + branch: dev owner: topcoder-platform commands: - docker build -t $DEV_AWS_ACCOUNT_ID.dkr.ecr.$AWS_REGION.amazonaws.com/$AWS_REPOSITORY:$CIRCLE_SHA1 .