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

Commit b1ceb4d

Browse files
authored
Merge pull request #72 from topcoder-platform/dev
Production release : Logged out project creation flow
2 parents 3c1f9f7 + c1f2bf8 commit b1ceb4d

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

src/common/constants.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,10 +150,11 @@ module.exports = {
150150
created: {
151151
title: 'Your project has been created, and we\'re ready for your specification',
152152
content: data => `Hello, Coder here! Your project '${data.projectName}' has been created successfully. For your next step, please head over to the <a href="${data.projectUrl}specification/" rel="nofollow">Specification</a> 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 <a href="mailto:support@topcoder.com?subject=Question%20Regarding%20My%20New%20Topcoder%20Connect%20Project" rel="nofollow">support@topcoder.com</a>.`,
153+
disabled: true,
153154
},
154155
submittedForReview: {
155-
title: 'Your project has been submitted for review',
156-
content: data => `Hello, it's Coder again. Thanks for submitting your project <a href="${data.projectUrl}" rel="nofollow">${data.projectName}</a>! 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.`,
156+
title: 'Your project is being reviewed. Provide additional info if you have it.',
157+
content: data => `Hello, Coder here! Thanks for submitting your project <a href="${data.projectUrl}" rel="nofollow">${data.projectName}</a>! 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 <a href="${data.projectUrl}specification/" rel="nofollow">Specification</a> section. Get stuck or need help? Email us at <a href="mailto:support@topcoder.com?subject=Question%20Regarding%20My%20New%20Topcoder%20Connect%20Project" rel="nofollow">support@topcoder.com</a>.`,
157158
},
158159
activated: {
159160
title: 'Work on your project has begun',

src/handlers/projectEvents.js

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,22 @@ const util = require('./util');
1818
* @return {Array} the array of notifications
1919
*/
2020
function projectDraftCreated(logger, project) {
21+
const notifications = {
22+
discourse: [],
23+
};
2124
const topic = constants.notifications.discourse.project.created;
2225
const topicData = {
2326
projectName: project.name,
2427
projectUrl: `https://connect.${config.get('AUTH_DOMAIN')}/projects/${project.id}/`,
2528
};
26-
// return notificaiton object with discourse data
27-
const notifications = {
28-
discourse: [{
29+
if (topic && !topic.disabled) {
30+
// return notificaiton object with discourse data
31+
notifications.discourse.push({
2932
projectId: project.id,
3033
title: topic.title,
3134
content: topic.content(topicData),
32-
}],
33-
};
35+
});
36+
}
3437
return notifications;
3538
}
3639

@@ -88,8 +91,8 @@ function* projectUpdated(logger, data) {
8891
topic = constants.notifications.discourse.project.completed;
8992
}
9093

91-
// post to discourse if topic is set
92-
if (topic) {
94+
// post to discourse if topic is set and is not disabled
95+
if (topic && !topic.disabled) {
9396
const topicData = {
9497
projectName: project.name,
9598
projectUrl: `https://connect.${config.get('AUTH_DOMAIN')}/projects/${project.id}/`,

src/test/app.test.js

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -237,14 +237,10 @@ describe('app', () => {
237237
});
238238

239239
describe('`project.draft-created` event', () => {
240-
it('should create `Project.Created` notification', (done) => {
240+
it('should not create `Project.Created` notification as it is disabled now', (done) => {
241241
sendTestEvent(sampleEvents.draftCreated, 'project.draft-created');
242242
setTimeout(() => {
243-
const expectedTitle = 'Your project has been created, and we\'re ready for your specification';
244-
const expectedBody = 'Hello, Coder here! Your project \'test\' has been created successfully. For your next step, please head over to the <a href="https://connect.topcoder-dev.com/projects/1/specification/" rel="nofollow">Specification</a> 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 <a href="mailto:support@topcoder.com?subject=Question%20Regarding%20My%20New%20Topcoder%20Connect%20Project" rel="nofollow">support@topcoder.com</a>.';
245-
const params = spy.lastCall.args;
246-
assert.equal(params[2], expectedTitle);
247-
assert.equal(params[3], expectedBody);
243+
sinon.assert.notCalled(spy);
248244
done();
249245
}, testTimeout);
250246
});
@@ -262,8 +258,8 @@ describe('app', () => {
262258
sendTestEvent(sampleEvents.updatedInReview, 'project.updated');
263259
setTimeout(() => {
264260
assertCount += 1;
265-
const expectedTitle = 'Your project has been submitted for review';
266-
const expectedBody = 'Hello, it\'s Coder again. Thanks for submitting your project <a href="https://connect.topcoder-dev.com/projects/1/" rel="nofollow">test</a>! 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.';
261+
const expectedTitle = 'Your project is being reviewed. Provide additional info if you have it.';
262+
const expectedBody = 'Hello, Coder here! Thanks for submitting your project <a href="https://connect.topcoder-dev.com/projects/1/" rel="nofollow">test</a>! 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 <a href="https://connect.topcoder-dev.com/projects/1/specification/" rel="nofollow">Specification</a> section. Get stuck or need help? Email us at <a href="mailto:support@topcoder.com?subject=Question%20Regarding%20My%20New%20Topcoder%20Connect%20Project" rel="nofollow">support@topcoder.com</a>.';
267263
let params = spy.lastCall.args;
268264
assert.equal(params[2], expectedTitle);
269265
assert.equal(params[3], expectedBody);

0 commit comments

Comments
 (0)