diff --git a/src/components/CampaignDynamicAssignmentForm.jsx b/src/components/CampaignDynamicAssignmentForm.jsx index 851194641..7e50dff05 100644 --- a/src/components/CampaignDynamicAssignmentForm.jsx +++ b/src/components/CampaignDynamicAssignmentForm.jsx @@ -2,7 +2,7 @@ import type from "prop-types"; import React from "react"; import GSForm from "../components/forms/GSForm"; import GSSubmitButton from "../components/forms/GSSubmitButton"; -import GSIntegerField from "../components/forms/GSIntegerField" +import GSIntegerField from "../components/forms/GSIntegerField"; import GSTextField from "../components/forms/GSTextField"; import * as yup from "yup"; import Form from "react-formal"; @@ -54,7 +54,11 @@ class CampaignDynamicAssignmentForm extends React.Component { render() { const { joinToken, campaignId, organization } = this.props; - const { useDynamicAssignment, batchPolicies, useDynamicReplies } = this.state; + const { + useDynamicAssignment, + batchPolicies, + useDynamicReplies + } = this.state; const unselectedPolicies = organization.batchPolicies .filter(p => !batchPolicies.find(cur => cur === p)) .map(p => ({ id: p, name: p })); @@ -74,7 +78,7 @@ class CampaignDynamicAssignmentForm extends React.Component { label="Allow texters with a link to join and start texting when the campaign is started?" labelPlacement="start" /> -
+

How long (in hours) before we should consider reassignment without @@ -136,51 +140,49 @@ class CampaignDynamicAssignmentForm extends React.Component { hours for slower campaigns or 2 hours or less for GOTV campaigns.

{ - console.log(toggler, val); - this.toggleChange("useDynamicReplies", val); - }} + control={ + { + console.log(toggler, val); + this.toggleChange("useDynamicReplies", val); + }} + /> + } + label="Allow texters with a link to dynamically get assigned replies?" + labelPlacement="start" /> - } - label="Allow texters with a link to dynamically get assigned replies?" - labelPlacement="start" - /> - {!useDynamicReplies ? null : ( -
-
    -
  • - {joinToken ? ( - - ) : ( - "Please save the campaign and reload the page to get the reply link to share with texters." - )} -
  • -
  • - You can turn off dynamic assignment after starting a campaign - to disallow more new texters to receive replies. -
  • -
- - -
- ) + {!useDynamicReplies ? null : ( +
+
    +
  • + {joinToken ? ( + + ) : ( + "Please save the campaign and reload the page to get the reply link to share with texters." + )} +
  • +
  • + You can turn off dynamic assignment after starting a + campaign to disallow more new texters to receive replies. +
  • +
- } + +
+ )} {organization.batchPolicies.length > 1 ? (

Batch Strategy

diff --git a/src/components/forms/GSIntegerField.jsx b/src/components/forms/GSIntegerField.jsx index 3bcc11d9b..fc674712c 100644 --- a/src/components/forms/GSIntegerField.jsx +++ b/src/components/forms/GSIntegerField.jsx @@ -72,7 +72,7 @@ export default class GSIntegerField extends GSFormField { style }; // can't be undefined or react throw uncontroled component error - if (!textFieldProps.value) { + if (textFieldProps.value !== 0 && !textFieldProps.value) { textFieldProps.value = ""; } textFieldProps.style = Object.assign( @@ -96,8 +96,8 @@ export default class GSIntegerField extends GSFormField { onChange={event => { onChange(Number(event.target.value)); }} - type="number" + type="Number" /> ); } -} \ No newline at end of file +} diff --git a/src/server/api/campaign.js b/src/server/api/campaign.js index 825213fa2..4aa78ea5b 100644 --- a/src/server/api/campaign.js +++ b/src/server/api/campaign.js @@ -352,7 +352,7 @@ export const resolvers = { const features = getFeatures(campaign); return features.USE_DYNAMIC_REPLIES ? features.USE_DYNAMIC_REPLIES : false; }, - responseWindow: campaign => campaign.response_window || 48, + responseWindow: campaign => campaign.response_window != null ? campaign.response_window : 48, organization: async (campaign, _, { loaders }) => campaign.organization || loaders.organization.load(campaign.organization_id), diff --git a/src/server/api/schema.js b/src/server/api/schema.js index 86730b90a..6b17e3253 100644 --- a/src/server/api/schema.js +++ b/src/server/api/schema.js @@ -898,8 +898,9 @@ const rootMutations = { campaign.batch_size || Number(getConfig("DEFAULT_BATCHSIZE", organization) || 300), response_window: - campaign.response_window || - Number(getConfig("DEFAULT_RESPONSEWINDOW", organization) || 48), + campaign.response_window != null + ? campaign.response_window + : Number(getConfig("DEFAULT_RESPONSEWINDOW", organization) || 48), is_started: false, is_archived: false, join_token: uuidv4()