Skip to content

Commit 261a743

Browse files
authored
Merge pull request #1150 from appirio-tech/dev
Sync up changes that include the Topic / Late user join fix...
2 parents 2de7119 + 6109f7b commit 261a743

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+9234
-4175
lines changed

npm-shrinkwrap.json

+8,335-3,993
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@
4848
"isomorphic-fetch": "^2.2.1",
4949
"lodash": "^4.16.4",
5050
"moment": "^2.14.1",
51+
"query-string": "^4.3.4",
5152
"react": "^15.6.1",
5253
"react-addons-css-transition-group": "^15.6.0",
5354
"react-addons-pure-render-mixin": "^15.6.0",
54-
"query-string": "^4.3.4",
5555
"react-color": "^2.13.1",
5656
"react-datetime": "2.7.1",
5757
"react-dom": "^15.6.1",

src/api/projectMembers.js

+21-7
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 } from '../config/constants'
3+
import { TC_API_URL, CONNECT_MESSAGE_API_URL } from '../config/constants'
44

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

@@ -42,11 +44,23 @@ export function updateProjectMember(projectId, memberId, updatedProps) {
4244
})
4345
}
4446

45-
export function removeProjectMember(projectId, memberId) {
47+
export function removeProjectMember(projectId, memberId, isUserLeaving) {
4648
const url = `${TC_API_URL}/v4/projects/${projectId}/members/${memberId}/`
47-
return axios.delete(url)
48-
.then(resp => { // eslint-disable-line no-unused-vars
49-
// return the member id just removed
50-
return memberId
49+
let promise = { then: fn => fn() }
50+
if (isUserLeaving) {
51+
promise = axios.put(`${CONNECT_MESSAGE_API_URL}/v4/topics/syncUsers`,
52+
{ reference: 'project', referenceId: projectId, isUserLeaving })
53+
}
54+
return promise.then(() => {
55+
return axios.delete(url)
56+
.then(() => {
57+
if (!isUserLeaving) {
58+
return axios.put(`${CONNECT_MESSAGE_API_URL}/v4/topics/syncUsers`,
59+
{ reference: 'project', referenceId: projectId })
60+
.then(() => memberId)
61+
}
62+
// return the member id just removed
63+
return memberId
64+
})
5165
})
5266
}
+8
Loading
+27
Loading

src/assets/images/icon-dont-know.svg

+12
Loading
Loading
+14
Loading
+14
Loading
+14
Loading
+22
Loading
Loading

0 commit comments

Comments
 (0)