Skip to content

Commit

Permalink
Merge pull request #1078 from nrvikas/SDESK-3657
Browse files Browse the repository at this point in the history
[SDESK-3657] Allow news-coverage-status to be editable if it is a draft coverage
  • Loading branch information
Mayur Dhamanwala committed Nov 26, 2018
2 parents c2461b4 + 1d799bc commit 4235943
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ export class CoverageForm extends React.Component {
defaultValue={planningUtils.defaultCoverageValues(newsCoverageStatus).news_coverage_status}
options={newsCoverageStatus}
{...fieldProps}
readOnly={!!get(value, 'assigned_to.desk', readOnly)}
readOnly={roFields.newsCoverageStatus}
/>

<Field
Expand Down
11 changes: 4 additions & 7 deletions client/utils/planning.js
Original file line number Diff line number Diff line change
Expand Up @@ -573,16 +573,13 @@ const getCoverageReadOnlyFields = (
};
}

const hasAssignment = !!get(coverage, 'assigned_to.assignment_id');
const isCancelled = get(newsCoverageStatus, 'qcode') ===
PLANNING.NEWS_COVERAGE_CANCELLED_STATUS.qcode;

// State is either derived from the Assignment state or if the coverage is cancelled
let state = null;

if (hasAssignment) {
if (get(coverage, 'assigned_to.assignment_id')) {
state = get(coverage, 'assigned_to.state');
} else if (isCancelled) {
} else if (get(newsCoverageStatus, 'qcode') ===
PLANNING.NEWS_COVERAGE_CANCELLED_STATUS.qcode) {
state = ASSIGNMENTS.WORKFLOW_STATE.CANCELLED;
}

Expand Down Expand Up @@ -641,7 +638,7 @@ const getCoverageReadOnlyFields = (
internal_note: readOnly,
g2_content_type: readOnly,
genre: readOnly,
newsCoverageStatus: readOnly || hasAssignment,
newsCoverageStatus: readOnly,
scheduled: readOnly,
};
}
Expand Down

0 comments on commit 4235943

Please sign in to comment.