Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions src/api/projectAttachments.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ export function addProjectAttachment(projectId, fileData) {
}

export function updateProjectAttachment(projectId, attachmentId, attachment) {
if (attachment && (!attachment.userIds || attachment.userIds.length === 0)) {
if (attachment && (!attachment.allowedUsers || attachment.allowedUsers.length === 0)) {
attachment = {
...attachment,
userIds: null
allowedUsers: null
}
}

Expand Down
22 changes: 11 additions & 11 deletions src/components/FileList/FileListItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export default class FileListItem extends React.Component {
this.state = {
title: props.title,
description: props.description,
userIds: props.userIds,
allowedUsers: props.allowedUsers,
isEditing: false
}
this.handleSave = this.handleSave.bind(this)
Expand All @@ -37,11 +37,11 @@ export default class FileListItem extends React.Component {
}

startEdit() {
const {title, description, userIds} = this.props
const {title, description, allowedUsers} = this.props
this.setState({
title,
description,
userIds,
allowedUsers,
isEditing: true
})
}
Expand All @@ -52,7 +52,7 @@ export default class FileListItem extends React.Component {
if (!_.isEmpty(errors)) {
this.setState({ errors })
} else {
this.props.onSave(this.props.id, {title, description: this.refs.desc.value, userIds: this.state.userIds}, e)
this.props.onSave(this.props.id, {title, description: this.refs.desc.value, allowedUsers: this.state.allowedUsers}, e)
this.setState({isEditing: false})
}
}
Expand Down Expand Up @@ -80,14 +80,14 @@ export default class FileListItem extends React.Component {

onUserIdChange(selectedHandles = '') {
this.setState({
userIds: this.handlesToUserIds(selectedHandles.split(','))
allowedUsers: this.handlesToUserIds(selectedHandles.split(','))
})
}

userIdsToHandles(userIds) {
userIdsToHandles(allowedUsers) {
const { projectMembers } = this.props
userIds = userIds || []
return userIds.map(userId => _.get(projectMembers[userId], 'handle'))
allowedUsers = allowedUsers || []
return allowedUsers.map(userId => _.get(projectMembers[userId], 'handle'))
}

handlesToUserIds(handles) {
Expand All @@ -99,7 +99,7 @@ export default class FileListItem extends React.Component {

renderEditing() {
const { title, description, projectMembers, loggedInUser } = this.props
const { errors, userIds } = this.state
const { errors, allowedUsers } = this.state
const onExitEdit = () => this.setState({isEditing: false, errors: {} })
return (
<div>
Expand All @@ -116,7 +116,7 @@ export default class FileListItem extends React.Component {
<UserAutoComplete onUpdate={this.onUserIdChange}
projectMembers={projectMembers}
loggedInUser={loggedInUser}
selectedUsers={this.userIdsToHandles(userIds).join(',')}
selectedUsers={this.userIdsToHandles(allowedUsers).join(',')}
/>
</div>
)
Expand Down Expand Up @@ -186,7 +186,7 @@ FileListItem.propTypes = {
createdByUser: PropTypes.object.isRequired,
projectMembers: PropTypes.object.isRequired,
loggedInUser: PropTypes.object.isRequired,
userIds: PropTypes.array,
allowedUsers: PropTypes.array,

/**
* Callback fired when a save button is clicked
Expand Down
4 changes: 2 additions & 2 deletions src/components/LinksMenu/FileLinksMenu.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ const FileLinksMenu = ({
onUploadAttachment(attachments)
}

const onAddingAttachmentPermissions = (userIds) => {
const onAddingAttachmentPermissions = (allowedUsers) => {
const { attachments, projectId } = pendingAttachments
_.forEach(attachments, f => {
const attachment = {
...f,
userIds
allowedUsers
}
onAddAttachment(projectId, attachment)
})
Expand Down
4 changes: 2 additions & 2 deletions src/projects/actions/projectAttachment.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ export function addProjectAttachment(projectId, attachment) {
}
}

export function changeAttachmentPermission(userIds) {
export function changeAttachmentPermission(allowedUsers) {
return dispatch => {
return dispatch({
type: CHANGE_ATTACHMENT_PERMISSION,
payload: userIds
payload: allowedUsers
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/projects/detail/components/FileListContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ class FileListContainer extends Component {
this.props.uploadProjectAttachments(project.id, attachment)
}

onAddingAttachmentPermissions(userIds) {
onAddingAttachmentPermissions(allowedUsers) {
const { attachments } = this.props.pendingAttachments
_.forEach(attachments, f => {
const attachment = {
...f,
userIds
allowedUsers
}
this.props.addAttachment(attachment)
})
Expand Down