@@ -5,32 +5,6 @@ import {
5
5
import util from '../../util'
6
6
import config from 'config'
7
7
import querystring from 'querystring'
8
- import topicService from '../../services/topicService'
9
-
10
- const _addProjectStatus = ( req , logger , project ) => {
11
- const topics = [
12
- {
13
- title : 'Hello, Coder here! Your project has been created successfully' ,
14
- body : 'It took almost 245ms for me to create it, but all is good now.\
15
- That\'s a lot of hard work for a robot, you know!'
16
- } , {
17
- title : 'Hey there, I\'m ready with the next steps for your project!' ,
18
- body : `<p>I went over the project and I see we still need to collect more\
19
- details before I can use my super computational powers and create your quote.</p>\
20
- <p>Head over to the <a href="/projects/${ project . id } /specification/">Specification</a>\
21
- section and answer all of the required questions. If you already have a document\
22
- with specification, verify it against our checklist and upload it.</p>`
23
- }
24
- ]
25
- // NOTE: running these in sequence cos we want topic[0] to be created first
26
- // firing these events in parallel doesn't ensure that topic[0] is created first
27
- return topicService . createTopic ( req , project . id , topics [ 0 ] . title , topics [ 0 ] . body )
28
- . then ( ( ) => topicService . createTopic ( req , project . id , topics [ 1 ] . title , topics [ 1 ] . body ) )
29
- . then ( ( ) => {
30
- logger . debug ( 'post-project creation messages posted' )
31
- return true
32
- } )
33
- }
34
8
35
9
/**
36
10
* Creates a lead in salesforce for the connect project.
@@ -73,29 +47,31 @@ const _addSalesforceLead = (token, logger, project) => {
73
47
* @param {[type] } channel channel to ack, nack
74
48
*/
75
49
const projectCreatedHandler = ( logger , msg , channel ) => {
76
- let project = JSON . parse ( msg . content )
77
- return util . getSystemUserToken ( logger )
78
- . then ( token => {
79
- const req = {
80
- id : 1 ,
81
- log : logger ,
82
- headers : {
83
- authorization : `Bearer ${ token } `
84
- }
85
- }
86
- return Promise . all ( [
87
- _addProjectStatus ( req , logger , project ) ,
88
- _addSalesforceLead ( token , logger , project ) . then ( ( resp ) => logger . debug ( 'web to lead response:' , resp . status ) )
89
- ] ) ;
90
- } )
91
- . then ( ( ) => {
92
- channel . ack ( msg )
93
- } )
94
- . catch ( err => {
95
- // don't requeue for now
96
- logger . error ( 'Error processing' , msg , err )
97
- channel . nack ( msg , false , false )
98
- } )
50
+ // disabling salesforce integration for now,
51
+ // see https://github.com/topcoder-platform/tc-project-service/issues/38
52
+ return channel . ack ( msg )
53
+ // let project = JSON.parse(msg.content)
54
+ // return util.getSystemUserToken(logger)
55
+ // .then(token => {
56
+ // const req = {
57
+ // id: 1,
58
+ // log: logger,
59
+ // headers: {
60
+ // authorization: `Bearer ${token}`
61
+ // }
62
+ // }
63
+ // return Promise.all([
64
+ // _addSalesforceLead(token, logger, project).then((resp)=> logger.debug('web to lead response:', resp.status))
65
+ // ]);
66
+ // })
67
+ // .then(() => {
68
+ // channel.ack(msg)
69
+ // })
70
+ // .catch(err => {
71
+ // // don't requeue for now
72
+ // logger.error('Error processing', msg, err)
73
+ // channel.nack(msg, false, false)
74
+ // })
99
75
}
100
76
101
77
module . exports = {
0 commit comments