Skip to content

Commit 19febdc

Browse files
System AdministratorSystem Administrator
authored andcommitted
#4337 - Fix empty string description validation during phase creation/update
1 parent 4af78ac commit 19febdc

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

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

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

121121
const phaseData = {
122122
title: model.title,
123-
description: model.description,
123+
description: model.description || ' ',
124124
startDate: moment(model.startDate),
125125
endDate: moment(model.endDate),
126126
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class EditStageForm extends React.Component {
7676
}
7777

7878
submitValue(model) {
79+
console.log(model)
7980
const { phase, phaseIndex, updatePhaseAction } = this.props
8081
const {
8182
publishClicked
@@ -87,6 +88,7 @@ class EditStageForm extends React.Component {
8788
newStatus = PHASE_STATUS_ACTIVE
8889
}
8990
const updateParam = _.assign({}, model, {
91+
description: model.description || ' ',
9092
startDate: updatedStartDate,
9193
endDate: updatedEndDate || '',
9294
status: newStatus,
@@ -286,7 +288,7 @@ class EditStageForm extends React.Component {
286288
wrapperClass={`${styles['input-row']}`}
287289
label="Description"
288290
name="description"
289-
value={phase.description}
291+
value={phase.description.trim()}
290292
maxLength={255}
291293
/>
292294
</div>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class PhaseCard extends React.Component {
183183
{phaseEditable && !this.state.isEditting && (<a styleName="edit-btn" onClick={this.toggleEditView} />
184184
)}
185185
</div>
186-
<div styleName="project-description">{attr.phase.description}</div>
186+
{attr.phase.description.trim().length > 0 && <div styleName="project-description">{attr.phase.description}</div>}
187187
<div styleName="meta-list">
188188
<span styleName="meta">{attr.duration}</span>
189189
<span styleName="meta">{attr.startEndDates}</span>

0 commit comments

Comments
 (0)