Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
26d66bc
- enabled email changing
maxceem Jan 3, 2019
bdae41e
winning submission for F2F challenge 30083089 - Topcoder Connect - Fi…
maxceem Feb 11, 2019
cef29d6
removed Filters component which is not in use anymore
maxceem Feb 11, 2019
eb295ac
Merge pull request #2824 from appirio-tech/hotfix/avatars-with-email
RishiRajSahu Feb 12, 2019
45f5591
winning submission from challenge 30083313 - Topcoder Connect - Team …
maxceem Feb 13, 2019
32caeae
Merge branch 'dev' into feature/team-management-autocomplete
maxceem Feb 13, 2019
6ea8394
Merge branch 'dev' into feature/account-settings-improvements
maxceem Feb 13, 2019
690645b
Merge pull request #2830 from appirio-tech/feature/account-settings-i…
maxceem Feb 13, 2019
ea18a7c
Add config variable for Filepicker sources
mtwomey Feb 14, 2019
ce59352
Replace JSON editor library because react-json-editor-ajrm is no long…
Feb 14, 2019
ec836a3
lint fixes
Feb 14, 2019
65da8e6
Bringing back project estimate in dev
Feb 14, 2019
8b2dec5
fixed lint error
Feb 14, 2019
eb0e9ea
pricing config changes
Feb 14, 2019
8434526
lint fixes
Feb 14, 2019
37d6e46
one more test case for expression evaluator
Feb 15, 2019
7cf6bd3
Updating price config logic to read duration estimate as well
Feb 15, 2019
cc78293
copilot workflow changes
gondzo Feb 18, 2019
20a124b
account manager changes
gondzo Feb 19, 2019
28b0260
fix permission checks
gondzo Feb 19, 2019
46b2db6
debouncing server requests
maxceem Feb 19, 2019
a3ed579
Merge branch 'dev' into feature/team-management-autocomplete
RishiRajSahu Feb 19, 2019
b265876
Merge pull request #2829 from appirio-tech/feature/team-management-au…
RishiRajSahu Feb 19, 2019
3e61fd9
remove filtering by ID until project service supports it
maxceem Feb 19, 2019
bdaa780
Merge branch 'dev' into feature/filter-projects-by-columns
RishiRajSahu Feb 20, 2019
720d8c2
Merge pull request #2811 from appirio-tech/feature/filter-projects-by…
RishiRajSahu Feb 20, 2019
a1e93de
update permissions and rename account manager role
gondzo Feb 20, 2019
9e6b515
merge dev
gondzo Feb 20, 2019
b9e51c9
update paths
gondzo Feb 20, 2019
e9416a3
remove extra files
gondzo Feb 20, 2019
e6bd471
update config
gondzo Feb 20, 2019
adf61c5
Update constants.js
gondzo Feb 20, 2019
681c2db
Update notifications.js
gondzo Feb 20, 2019
9f5988e
Merge pull request #2843 from appirio-tech/feature/accountManager
RishiRajSahu Feb 20, 2019
dc0f42b
Update notifications.js
gondzo Feb 20, 2019
b4443ff
fix join project roles
gondzo Feb 20, 2019
7dc7ee7
merge dev
gondzo Feb 20, 2019
a076cbe
account manager topcoder role
gondzo Feb 21, 2019
da52543
fix lint
gondzo Feb 21, 2019
2cd725d
Merge branch 'dev' into feature/copilotWorkflow
gondzo Feb 21, 2019
fb36ae7
Merge pull request #2844 from appirio-tech/feature/copilotWorkflow
gondzo Feb 21, 2019
2212cd2
Renamed team title for customers
RishiRajSahu Feb 22, 2019
fc09282
Added title and renamed in file attachment edit dialog.
RishiRajSahu Feb 22, 2019
b1a91ec
copilot manager changes
gondzo Feb 24, 2019
da9135e
originator notifications update
gondzo Feb 24, 2019
7378cf9
Allowed Connect Account Manager to be able to search projects.
RishiRajSahu Feb 25, 2019
e069a49
issue 2848 Plus icon + visible even after logout from connect
iversonLv Feb 26, 2019
37dd267
fixes issue 2852
sumitdaga Feb 26, 2019
bca2065
added space
sumitdaga Feb 26, 2019
c8bb38a
Fix for issue #2855
gautam1168 Feb 26, 2019
24c49ef
Merge branch 'cf15' of https://github.com/appirio-tech/connect-app in…
gautam1168 Feb 26, 2019
b824e0e
dont reload page when approving/rejecting invite
gondzo Feb 26, 2019
ddb78dd
fix lint
gondzo Feb 26, 2019
ce9ecad
Update cancellation reasons
r0hit-gupta Feb 26, 2019
34e8439
update project members when invite is approved
gondzo Feb 26, 2019
17d3123
issue 2836 fix
Gauravseta Feb 26, 2019
09b729b
Merge pull request #2858 from iversonLv/issue_2848
maxceem Feb 27, 2019
95426ab
Merge pull request #2860 from sumitdaga/issue-2852
maxceem Feb 27, 2019
800acca
Merge pull request #2861 from gautam1168/gauravgautam
maxceem Feb 27, 2019
e417025
fix lint error
maxceem Feb 27, 2019
cd2002a
fix tests which expected throwing exception
maxceem Feb 27, 2019
af09e3b
fixes issue 2863
sumitdaga Feb 27, 2019
3f477a2
Merge pull request #2867 from sumitdaga/issue-2863
maxceem Feb 27, 2019
aab3b13
Merge branch 'cf15' of https://github.com/appirio-tech/connect-app in…
r0hit-gupta Feb 27, 2019
d173e74
fix lint errors
r0hit-gupta Feb 27, 2019
5e72589
Modify the url used to load avatar so that it is not loaded from s3 b…
gautam1168 Feb 27, 2019
5ec8be2
Merge branch 'dev' into cloudfrontavatar
gautam1168 Feb 27, 2019
e972cf4
issue_2836 patch
Gauravseta Feb 27, 2019
ba5291d
issue 2850 fix
rashmi73 Feb 27, 2019
7ff06cb
Merge pull request #2864 from r0hit-gupta/update-reasons
maxceem Feb 28, 2019
154d831
Merge pull request #2866 from Gauravseta/issue_2836
maxceem Feb 28, 2019
87fc85b
Merge pull request #2868 from gautam1168/cloudfrontavatar
maxceem Feb 28, 2019
b993539
Merge conflict resolution
gautam1168 Feb 28, 2019
bcb202c
React select version update
gautam1168 Feb 28, 2019
389a141
Modify reducer to keep suggested members separate
gautam1168 Feb 28, 2019
2adc79c
Forgot to run linter
gautam1168 Feb 28, 2019
387b25d
fixes isssue 2828
sumitdaga Feb 28, 2019
092ba61
Added code to clear suggestions once selection is made or item is del…
gautam1168 Mar 1, 2019
ab29f10
Styling changes for autoselect input
gautam1168 Mar 1, 2019
e43a518
More style updated
gautam1168 Mar 1, 2019
1a8cc3a
Added code to clear suggestion list when input length goes below 3 ch…
gautam1168 Mar 1, 2019
b67b5d8
Changes for userautocomplete box
gautam1168 Mar 1, 2019
4dfc992
Add creation option
gautam1168 Mar 1, 2019
344be8e
Replace custom debounce with lodash debounce
gautam1168 Mar 1, 2019
dbd25ce
Lint fixes
gautam1168 Mar 1, 2019
ca0ea3e
Merge pull request #2871 from sumitdaga/issue-2828
maxceem Mar 1, 2019
72f2f2d
"xit" tests which are not yet passed by evaluate function
maxceem Mar 1, 2019
7b3e5c0
Merge branch 'cf15' into cf15-evaluate
maxceem Mar 1, 2019
7c99700
Update EditFileAttachment.jsx
rashmi73 Mar 1, 2019
fcd1dec
Corrected notification messages for invite accept/refused.
RishiRajSahu Mar 1, 2019
5855300
Corrected topic name to capture the invite reject notification.
RishiRajSahu Mar 1, 2019
8a6d891
invite approve success messages
gondzo Mar 1, 2019
da74505
Update EditFileAttachment.jsx
rashmi73 Mar 1, 2019
9fcc845
Merge pull request #2869 from rashmi73/issue_2850
maxceem Mar 2, 2019
0b36a62
small improvements #2850
maxceem Mar 2, 2019
e46bf6b
Style changes to input box and adding placeholder
gautam1168 Mar 2, 2019
df39a36
More style changes
gautam1168 Mar 2, 2019
b85558a
Border color change for autocompletebox
gautam1168 Mar 2, 2019
dea3ad2
Fast typing enabled
gautam1168 Mar 2, 2019
0bfe6da
Moved styles to jsx
gautam1168 Mar 2, 2019
5fd81a0
Use scss variables to set colors and fonts
gautam1168 Mar 2, 2019
36aa43a
Final fixes
gautam1168 Mar 2, 2019
83ccda9
Fix for jumping placeholder and shifting selected values and input bo…
gautam1168 Mar 3, 2019
5c80304
Debounce fix
gautam1168 Mar 3, 2019
4890af8
Email fix
gautam1168 Mar 3, 2019
14c03e1
Fix for selected value box moving down on focus lost on react select
gautam1168 Mar 3, 2019
633060e
Lint fixes
gautam1168 Mar 3, 2019
0bca8cd
Move creation option to top and move styles used to hide dropdown ind…
gautam1168 Mar 4, 2019
89b3f90
Fix for select text moving down
gautam1168 Mar 4, 2019
112b06c
box shadow fix
gautam1168 Mar 4, 2019
69cc662
Lint fixes
gautam1168 Mar 4, 2019
23b36d6
Fixes for placeholder jumping down and charters getting chopped from …
gautam1168 Mar 4, 2019
0daaf49
Merge pull request #2870 from gautam1168/reactselectversionupdate
maxceem Mar 4, 2019
0ddda2e
fix cutting the first latter in input #2870
maxceem Mar 4, 2019
a3a3ab7
fix inviting by handles, issue #2846
maxceem Mar 4, 2019
a800de6
Merge branch 'dev' into cf15
maxceem Mar 4, 2019
9731ddc
winning submission from challenge 30085188 - Topcoder Connect - Handl…
maxceem Mar 5, 2019
99fb93b
updated so individual failed invitataions have 'userId' field instead…
maxceem Mar 5, 2019
88cb1d5
show error popup when some or all users couldn't be invited
maxceem Mar 5, 2019
0ba8503
Merge pull request #2875 from appirio-tech/cf15
RishiRajSahu Mar 5, 2019
dfd75f1
come back to 'feature/connectv2' branch of 'react-components'
maxceem Mar 5, 2019
d07426d
During this merging members autocompletion was refactored to support …
maxceem Mar 6, 2019
887cf4e
fix lint
maxceem Mar 6, 2019
8b86d0c
Merge pull request #2877 from maxceem/feature/individual-invitation-e…
RishiRajSahu Mar 6, 2019
3c1bc86
Added permission rule for enable ability to invite
RishiRajSahu Mar 6, 2019
fe5485d
Added permission check for topcoder team dialog
RishiRajSahu Mar 6, 2019
d9af2d6
Updated design selection sections title
RishiRajSahu Mar 6, 2019
c6a21a9
Merge branch 'master' into dev
Mar 7, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16,765 changes: 8,920 additions & 7,845 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,9 @@
"webpack-merge": "^4.1.1"
},
"dependencies": {
"appirio-tech-react-components": "git+https://github.com/appirio-tech/react-components.git#feature/filestack-v3",
"appirio-tech-react-components": "git+https://github.com/appirio-tech/react-components.git#feature/connectv2",
"axios": "^0.13.1",
"brace": "^0.11.1",
"classnames": "^2.2.3",
"coffeescript": "^1.12.7",
"draft-js": "^0.10.1",
Expand All @@ -100,6 +101,8 @@
"history": "^1.17.0",
"html5-uploader": "^0.1.1",
"js-cookie": "^2.1.4",
"jsoneditor": "^5.28.2",
"jsoneditor-react": "^1.0.0",
"linkify-it": "^2.0.3",
"lodash": "^4.16.4",
"mobile-detect": "^1.4.2",
Expand All @@ -119,7 +122,6 @@
"react-dotdotdot": "^1.0.4",
"react-gateway": "^3.0.0",
"react-infinite-scroller": "^1.1.1",
"react-json-view": "^1.19.1",
"react-layout-pane": "^0.1.16",
"react-modal": "^1.9.7",
"react-redux": "^4.4.5",
Expand All @@ -128,7 +130,7 @@
"react-s-alert": "^1.1.4",
"react-scroll": "^1.7.6",
"react-scroll-lock-component": "^1.1.2",
"react-select": "^0.9.1",
"react-select": "^2.4.0",
"react-stickynode": "^1.2.1",
"react-text-truncate": "^0.8.3",
"react-transition-group": "^2.5.0",
Expand Down
11 changes: 10 additions & 1 deletion src/api/projectMemberInvites.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,16 @@ export function updateProjectMemberInvite(projectId, member) {
*/
export function createProjectMemberInvite(projectId, member) {
const url = `${PROJECTS_API_URL}/v4/projects/${projectId}/members/invite/`
return axios.post(url, { param: member})
return axios({
method: 'post',
url,
data: {
param: member
},
validateStatus (status) {
return (status >= 200 && status < 300) || status === 403
},
})
.then(resp => {
return resp.data.result.content
})
Expand Down
1 change: 1 addition & 0 deletions src/api/projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export function getProjectById(projectId) {
_.forEach(res.attachments, a => {
a.downloadUrl = `/projects/${projectId}/attachments/${a.id}`
})
if (!res.invites) res.invites = []
return res
})
}
Expand Down
65 changes: 35 additions & 30 deletions src/api/users.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import _ from 'lodash'
import { axiosInstance as axios } from './requestInterceptor'
import { TC_API_URL, RESET_PASSWORD_URL } from '../config/constants'
import querystring from 'querystring'

/**
* Get a user based on it's handle/username
*
*
* @param {String} handle user handle
*
*
* @returns {Promise<Object>} user profile data
*/
export function getUserProfile(handle) {
Expand All @@ -18,15 +19,19 @@ export function getUserProfile(handle) {

/**
* Update user profile
*
*
* @param {String} handle user handle
* @param {Object} updatedProfile updated user data
*
* @param {Object} [queryParams] optional query params
*
* @returns {Promise<Object>} user profile data
*/
export function updateUserProfile(handle, updatedProfile) {
return axios.put(`${TC_API_URL}/v3/members/${handle}/`, {
param: updatedProfile
export function updateUserProfile(handle, updatedProfile, queryParams = {}) {
let query = querystring.stringify(queryParams)
query = query ? `?${query}` : ''

return axios.put(`${TC_API_URL}/v3/members/${handle}/${query}`, {
param: updatedProfile
})
.then(resp => {
return _.get(resp.data, 'result.content', {})
Expand All @@ -35,9 +40,9 @@ export function updateUserProfile(handle, updatedProfile) {

/**
* Get member traits
*
*
* @param {String} handle member handle
*
*
* @returns {Promise<Array>} member traits
*/
export const getMemberTraits = (handle) => {
Expand All @@ -47,10 +52,10 @@ export const getMemberTraits = (handle) => {

/**
* Update member traits
*
*
* @param {String} handle member handle
* @param {Array} updatedTraits list of updated traits
*
*
* @returns {Promise<Array>} member traits
*/
export const updateMemberTraits = (handle, updatedTraits) => {
Expand All @@ -62,10 +67,10 @@ export const updateMemberTraits = (handle, updatedTraits) => {

/**
* Create member traits
*
*
* @param {String} handle member handle
* @param {Array} traits list of traits to create
*
*
* @returns {Promise<Array>} member traits
*/
export const createMemberTraits = (handle, traits) => {
Expand All @@ -77,12 +82,12 @@ export const createMemberTraits = (handle, traits) => {

/**
* Update member photo
*
*
* @param {String} handle member handle
* @param {Object} data params to update photo
* @param {String} data.contentType photo file content type
* @param {String} data.token token provided by pre signed URL
*
*
* @returns {Promise<String>} photo URL
*/
export const updateMemberPhoto = (handle, data) => {
Expand All @@ -94,26 +99,26 @@ export const updateMemberPhoto = (handle, data) => {

/**
* Get pre-signed URL for member photo
*
*
* @param {String} handle member handle
* @param {File} file file to upload
*
* @returns {Promise<Object>} data of pre-signed URL
*
* @returns {Promise<Object>} data of pre-signed URL
*/
export const getPreSignedUrl = (handle, file) => {
return axios.post(`${TC_API_URL}/v3/members/${handle}/photoUploadUrl`, {
param: {
contentType: file.type
}
return axios.post(`${TC_API_URL}/v3/members/${handle}/photoUploadUrl`, {
param: {
contentType: file.type
}
})
.then(resp => _.get(resp.data, 'result.content', {}))
}

/**
* Check if email is available to be used for a user
*
*
* @param {String} email email to validate
*
*
* @returns {Promise<Object>} response body
*/
export const checkEmailValidity = (email) => {
Expand All @@ -123,24 +128,24 @@ export const checkEmailValidity = (email) => {

/**
* Update user password
*
*
* @param {Number} userId user id
* @param {Object} credential user credentials old and new one
*
*
* @returns {Promise<Object>} response body
*/
export const updatePassword = (userId, credential) => {
return axios.patch(`${TC_API_URL}/v3/users/${userId}`, {
param: { credential }
return axios.patch(`${TC_API_URL}/v3/users/${userId}`, {
param: { credential }
})
.then(resp => _.get(resp.data, 'result.content', {}))
}

/**
* Send reset password email to the user
*
*
* @param {String} email user email
*
*
* @returns {Promise<Object>} response body
*/
export const resetPassword = (email) => {
Expand Down
6 changes: 4 additions & 2 deletions src/components/ActionCard/AddComment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class AddComment extends React.Component {
}

render() {
const { className, avatarUrl, authorName, placeholder, isAdding, hasError, allMembers } = this.props
const { className, avatarUrl, authorName, placeholder, isAdding, hasError, allMembers, projectMembers } = this.props

return (
<RichTextArea ref="richTextArea"
Expand All @@ -39,6 +39,7 @@ export default class AddComment extends React.Component {
avatarUrl={avatarUrl}
authorName={authorName}
allMembers={allMembers}
projectMembers={projectMembers}
/>
)
}
Expand All @@ -54,5 +55,6 @@ AddComment.propTypes = {
placeholder: PropTypes.string,
hasError: PropTypes.bool,
isAdding: PropTypes.bool,
allMembers: PropTypes.object
allMembers: PropTypes.object,
projectMembers: PropTypes.object
}
5 changes: 3 additions & 2 deletions src/components/ActionCard/Comment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Comment extends React.Component {
}

render() {
const {message, author, date, edited, children, noInfo, self, isSaving, hasError, readonly, allMembers, canDelete} = this.props
const {message, author, date, edited, children, noInfo, self, isSaving, hasError, readonly, allMembers, canDelete, projectMembers} = this.props
const messageAnchor = `comment-${message.id}`
const messageLink = window.location.pathname.substr(0, window.location.pathname.indexOf('#')) + `#${messageAnchor}`
const authorName = author ? (author.firstName + ' ' + author.lastName) : 'Connect user'
Expand All @@ -84,6 +84,7 @@ class Comment extends React.Component {
authorName={authorName}
cancelEdit={this.cancelEdit}
allMembers={allMembers}
projectMembers={projectMembers}
editingTopic = {false}
/>
</div>
Expand Down Expand Up @@ -194,7 +195,7 @@ Comment.propTypes = {
*/
readonly: PropTypes.bool,
allMembers: PropTypes.object.isRequired,

projectMembers: PropTypes.object,
/**
* If true only comment text is shown without additional info
*/
Expand Down
3 changes: 2 additions & 1 deletion src/components/Feed/Feed.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class Feed extends React.Component {
id, user, currentUser, topicMessage, totalComments, hasMoreComments, onLoadMoreComments, isLoadingComments,
allowComments, comments, children, onNewCommentChange, onAddNewComment, isAddingComment, onSaveMessageChange,
onEditMessage, onSaveMessage, isSavingTopic, onDeleteMessage, onDeleteTopic, isDeletingTopic, error, allMembers,
onEnterFullscreenClick, onExitFullscreenClick, isFullScreen, commentId
onEnterFullscreenClick, onExitFullscreenClick, isFullScreen, commentId, projectMembers
} = this.props
const { editTopicMode, headerHeight } = this.state
let authorName = user ? user.firstName : 'Unknown'
Expand Down Expand Up @@ -177,6 +177,7 @@ class Feed extends React.Component {
onSaveMessage={onSaveMessage}
onDeleteMessage={onDeleteMessage}
allMembers={allMembers}
projectMembers={projectMembers}
isFullScreen={isFullScreen}
headerHeight={headerHeight}
commentId={commentId}
Expand Down
4 changes: 3 additions & 1 deletion src/components/Feed/FeedComments.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class FeedComments extends React.Component {
const {
comments, currentUser, onLoadMoreComments, isLoadingComments, hasMoreComments, onAddNewComment,
onNewCommentChange, error, avatarUrl, isAddingComment, allowComments, onSaveMessage, onDeleteMessage, allMembers,
totalComments, isFullScreen, headerHeight
totalComments, isFullScreen, headerHeight, projectMembers
} = this.props
const { isNewCommentMobileOpen, stickyRowNext, stickyRowPrev } = this.state
let authorName = currentUser.firstName
Expand Down Expand Up @@ -319,6 +319,7 @@ class FeedComments extends React.Component {
isSaving={item.isSavingComment}
hasError={item.error}
allMembers={allMembers}
projectMembers={projectMembers}
noInfo={item.noInfo}
canDelete={idx !== 0}
>
Expand Down Expand Up @@ -389,6 +390,7 @@ class FeedComments extends React.Component {
isAdding={isAddingComment}
hasError={error}
allMembers={allMembers}
projectMembers={projectMembers}
/>
</div>
}
Expand Down
4 changes: 3 additions & 1 deletion src/components/Feed/NewPost.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class NewPost extends React.Component {
}

render() {
const {currentUser, allMembers, titlePlaceholder, contentPlaceholder, isCreating, hasError, expandedTitlePlaceholder} = this.props
const {currentUser, allMembers, titlePlaceholder, contentPlaceholder, isCreating, hasError, expandedTitlePlaceholder, projectMembers} = this.props
let authorName = currentUser.firstName
if (authorName && currentUser.lastName) {
authorName += ' ' + currentUser.lastName
Expand All @@ -38,6 +38,7 @@ class NewPost extends React.Component {
avatarUrl={currentUser.photoURL}
authorName={authorName}
allMembers={allMembers}
projectMembers={projectMembers}
/>
)
}
Expand All @@ -48,6 +49,7 @@ NewPost.propTypes = {
expandedTitlePlaceholder: PropTypes.string,
currentUser: PropTypes.object.isRequired,
allMembers: PropTypes.object.isRequired,
projectMembers: PropTypes.object,
onPost: PropTypes.func.isRequired,
onNewPostChange: PropTypes.func.isRequired,
hasError: PropTypes.bool,
Expand Down
20 changes: 15 additions & 5 deletions src/components/FileList/AddFilePermissions.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import Modal from 'react-modal'
import { mapKeys, get } from 'lodash'

import UserAutoComplete from '../UserAutoComplete/UserAutoComplete'
import LoadingIndicator from '../LoadingIndicator/LoadingIndicator'

import './AddFilePermissions.scss'
import XMarkIcon from '../../assets/icons/icon-x-mark.svg'

const AddFilePermission = ({ onCancel, onSubmit, onChange, selectedUsers, projectMembers, loggedInUser }) => {
const AddFilePermission = ({ onCancel, onSubmit, onChange, selectedUsers, projectMembers, loggedInUser, isSharingAttachment }) => {
selectedUsers = selectedUsers || ''
const mapHandlesToUserIds = handles => {
const projectMembersByHandle = mapKeys(projectMembers, value => value.handle)
Expand All @@ -28,10 +29,18 @@ const AddFilePermission = ({ onCancel, onSubmit, onChange, selectedUsers, projec
<span onClick={onCancel}><XMarkIcon /></span>
</div>

<div styleName="loading-indicator-wrapper">
{ isSharingAttachment && <LoadingIndicator isSmall /> }
</div>

{/* Share with all members */}
<div className="dialog-body">
<div styleName="btn-all-members">
<button className="tc-btn tc-btn-primary tc-btn-md" onClick={() => onSubmit(null)}>All project members</button>
<button
className="tc-btn tc-btn-primary tc-btn-md"
onClick={() => onSubmit(null)}
disabled={isSharingAttachment}
>All project members</button>
</div>
</div>

Expand All @@ -41,10 +50,10 @@ const AddFilePermission = ({ onCancel, onSubmit, onChange, selectedUsers, projec

<UserAutoComplete projectMembers={projectMembers} selectedUsers={selectedUsers} onUpdate={onChange} loggedInUser={loggedInUser} />

<div>
<div styleName="btn-selected-members">
<button className="tc-btn tc-btn-primary tc-btn-md"
onClick={() => onSubmit(mapHandlesToUserIds(selectedUsers.split(',')))}
disabled={!selectedUsers || selectedUsers.length === 0 }
disabled={!selectedUsers || selectedUsers.length === 0 || isSharingAttachment }
>Share with selected members</button>
</div>
</div>
Expand All @@ -59,7 +68,8 @@ AddFilePermission.propTypes = {
onChange: PropTypes.func.isRequired,
selectedUsers: PropTypes.string,
projectMembers: PropTypes.object,
loggedInUser: PropTypes.object.isRequired
loggedInUser: PropTypes.object.isRequired,
isSharingAttachment: PropTypes.bool.isRequired,
}

export default AddFilePermission
Loading