Skip to content

Commit cedf36f

Browse files
authored
#4358 - Get rid of the workaround of passing empty spaces
2 parents 2d03ead + e1d52ea commit cedf36f

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/projects/detail/components/CreatePhaseForm/CreatePhaseForm.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,14 @@ class CreatePhaseForm extends React.Component {
120120

121121
const phaseData = {
122122
title: model.title,
123-
description: model.description || ' ',
124123
startDate: moment(model.startDate),
125124
endDate: moment(model.endDate),
126125
}
127126

127+
if (model.description.trim()) {
128+
phaseData.description = model.description
129+
}
130+
128131
const apiMilestones = milestones.map((milestone, index) => ({
129132
// default values
130133
...MILESTONE_DEFAULT_VALUES[milestone.type],

src/projects/detail/components/PhaseCard/EditStageForm.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,10 @@ class EditStageForm extends React.Component {
8686
if (publishClicked && phase.status === PHASE_STATUS_DRAFT) {
8787
newStatus = PHASE_STATUS_ACTIVE
8888
}
89+
if (!model.description.trim()) {
90+
delete model.description
91+
}
8992
const updateParam = _.assign({}, model, {
90-
description: model.description || ' ',
9193
startDate: updatedStartDate,
9294
endDate: updatedEndDate || '',
9395
status: newStatus
@@ -285,7 +287,7 @@ class EditStageForm extends React.Component {
285287
wrapperClass={`${styles['input-row']}`}
286288
label="Description"
287289
name="description"
288-
value={phase.description ? phase.description.trim() : ''}
290+
value={phase.description}
289291
maxLength={255}
290292
/>
291293
<label styleName="description-sub-label">255 character maximum</label>

0 commit comments

Comments
 (0)