Skip to content

Commit 49ed2c6

Browse files
author
Martin Krulis
committed
Fixing shadow assignment creation issues.
1 parent 4ee37ab commit 49ed2c6

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed

src/components/forms/EditShadowAssignmentForm/EditShadowAssignmentForm.js

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import LocalizedTextsFormField from '../LocalizedTextsFormField';
1010
import SubmitButton from '../SubmitButton';
1111
import { LocalizedExerciseName } from '../../helpers/LocalizedNames';
1212
import { validateLocalizedTextsFormData } from '../../../helpers/localizedData';
13+
import { safeGet } from '../../../helpers/common';
1314

1415
const EditShadowAssignmentForm = ({
1516
initialValues: shadowAssignment,
@@ -28,13 +29,17 @@ const EditShadowAssignmentForm = ({
2829
<div>
2930
<FormBox
3031
title={
31-
<FormattedMessage
32-
id="app.editShadowAssignment.titleName"
33-
defaultMessage="Edit Shadow Assignment — {name}"
34-
values={{
35-
name: <LocalizedExerciseName entity={shadowAssignment} />,
36-
}}
37-
/>
32+
safeGet(shadowAssignment, ['localizedTexts'], []).filter(lt => lt._enabled && lt.name).length > 0 ? (
33+
<FormattedMessage
34+
id="app.editShadowAssignment.titleName"
35+
defaultMessage="Edit Shadow Assignment — {name}"
36+
values={{
37+
name: <LocalizedExerciseName entity={shadowAssignment} />,
38+
}}
39+
/>
40+
) : (
41+
<FormattedMessage id="app.editShadowAssignment.title" defaultMessage="Edit Shadow Assignment" />
42+
)
3843
}
3944
successful={submitSucceeded}
4045
dirty={dirty}

src/pages/GroupDetail/GroupDetail.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ const mapStateToProps = (
436436

437437
const mapDispatchToProps = (dispatch, { match: { params } }) => ({
438438
loadAsync: () => GroupDetail.loadAsync(params, dispatch),
439-
createShadowAssignment: () => dispatch(createShadowAssignment({ groupId: params.groupId })),
439+
createShadowAssignment: () => dispatch(createShadowAssignment(params.groupId)),
440440
createGroupExercise: () => dispatch(createExercise({ groupId: params.groupId })),
441441
});
442442

0 commit comments

Comments
 (0)