Skip to content

Commit aa16b30

Browse files
committed
Merge branch 'dev' into feature/connectMobile
# Conflicts: # src/components/Feed/FeedMobile.jsx # src/projects/detail/containers/FeedContainer.js
2 parents aaca6d0 + 5c97a62 commit aa16b30

File tree

17 files changed

+118
-58
lines changed

17 files changed

+118
-58
lines changed

.circleci/config.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@ jobs:
2929
- attach_workspace:
3030
at: ./workspace
3131
- run: ./deploy.sh DEV no-cache
32+
# deploy to test02
33+
deployTest02:
34+
docker:
35+
- image: cibuilds/aws
36+
steps:
37+
- checkout
38+
- attach_workspace:
39+
at: ./workspace
40+
- run: ./deploy.sh TEST02 no-cache
3241

3342
deployProd:
3443
docker:
@@ -39,6 +48,15 @@ jobs:
3948
at: ./workspace
4049
- run: ./deploy.sh PROD
4150

51+
deployDiscourseFree:
52+
docker:
53+
- image: cibuilds/aws
54+
steps:
55+
- checkout
56+
- attach_workspace:
57+
at: ./workspace
58+
- run: ./deploy.sh DISCOURSE
59+
4260
workflows:
4361
version: 2
4462
build:
@@ -50,10 +68,21 @@ workflows:
5068
filters:
5169
branches:
5270
only: dev
71+
- deployTest02:
72+
requires:
73+
- test
74+
filters:
75+
branches:
76+
only: "feature/discourse-migration"
5377
- deployProd:
5478
requires:
5579
- test
5680
filters:
5781
branches:
5882
only: master
59-
83+
- deployDiscourseFree:
84+
requires:
85+
- test
86+
filters:
87+
branches:
88+
only: master-discourse-free

