Skip to content

Commit

Permalink
Don't include translations if they are all blank
Browse files Browse the repository at this point in the history
  • Loading branch information
ericnewcomer committed Mar 6, 2024
1 parent 6c9a6ca commit 72132d9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
18 changes: 14 additions & 4 deletions src/components/flow/actions/localization/MsgLocalizationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,20 @@ export default class MsgLocalizationForm extends React.Component<
Object.keys(this.state.params).forEach((key: any) => {
const component = components.find((c: any) => c.name === key);

Check warning on line 137 in src/components/flow/actions/localization/MsgLocalizationForm.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/flow/actions/localization/MsgLocalizationForm.tsx#L136-L137

Added lines #L136 - L137 were not covered by tests
if (component) {
localizations.push({
uuid: component.uuid,
translations: { params: this.state.params[key] }
});
const params = this.state.params[key];

Check warning on line 139 in src/components/flow/actions/localization/MsgLocalizationForm.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/flow/actions/localization/MsgLocalizationForm.tsx#L139

Added line #L139 was not covered by tests

// if each string in params is empty string, set params to null
if (params.every((p: string) => p.trim() === '')) {
localizations.push({

Check warning on line 143 in src/components/flow/actions/localization/MsgLocalizationForm.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/flow/actions/localization/MsgLocalizationForm.tsx#L143

Added line #L143 was not covered by tests
uuid: component.uuid,
translations: null
});
} else {
localizations.push({

Check warning on line 148 in src/components/flow/actions/localization/MsgLocalizationForm.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/flow/actions/localization/MsgLocalizationForm.tsx#L148

Added line #L148 was not covered by tests
uuid: component.uuid,
translations: { params }
});
}
}
});
}
Expand Down
2 changes: 0 additions & 2 deletions src/components/flow/actions/sendmsg/SendMsgForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,9 @@ import SelectElement, { SelectOption } from 'components/form/select/SelectElemen
import TextInputElement from 'components/form/textinput/TextInputElement';
import TypeList from 'components/nodeeditor/TypeList';
import { fakePropType } from 'config/ConfigProvider';
// import { fetchAsset } from 'external';
import { TemplateTranslation } from 'flowTypes';
import mutate from 'immutability-helper';
import * as React from 'react';
// import { Asset } from 'store/flowContext';
import {
FormState,
mergeForm,
Expand Down

0 comments on commit 72132d9

Please sign in to comment.