Skip to content

Commit d1f761b

Browse files
author
vikasrohit
authored
Merge pull request #2808 from appirio-tech/feature/attachmentPermissions
rename userIds field to allowedUsers
2 parents 834abd9 + 5d3e940 commit d1f761b

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

src/api/projectAttachments.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ export function addProjectAttachment(projectId, fileData) {
1313
}
1414

1515
export function updateProjectAttachment(projectId, attachmentId, attachment) {
16-
if (attachment && (!attachment.userIds || attachment.userIds.length === 0)) {
16+
if (attachment && (!attachment.allowedUsers || attachment.allowedUsers.length === 0)) {
1717
attachment = {
1818
...attachment,
19-
userIds: null
19+
allowedUsers: null
2020
}
2121
}
2222

src/components/FileList/FileListItem.jsx

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default class FileListItem extends React.Component {
2020
this.state = {
2121
title: props.title,
2222
description: props.description,
23-
userIds: props.userIds,
23+
allowedUsers: props.allowedUsers,
2424
isEditing: false
2525
}
2626
this.handleSave = this.handleSave.bind(this)
@@ -37,11 +37,11 @@ export default class FileListItem extends React.Component {
3737
}
3838

3939
startEdit() {
40-
const {title, description, userIds} = this.props
40+
const {title, description, allowedUsers} = this.props
4141
this.setState({
4242
title,
4343
description,
44-
userIds,
44+
allowedUsers,
4545
isEditing: true
4646
})
4747
}
@@ -52,7 +52,7 @@ export default class FileListItem extends React.Component {
5252
if (!_.isEmpty(errors)) {
5353
this.setState({ errors })
5454
} else {
55-
this.props.onSave(this.props.id, {title, description: this.refs.desc.value, userIds: this.state.userIds}, e)
55+
this.props.onSave(this.props.id, {title, description: this.refs.desc.value, allowedUsers: this.state.allowedUsers}, e)
5656
this.setState({isEditing: false})
5757
}
5858
}
@@ -80,14 +80,14 @@ export default class FileListItem extends React.Component {
8080

8181
onUserIdChange(selectedHandles = '') {
8282
this.setState({
83-
userIds: this.handlesToUserIds(selectedHandles.split(','))
83+
allowedUsers: this.handlesToUserIds(selectedHandles.split(','))
8484
})
8585
}
8686

87-
userIdsToHandles(userIds) {
87+
userIdsToHandles(allowedUsers) {
8888
const { projectMembers } = this.props
89-
userIds = userIds || []
90-
return userIds.map(userId => _.get(projectMembers[userId], 'handle'))
89+
allowedUsers = allowedUsers || []
90+
return allowedUsers.map(userId => _.get(projectMembers[userId], 'handle'))
9191
}
9292

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

100100
renderEditing() {
101101
const { title, description, projectMembers, loggedInUser } = this.props
102-
const { errors, userIds } = this.state
102+
const { errors, allowedUsers } = this.state
103103
const onExitEdit = () => this.setState({isEditing: false, errors: {} })
104104
return (
105105
<div>
@@ -116,7 +116,7 @@ export default class FileListItem extends React.Component {
116116
<UserAutoComplete onUpdate={this.onUserIdChange}
117117
projectMembers={projectMembers}
118118
loggedInUser={loggedInUser}
119-
selectedUsers={this.userIdsToHandles(userIds).join(',')}
119+
selectedUsers={this.userIdsToHandles(allowedUsers).join(',')}
120120
/>
121121
</div>
122122
)
@@ -186,7 +186,7 @@ FileListItem.propTypes = {
186186
createdByUser: PropTypes.object.isRequired,
187187
projectMembers: PropTypes.object.isRequired,
188188
loggedInUser: PropTypes.object.isRequired,
189-
userIds: PropTypes.array,
189+
allowedUsers: PropTypes.array,
190190

191191
/**
192192
* Callback fired when a save button is clicked

src/components/LinksMenu/FileLinksMenu.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,12 @@ const FileLinksMenu = ({
8484
onUploadAttachment(attachments)
8585
}
8686

87-
const onAddingAttachmentPermissions = (userIds) => {
87+
const onAddingAttachmentPermissions = (allowedUsers) => {
8888
const { attachments, projectId } = pendingAttachments
8989
_.forEach(attachments, f => {
9090
const attachment = {
9191
...f,
92-
userIds
92+
allowedUsers
9393
}
9494
onAddAttachment(projectId, attachment)
9595
})

src/projects/actions/projectAttachment.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ export function addProjectAttachment(projectId, attachment) {
3737
}
3838
}
3939

40-
export function changeAttachmentPermission(userIds) {
40+
export function changeAttachmentPermission(allowedUsers) {
4141
return dispatch => {
4242
return dispatch({
4343
type: CHANGE_ATTACHMENT_PERMISSION,
44-
payload: userIds
44+
payload: allowedUsers
4545
})
4646
}
4747
}

src/projects/detail/components/FileListContainer.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ class FileListContainer extends Component {
3838
this.props.uploadProjectAttachments(project.id, attachment)
3939
}
4040

41-
onAddingAttachmentPermissions(userIds) {
41+
onAddingAttachmentPermissions(allowedUsers) {
4242
const { attachments } = this.props.pendingAttachments
4343
_.forEach(attachments, f => {
4444
const attachment = {
4545
...f,
46-
userIds
46+
allowedUsers
4747
}
4848
this.props.addAttachment(attachment)
4949
})

0 commit comments

Comments
 (0)