From 5d3e94039cf3b6fde7f0a34b817d2f2adeed244f Mon Sep 17 00:00:00 2001 From: Samir Date: Sat, 9 Feb 2019 17:49:33 +0100 Subject: [PATCH] rename userIds field to allowedUsers --- src/api/projectAttachments.js | 4 ++-- src/components/FileList/FileListItem.jsx | 22 +++++++++---------- src/components/LinksMenu/FileLinksMenu.jsx | 4 ++-- src/projects/actions/projectAttachment.js | 4 ++-- .../detail/components/FileListContainer.jsx | 4 ++-- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/api/projectAttachments.js b/src/api/projectAttachments.js index afdbb7b50..30cec55ff 100644 --- a/src/api/projectAttachments.js +++ b/src/api/projectAttachments.js @@ -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 } } diff --git a/src/components/FileList/FileListItem.jsx b/src/components/FileList/FileListItem.jsx index a2f65c64c..ec6c12db8 100644 --- a/src/components/FileList/FileListItem.jsx +++ b/src/components/FileList/FileListItem.jsx @@ -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) @@ -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 }) } @@ -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}) } } @@ -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) { @@ -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 (
@@ -116,7 +116,7 @@ export default class FileListItem extends React.Component {
) @@ -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 diff --git a/src/components/LinksMenu/FileLinksMenu.jsx b/src/components/LinksMenu/FileLinksMenu.jsx index e751d56a7..a9ab04091 100644 --- a/src/components/LinksMenu/FileLinksMenu.jsx +++ b/src/components/LinksMenu/FileLinksMenu.jsx @@ -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) }) diff --git a/src/projects/actions/projectAttachment.js b/src/projects/actions/projectAttachment.js index 10e558c84..f476b17d0 100644 --- a/src/projects/actions/projectAttachment.js +++ b/src/projects/actions/projectAttachment.js @@ -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 }) } } diff --git a/src/projects/detail/components/FileListContainer.jsx b/src/projects/detail/components/FileListContainer.jsx index 17df85cde..040927596 100644 --- a/src/projects/detail/components/FileListContainer.jsx +++ b/src/projects/detail/components/FileListContainer.jsx @@ -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) })