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

Commit e2744ff

Browse files
author
vikasrohit
authored
Merge pull request #101 from topcoder-platform/dev
Pushing welcome message copy change to production
2 parents 2f039aa + c4e3538 commit e2744ff

File tree

10 files changed

+73
-23
lines changed

10 files changed

+73
-23
lines changed

.circleci/config.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ defaults: &defaults
88
LOG_LEVEL: debug
99
AUTH_DOMAIN: topcoder-dev.com
1010
AUTH_SECRET: secret
11+
API_URL_PROJECTS: http://localhost:3001/v4/projects
12+
API_URL_MEMBERS: http://localhost:3001/v3/members
13+
API_URL_USERS: http://localhost:3001/v3/users
14+
API_URL_AUTHORIZATIONS: http://localhost:3001/v3/authorizations
15+
API_URL_TOPICS: http://localhost:3001/v5/topics
1116

1217
jobs:
1318
test:
@@ -27,7 +32,7 @@ jobs:
2732
command: |
2833
echo 'deb http://www.rabbitmq.com/debian/ testing main' | sudo tee /etc/apt/sources.list.d/rabbitmq.list
2934
wget -O- https://www.rabbitmq.com/rabbitmq-release-signing-key.asc | sudo apt-key add -
30-
sudo apt-get update
35+
sudo apt-get update --fix-missing
3136
sudo apt-get install rabbitmq-server
3237
sudo service rabbitmq-server start
3338
sudo cp local/rabbitmq_delayed_message_exchange-0.0.1.ez /usr/lib/rabbitmq/lib/rabbitmq_server-*/plugins

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ To override default settings please add them to a file `./config/local.js`:
1919
- `RABBITMQ.DELAY_DURATION`: Amount of delay before reposting unclaimed project
2020
- `RABBITMQ.NOTIFICATIONS_EXCHANGE_NAME`: the notification RabbitMQ's topic exchange name
2121
- `LOGENTRIES_TOKEN`: the Logentries token generated from https://logentries.com/
22-
- `API_BASE_URL`: the base url to the API server to get project/user info
22+
- `API_URL_PROJECTS`: the projects service url
23+
- `API_URL_MEMBERS`: `API_BASE_URL` the members service url
24+
- `API_URL_USERS`: `API_BASE_URL` the users service url
25+
- `API_URL_AUTHORIZATIONS`: `API_BASE_URL` the authorizations service url
26+
- `API_URL_TOPICS`: `API_BASE_URL` the topics service url
2327
- `DISABLE_DELAY_EXCHANGE`: Disable exchage type delay and use 'direct' instead(Note: after changing this delete existing delay exchange )
2428
- `TC_SLACK_WEBHOOK_URL`: slack webhook url
2529
- `SLACK_ICON_URL`: slack webhook icon url

config/default.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,12 @@ module.exports = {
3131
// Token is generated from https://logentries.com/
3232
LOGENTRIES_TOKEN: '',
3333

34-
// The base url to the project/user API server
35-
API_BASE_URL: 'http://localhost:3001',
34+
// The different services used by this project
35+
API_URL_PROJECTS: 'http://localhost:3001/v4/projects',
36+
API_URL_MEMBERS: 'http://localhost:3001/v3/members',
37+
API_URL_USERS: 'http://localhost:3001/v3/users',
38+
API_URL_AUTHORIZATIONS: 'http://localhost:3001/v3/authorizations',
39+
API_URL_TOPICS: 'http://localhost:3001/v5/topics',
3640

3741
// Disable delay exchange and use direct instead ( delete existing delay exchnge after changing)
3842
DISABLE_DELAY_EXCHANGE: false,

config/development.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@
88
"DELAYED_NOTIFICATIONS_EXCHANGE_NAME": "dev.connect-notifications-reminders"
99
},
1010

11-
"API_BASE_URL": "https://api.topcoder-dev.com"
11+
"API_URL_PROJECTS": "http://api.topcoder-dev.com/v4/projects",
12+
"API_URL_MEMBERS": "http://api.topcoder-dev.com/v3/members",
13+
"API_URL_USERS": "http://api.topcoder-dev.com/v3/users",
14+
"API_URL_AUTHORIZATIONS": "http://api.topcoder-dev.com/v3/authorizations",
15+
"API_URL_TOPICS": "http://api.topcoder-dev.com/v5/topics"
1216
}