config/constants/dev.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ module.exports = {
1212
AUTH0_CLIENT_ID : process.env.AUTH0_CLIENT_ID_DEV,
1313
domain : 'topcoder-dev.com',
1414
DOMAIN : 'topcoder-dev.com',
15-
CONNECT_MESSAGE_API_URL: process.env.CONNECT_MESSAGE_API_URL,
1615
ENV : 'DEV',
1716

1817
PROJECTS_API_URL : 'https://api.topcoder-dev.com',
@@ -44,5 +43,7 @@ module.exports = {
4443
IBM_COGNITIVE_PROGRAM_ID : 3449,
4544
HEAP_ANALYTICS_APP_ID : '4153837120',
4645

47-
TC_NOTIFICATION_URL: 'https://api.topcoder-dev.com/v5/notifications'
46+
TC_NOTIFICATION_URL: 'https://api.topcoder-dev.com/v5/notifications',
47+
CONNECT_MESSAGE_API_URL: 'https://api.topcoder-dev.com/v5',
48+
TC_SYSTEM_USERID: process.env.DEV_TC_SYSTEM_USERID
4849
}

config/constants/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
module.exports = (() => {
22
const branch = process.env.CIRCLE_BRANCH || 'dev'
33

4+
if(branch === 'master-discourse-free') {
5+
return require('./master')
6+
}
7+
48
// for security reason don't let to require any arbitrary file defined in process.env
59
if (['master', 'qa'].indexOf(branch) < 0) {
610
return require('./dev')

config/constants/master.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,7 @@ module.exports = {
4343
IBM_COGNITIVE_PROGRAM_ID : 3449,
4444
HEAP_ANALYTICS_APP_ID : '638908330',
4545

46-
TC_NOTIFICATION_URL: 'https://api.topcoder.com/v5/notifications'
46+
TC_NOTIFICATION_URL: 'https://api.topcoder.com/v5/notifications',
47+
CONNECT_MESSAGE_API_URL: 'https://api.topcoder.com/v5',
48+
TC_SYSTEM_USERID: process.env.PROD_TC_SYSTEM_USERID
4749
}

config/constants/qa.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,7 @@ module.exports = {
4242
IBM_COGNITIVE_PROGRAM_ID : 3449,
4343
HEAP_ANALYTICS_APP_ID : '4153837120',
4444

45-
TC_NOTIFICATION_URL: 'https://api.topcoder-dev.com/v5/notifications'
45+
TC_NOTIFICATION_URL: 'https://api.topcoder-dev.com/v5/notifications',
46+
CONNECT_MESSAGE_API_URL: 'https://api.topcoder-qa.com/v5',
47+
TC_SYSTEM_USERID: process.env.QA_TC_SYSTEM_USERID
4648
}

src/api/messages.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { axiosInstance as axios } from './requestInterceptor'
33
import { CONNECT_MESSAGE_API_URL } from '../config/constants'
44

55
const timeout = 1.5 * 60 * 1000
6+
const apiBaseUrl = CONNECT_MESSAGE_API_URL
67

78
export function getTopics(criteria) {
89
const params = {}
@@ -14,7 +15,7 @@ export function getTopics(criteria) {
1415
params.filter = filterStr.join('&')
1516
}
1617

17-
return axios.get(`${CONNECT_MESSAGE_API_URL}/v4/topics/`, { params })
18+
return axios.get(`${apiBaseUrl}/topics/list`, { params })
1819
.then( resp => {
1920
return {
2021
totalCount: _.get(resp.data, 'result.metadata.totalCount', 0),
@@ -24,7 +25,7 @@ export function getTopics(criteria) {
2425
}
2526

2627
export function getTopic(topicId) {
27-
return axios.get(`${CONNECT_MESSAGE_API_URL}/v4/topics/${topicId}`)
28+
return axios.get(`${apiBaseUrl}/topics/${topicId}/read`)
2829
.then( resp => {
2930
return {
3031
totalCount: _.get(resp.data, 'result.metadata.totalCount', 0),
@@ -36,7 +37,7 @@ export function getTopic(topicId) {
3637

3738
export function getTopicPosts(topicId, postIds) {
3839
const params = { postIds : postIds.join(',') }
39-
return axios.get(`${CONNECT_MESSAGE_API_URL}/v4/topics/${topicId}/posts`, { params })
40+
return axios.get(`${apiBaseUrl}/topics/${topicId}/posts/list`, { params })
4041
.then( resp => {
4142
return {
4243
totalCount: _.get(resp.data, 'result.metadata.totalCount', 0),
@@ -47,21 +48,21 @@ export function getTopicPosts(topicId, postIds) {
4748
}
4849

4950
export function createTopic(topicProps) {
50-
return axios.post(`${CONNECT_MESSAGE_API_URL}/v4/topics/`, topicProps, { timeout })
51+
return axios.post(`${apiBaseUrl}/topics/create`, topicProps, { timeout })
5152
.then( resp => {
5253
return _.get(resp.data, 'result.content', {})
5354
})
5455
}
5556

5657
export function saveTopic(topicId, topicProps) {
57-
return axios.post(`${CONNECT_MESSAGE_API_URL}/v4/topics/${topicId}/edit`, topicProps, { timeout })
58+
return axios.post(`${apiBaseUrl}/topics/${topicId}/edit`, topicProps, { timeout })
5859
.then( resp => {
5960
return _.get(resp.data, 'result.content', {})
6061
})
6162
}
6263

6364
export function deleteTopic(topicId) {
64-
return axios.delete(`${CONNECT_MESSAGE_API_URL}/v4/topics/${topicId}`, null, { timeout } )
65+
return axios.delete(`${apiBaseUrl}/topics/${topicId}/remove`, null, { timeout } )
6566
.then( resp => {
6667
return {
6768
result : _.get(resp.data, 'result.content', {})
@@ -70,7 +71,7 @@ export function deleteTopic(topicId) {
7071
}
7172

7273
export function addTopicPost(topicId, post) {
73-
return axios.post(`${CONNECT_MESSAGE_API_URL}/v4/topics/${topicId}/posts`, { post: post.content }, { timeout } )
74+
return axios.post(`${apiBaseUrl}/topics/${topicId}/posts/create`, { post: post.content }, { timeout } )
7475
.then( resp => {
7576
return {
7677
topicId,
@@ -80,7 +81,7 @@ export function addTopicPost(topicId, post) {
8081
}
8182

8283
export function saveTopicPost(topicId, post) {
83-
return axios.post(`${CONNECT_MESSAGE_API_URL}/v4/topics/${topicId}/posts/${post.id}/edit`, { post: post.content }, { timeout } )
84+
return axios.post(`${apiBaseUrl}/topics/${topicId}/posts/${post.id}/edit`, { post: post.content }, { timeout } )
8485
.then( resp => {
8586
return {
8687
topicId,
@@ -90,7 +91,7 @@ export function saveTopicPost(topicId, post) {
9091
}
9192

9293
export function getTopicPost(topicId, postId) {
93-
return axios.get(`${CONNECT_MESSAGE_API_URL}/v4/topics/${topicId}/posts/${postId}`, null, { timeout } )
94+
return axios.get(`${apiBaseUrl}/topics/${topicId}/posts/${postId}/read`, null, { timeout } )
9495
.then( resp => {
9596
return {
9697
topicId,
@@ -100,7 +101,7 @@ export function getTopicPost(topicId, postId) {
100101
}
101102

102103
export function deleteTopicPost(topicId, postId) {
103-
return axios.delete(`${CONNECT_MESSAGE_API_URL}/v4/topics/${topicId}/posts/${postId}`, null, { timeout } )
104+
return axios.delete(`${apiBaseUrl}/topics/${topicId}/posts/${postId}/remove`, null, { timeout } )
104105
.then( resp => {
105106
return {
106107
result : _.get(resp.data, 'result.content', {})

src/api/projectMembers.js

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import _ from 'lodash'
22
import { axiosInstance as axios } from './requestInterceptor'
3-
import { TC_API_URL, PROJECTS_API_URL, CONNECT_MESSAGE_API_URL } from '../config/constants'
3+
import { TC_API_URL, PROJECTS_API_URL } from '../config/constants'
44

55
export function getMembersById (userIds) {
66
const _userIdArr = _.map(userIds, _id => `userId:${_id}`)
@@ -30,9 +30,7 @@ export function addProjectMember(projectId, newMember) {
3030
const url = `${PROJECTS_API_URL}/v4/projects/${projectId}/members/`
3131
return axios.post(url, { param: newMember})
3232
.then(resp => {
33-
return axios.put(`${CONNECT_MESSAGE_API_URL}/v4/topics/syncUsers`,
34-
{ reference: 'project', referenceId: projectId })
35-
.then(() => resp.data.result.content)
33+
return resp.data.result.content
3634
})
3735
}
3836

@@ -45,23 +43,11 @@ export function updateProjectMember(projectId, memberId, updatedProps) {
4543
})
4644
}
4745

48-
export function removeProjectMember(projectId, memberId, isUserLeaving) {
46+
export function removeProjectMember(projectId, memberId) {
4947
const url = `${PROJECTS_API_URL}/v4/projects/${projectId}/members/${memberId}/`
50-
let promise = { then: fn => fn() }
51-
if (isUserLeaving) {
52-
promise = axios.put(`${CONNECT_MESSAGE_API_URL}/v4/topics/syncUsers`,
53-
{ reference: 'project', referenceId: projectId, isUserLeaving })
54-
}
55-
return promise.then(() => {
56-
return axios.delete(url)
57-
.then(() => {
58-
if (!isUserLeaving) {
59-
return axios.put(`${CONNECT_MESSAGE_API_URL}/v4/topics/syncUsers`,
60-
{ reference: 'project', referenceId: projectId })
61-
.then(() => memberId)
62-
}
63-
// return the member id just removed
64-
return memberId
65-
})
66-
})
48+
return axios.delete(url)
49+
.then(() => {
50+
// return the member id just removed
51+
return memberId
52+
})
6753
}

src/components/Feed/Feed.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import UserTooltip from '../User/UserTooltip'
99
import {Link} from 'react-router-dom'
1010
import CommentEditToggle from '../ActionCard/CommentEditToggle'
1111
import RichTextArea from '../RichTextArea/RichTextArea'
12+
import { markdownToHTML } from '../../helpers/markdownToState'
1213

1314
class Feed extends React.Component {
1415
constructor(props) {
@@ -100,7 +101,7 @@ class Feed extends React.Component {
100101
<Link to={permalink}>{moment(date).fromNow()}</Link>
101102
</div>
102103
</div>
103-
<div className="card-body draftjs-post" dangerouslySetInnerHTML={{__html: topicMessage.content}} />
104+
<div className="card-body draftjs-post" dangerouslySetInnerHTML={{__html: markdownToHTML(topicMessage.content)}} />
104105
</div>
105106
</Panel.Body>
106107
)}

src/components/Feed/FeedComments.jsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Panel from '../Panel/Panel'
55
import AddComment from '../ActionCard/AddComment'
66
import Comment from '../ActionCard/Comment'
77
import cn from 'classnames'
8+
import {markdownToHTML} from '../../helpers/markdownToState'
89
import MediaQuery from 'react-responsive'
910
import CommentMobile from '../ActionCard/CommentMobile'
1011
import { SCREEN_BREAKPOINT_MD } from '../../config/constants'
@@ -90,7 +91,7 @@ class FeedComments extends React.Component {
9091
hasError={item.error}
9192
allMembers={allMembers}
9293
>
93-
<div dangerouslySetInnerHTML={{__html: item.content}} />
94+
<div dangerouslySetInnerHTML={{__html: markdownToHTML(item.content)}} />
9495
</Comment>
9596
))}
9697
{allowComments &&
@@ -115,7 +116,7 @@ class FeedComments extends React.Component {
115116
author={item.author}
116117
date={item.date}
117118
>
118-
<div dangerouslySetInnerHTML={{__html: item.content}} />
119+
<div dangerouslySetInnerHTML={{__html: markdownToHTML(item.content)}} />
119120
</CommentMobile>
120121
))}
121122
</div>

src/components/Feed/FeedMobile.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { Link } from 'react-router-dom'
99
import FeedComments from './FeedComments'
1010
import UserWithName from '../User/UserWithName'
1111
import NewPostMobile, { NEW_POST_STEP } from './NewPostMobile'
12+
import { markdownToHTML } from '../../helpers/markdownToState'
1213

1314
import './FeedMobile.scss'
1415

@@ -87,7 +88,7 @@ class FeedMobile extends React.Component {
8788
<Link styleName="date" to={permalink}>{moment(date).fromNow()}</Link>
8889
</div>
8990
<h4 styleName="title">{title}</h4>
90-
<div styleName="text" dangerouslySetInnerHTML={{__html: topicMessage.content}} />
91+
<div styleName="text" dangerouslySetInnerHTML={{__html: markdownToHTML(topicMessage.content)}} />
9192
{isCommentsShown &&
9293
<FeedComments
9394
allowComments={allowComments}

0 commit comments

Comments
 (0)