Skip to content

Commit

Permalink
[SDESK-2078] Rrestrict assignment actions if related-content is locked
Browse files Browse the repository at this point in the history
  • Loading branch information
nrvikas committed Nov 29, 2017
1 parent cedd41e commit 94e1f62
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
13 changes: 7 additions & 6 deletions client/components/AssignmentItem/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,13 @@ export const AssignmentItem = ({
},
]

const itemActions = inAssignments ? assignmentUtils.getAssignmentItemActions(
assignment,
session,
privileges,
actions
) : []
const itemActions = inAssignments && !isItemLocked ?
assignmentUtils.getAssignmentItemActions(
assignment,
session,
privileges,
actions
) : []

const isAssignmentInUse = assignmentUtils.isAssignmentInUse(assignment)

Expand Down
8 changes: 6 additions & 2 deletions client/components/AssignmentPreviewContainer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,12 @@ class AssignmentPreviewContainerComponent extends React.Component {
privileges,
startWorking,
removeAssignment,
lockedItems,
} = this.props

if (!inAssignments) {
const isItemLocked = get(lockedItems, 'assignments') && assignment._id in lockedItems.assignments

if (!inAssignments || isItemLocked) {
return []
}

Expand Down Expand Up @@ -288,7 +291,7 @@ AssignmentPreviewContainerComponent.propTypes = {
keywords: PropTypes.array,
contentTypes: PropTypes.array,
formProfile: PropTypes.object,

lockedItems: PropTypes.array,
newsCoverageStatus: PropTypes.array,
}

Expand All @@ -311,6 +314,7 @@ const mapStateToProps = (state) => ({
contentTypes: get(state, 'vocabularies.g2_content_type', []),
formProfile: selectors.getFormsProfile(state),
newsCoverageStatus: selectors.getNewsCoverageStatus(state),
lockedItems: selectors.getLockedItems(state),
})

const mapDispatchToProps = (dispatch) => ({
Expand Down

0 comments on commit 94e1f62

Please sign in to comment.