config/production.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,9 @@
1111
"SLACK_CHANNEL_COPILOTS": "#connect-copilots",
1212
"SLACK_CHANNEL_NPS": "#customer-experience",
1313

14-
"API_BASE_URL": "https://api.topcoder.com"
14+
"API_URL_PROJECTS": "http://api.topcoder.com/v4/projects",
15+
"API_URL_MEMBERS": "http://api.topcoder.com/v3/members",
16+
"API_URL_USERS": "http://api.topcoder.com/v3/users",
17+
"API_URL_AUTHORIZATIONS": "http://api.topcoder.com/v3/authorizations",
18+
"API_URL_TOPICS": "http://api.topcoder.com/v5/topics"
1519
}

config/test.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ module.exports = {
2222
DELAY_DURATION: 0,
2323
},
2424
TC_SLACK_WEBHOOK_URL: 'http://localhost:3001/slack',
25-
API_BASE_URL: 'http://localhost:3001',
25+
API_URL_PROJECTS: 'http://localhost:3001/v4/projects',
26+
API_URL_MEMBERS: 'http://localhost:3001/v3/members',
27+
API_URL_USERS: 'http://localhost:3001/v3/users',
28+
API_URL_AUTHORIZATIONS: 'http://localhost:3001/v3/authorizations',
29+
API_URL_TOPICS: 'http://localhost:3001/v5/topics',
2630
AUTH0_URL: process.env.DEV_AUTH0_URL || '',
2731
AUTH0_AUDIENCE: process.env.DEV_AUTH0_AUDIENCE || '',
2832
TOKEN_CACHE_TIME: process.env.DEV_TOKEN_CACHE_TIME || 86400000,

