Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/components/PushAudienceDialog/PushAudienceDialog.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export default class PushAudienceDialog extends React.Component {
audienceName: '',
audienceSize: undefined,
approximate: false,
errorMessage: undefined,
};
}

Expand Down Expand Up @@ -91,6 +92,10 @@ export default class PushAudienceDialog extends React.Component {
}

handleAddCondition() {
if (!this.props.schema || !Object.keys(this.props.schema).length) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NO NEED TO CHANGE, but whenever I see something like this, I change it to:

!(this.props.schema && Object.keys(this.props.schema).length)

it's easier for ME to read (ymmv)

this.setState({ errorMessage: 'You first need to create the Installation class before adding conditions to an audience.' });
return;
}
let available = Filters.availableFilters(this.props.schema, this.state.filters);
let field = Object.keys(available)[0];
this.setState(({ filters }) => ({
Expand Down Expand Up @@ -258,9 +263,9 @@ export default class PushAudienceDialog extends React.Component {
</div>
{futureUseSegment}
<FormNote
show={Boolean(this.props.errorMessage && this.props.errorMessage.length > 0)}
show={Boolean((this.props.errorMessage && this.props.errorMessage.length > 0) || (this.state.errorMessage && this.state.errorMessage.length > 0))}
color='red' >
{this.props.errorMessage}
{this.props.errorMessage || this.state.errorMessage}
</FormNote>
</Modal>
);
Expand Down