deploy.sh

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,26 @@ make_task_def(){
8686
{
8787
"name": "AUTH0_PROXY_SERVER_URL",
8888
"value": "%s"
89+
},
90+
{
91+
"name": "API_URL_PROJECTS",
92+
"value": "%s"
93+
},
94+
{
95+
"name": "API_URL_MEMBERS",
96+
"value": "%s"
97+
},
98+
{
99+
"name": "API_URL_USERS",
100+
"value": "%s"
101+
},
102+
{
103+
"name": "API_URL_AUTHORIZATIONS",
104+
"value": "%s"
105+
},
106+
{
107+
"name": "API_URL_TOPICS",
108+
"value": "%s"
89109
}
90110
],
91111
"logConfiguration": {
@@ -108,14 +128,19 @@ make_task_def(){
108128
AUTH0_CLIENT_ID=$(eval "echo \$${ENV}_AUTH0_CLIENT_ID")
109129
AUTH0_CLIENT_SECRET=$(eval "echo \$${ENV}_AUTH0_CLIENT_SECRET")
110130
AUTH0_PROXY_SERVER_URL=$(eval "echo \$${ENV}_AUTH0_PROXY_SERVER_URL")
131+
API_URL_PROJECTS=$(eval "echo \$${ENV}_API_URL_PROJECTS")
132+
API_URL_MEMBERS=$(eval "echo \$${ENV}_API_URL_MEMBERS")
133+
API_URL_USERS=$(eval "echo \$${ENV}_API_URL_USERS")
134+
API_URL_AUTHORIZATIONS=$(eval "echo \$${ENV}_API_URL_AUTHORIZATIONS")
135+
API_URL_TOPICS=$(eval "echo \$${ENV}_API_URL_TOPICS")
111136

112137
if [ "$ENV" = "PROD" ]; then
113138
NODE_ENV=production
114139
elif [ "$ENV" = "DEV" ]; then
115140
NODE_ENV=development
116141
fi
117142

118-
task_def=$(printf "$task_template" $ACCOUNT_ID $AWS_REGION $AWS_REPOSITORY $CIRCLE_SHA1 $NODE_ENV $LOG_LEVEL $CAPTURE_LOGS $LOGENTRIES_TOKEN $RABBITMQ_URL $TC_SLACK_WEBHOOK_URL "$AUTH0_URL" "$AUTH0_AUDIENCE" $AUTH0_CLIENT_ID "$AUTH0_CLIENT_SECRET" $TOKEN_CACHE_TIME "$AUTH0_PROXY_SERVER_URL" $AWS_ECS_CLUSTER $AWS_REGION $NODE_ENV)
143+
task_def=$(printf "$task_template" $ACCOUNT_ID $AWS_REGION $AWS_REPOSITORY $CIRCLE_SHA1 $NODE_ENV $LOG_LEVEL $CAPTURE_LOGS $LOGENTRIES_TOKEN $RABBITMQ_URL $TC_SLACK_WEBHOOK_URL "$AUTH0_URL" "$AUTH0_AUDIENCE" $AUTH0_CLIENT_ID "$AUTH0_CLIENT_SECRET" $TOKEN_CACHE_TIME "$AUTH0_PROXY_SERVER_URL" "$API_URL_PROJECTS" "$API_URL_MEMBERS" "$API_URL_USERS" "$API_URL_AUTHORIZATIONS" "$API_URL_TOPICS" $AWS_ECS_CLUSTER $AWS_REGION $NODE_ENV)
119144
}
120145

121146
push_ecr_image(){

src/common/constants.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@ module.exports = {
165165
discourse: {
166166
project: {
167167
created: {
168-
title: 'Your project has been created, and we\'re ready for your specification',
169-
content: data => `Hello, Coder here! Your project '${data.projectName}' has been drafted. If you have your requirements documented, just verify it against our checklist and then upload it on the <a href="${data.projectUrl}scope/" rel="nofollow">Scope</a> section. Once you've finalized your scope, select the "Submit for Review" button. Topcoder will then review your drafted project and will assign a manager to get your delivery in-progress! 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>.`,
168+
title: 'Share requirements and submit your draft project for review.',
169+
content: data => `Your project '${data.projectName}' has been drafted. If you have requirements documented, share them for review under the Files or Links section. Once you’re ready, click the "Submit for Review" button. Topcoder will then review your drafted project and will get your project started! 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>.`,
170170
},
171171
submittedForReview: {
172172
title: 'Your project has been submitted for review',

src/handlers/util.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const createProjectDiscourseNotification = Promise.coroutine(
6060
return Promise.reject(new Error('Error retrieving system token'));
6161
}
6262
const options = {
63-
url: `${config.get('API_BASE_URL')}/v5/topics/create`,
63+
url: `${config.get('API_URL_TOPICS')}/create`,
6464
method: 'POST',
6565
headers: {
6666
Authorization: `Bearer ${token}`,
@@ -138,7 +138,7 @@ function* getProjectById(id) {
138138
return Promise.reject(new Error('Error retrieving system token'));
139139
}
140140
return yield requestPromise({
141-
url: `${config.get('API_BASE_URL')}/v4/projects/${id}`,
141+
url: `${config.get('API_URL_PROJECTS')}/${id}`,
142142
headers: {
143143
Authorization: `Bearer ${token}`,
144144
},
@@ -179,7 +179,7 @@ function* getUserById(id) { // eslint-disable-line require-yield
179179
}
180180
return reject(new Error('user not found'));
181181
};
182-
return requestPromise({ url: `${config.get('API_BASE_URL')}/v3/members/_search/?query=userId:${id}` }, cb);
182+
return requestPromise({ url: `${config.get('API_URL_MEMBERS')}/_search/?query=userId:${id}` }, cb);
183183
}
184184

185185

src/test/app.test.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -216,33 +216,33 @@ describe('app', () => {
216216
// Stub the calls to API server
217217
stub = sinon.stub(request, 'get');
218218
const stubArgs = {
219-
url: `${config.API_BASE_URL}/v4/projects/1`,
219+
url: `${config.API_URL_PROJECTS}/1`,
220220
};
221221
stub.withArgs(sinon.match.has('url', stubArgs.url))
222222
.yields(null, { statusCode: 200 }, sampleProjects.project1);
223223

224-
stubArgs.url = `${config.API_BASE_URL}/v4/projects/1000`;
224+
stubArgs.url = `${config.API_URL_PROJECTS}/1000`;
225225
stub.withArgs(sinon.match.has('url', stubArgs.url))
226226
.yields(null, { statusCode: 404 });
227227

228-
stubArgs.url = `${config.API_BASE_URL}/v3/members/_search/?query=userId:1`;
228+
stubArgs.url = `${config.API_URL_MEMBERS}/_search/?query=userId:1`;
229229
stub.withArgs(sinon.match.has('url', stubArgs.url))
230230
.yields(null, { statusCode: 200 }, sampleUsers.user1);
231231

232-
stubArgs.url = `${config.API_BASE_URL}/v3/users/1000`;
232+
stubArgs.url = `${config.API_URL_USERS}/1000`;
233233
stub.withArgs(sinon.match.has('url', stubArgs.url))
234234
.yields(null, { statusCode: 404 });
235235

236-
stubArgs.url = `${config.API_BASE_URL}/v3/members/_search/?query=userId:40051331`;
236+
stubArgs.url = `${config.API_URL_MEMBERS}/_search/?query=userId:40051331`;
237237
stub.withArgs(sinon.match.has('url', stubArgs.url))
238238
.yields(null, { statusCode: 200 }, sampleUsers.user1);
239239

240-
stubArgs.url = `${config.API_BASE_URL}/v3/members/_search/?query=userId:50051333`;
240+
stubArgs.url = `${config.API_URL_MEMBERS}/_search/?query=userId:50051333`;
241241
stub.withArgs(sinon.match.has('url', stubArgs.url))
242242
.yields(null, { statusCode: 200 }, sampleUsers.user1);
243243

244244
postStub = sinon.stub(request, 'post');
245-
postStub.withArgs(sinon.match.has('url', `${config.API_BASE_URL}/v3/authorizations/`))
245+
postStub.withArgs(sinon.match.has('url', `${config.API_URL_AUTHORIZATIONS}/`))
246246
.yields(null, { statusCode: 200 }, sampleAuth);
247247

248248
postStub.withArgs(sinon.match.has('url', config.TC_SLACK_WEBHOOK_URL))
@@ -303,8 +303,8 @@ describe('app', () => {
303303
it('should create `Project.Created` notification', (done) => {
304304
sendTestEvent(sampleEvents.draftCreated, 'project.draft-created');
305305
setTimeout(() => {
306-
const expectedTitle = 'Your project has been created, and we\'re ready for your specification';
307-
const expectedBody = 'Hello, Coder here! Your project \'test\' has been drafted. If you have your requirements documented, just verify it against our checklist and then upload it on the <a href="https://connect.topcoder-dev.com/projects/1/scope/" rel="nofollow">Scope</a> section. Once you\'ve finalized your scope, select the "Submit for Review" button. Topcoder will then review your drafted project and will assign a manager to get your delivery in-progress! 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>.';
306+
const expectedTitle = 'Share requirements and submit your draft project for review.';
307+
const expectedBody = 'Your project \'test\' has been drafted. If you have requirements documented, share them for review under the Files or Links section. Once you’re ready, click the "Submit for Review" button. Topcoder will then review your drafted project and will get your project started! 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>.';
308308
const params = spy.lastCall.args;
309309
assert.equal(params[2], expectedTitle);
310310
assert.equal(params[3], expectedBody);
@@ -319,7 +319,7 @@ describe('app', () => {
319319
const callbackCount = 1;
320320
request.get.restore();
321321
stub = sinon.stub(request, 'get');
322-
stub.withArgs(sinon.match.has('url', `${config.API_BASE_URL}/v3/members/_search/?query=userId:8547900`))
322+
stub.withArgs(sinon.match.has('url', `${config.API_URL_MEMBERS}/_search/?query=userId:8547900`))
323323
.yields(null, { statusCode: 200 }, sampleUsers.user1);
324324

325325
sendTestEvent(sampleEvents.updatedInReview, 'project.updated');

0 commit comments

Comments
 (0)