Skip to content

Commit

Permalink
Merge pull request #1214 from nyaruka/ticket_body_optional
Browse files Browse the repository at this point in the history
Make body optional on open ticket actions
  • Loading branch information
ericnewcomer authored Jan 4, 2024
2 parents 0a17ab1 + 04be869 commit 92d6a68
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 14 deletions.
8 changes: 3 additions & 5 deletions src/components/flow/routers/ticket/TicketRouterForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,7 @@ export default class TicketRouterForm extends React.Component<
}

if (keys.hasOwnProperty('body')) {
updates.body = validate(i18n.t('forms.body', 'Body'), keys.body, [
shouldRequireIf(submitting)
]);
updates.body = validate(i18n.t('forms.body', 'Body'), keys.body, []);
}

if (keys.hasOwnProperty('resultName')) {
Expand Down Expand Up @@ -172,7 +170,7 @@ export default class TicketRouterForm extends React.Component<
<TembaSelect
key="select_assignee"
name={i18n.t('forms.assignee', 'Assignee')}
placeholder="Assign to (Optional)"
placeholder="Assign to (optional)"
valueKey="email"
endpoint={this.context.config.endpoints.users}
onChange={this.handleAssigneeUpdate}
Expand All @@ -190,7 +188,7 @@ export default class TicketRouterForm extends React.Component<
<div className={styles.body}>
<TextInputElement
name={i18n.t('forms.body', 'Body')}
placeholder={i18n.t('forms.enter_a_body', 'Enter a body')}
placeholder={i18n.t('forms.enter_a_body', 'Enter a body (optional)')}
entry={this.state.body}
onChange={this.handleBodyUpdate}
autocomplete={true}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ exports[`TicketRouterForm render should render 1`] = `
expressions=""
name="Assignee"
namekey="name"
placeholder="Assign to (Optional)"
placeholder="Assign to (optional)"
valuekey="email"
values="[]"
/>
Expand All @@ -107,7 +107,7 @@ exports[`TicketRouterForm render should render 1`] = `
<input
data-testid="Body"
name="Body"
placeholder="Enter a body"
placeholder="Enter a body (optional)"
value="Where are my cookies"
/>
</div>
Expand Down Expand Up @@ -267,7 +267,7 @@ exports[`TicketRouterForm updates should save changes 1`] = `
expressions=""
name="Assignee"
namekey="name"
placeholder="Assign to (Optional)"
placeholder="Assign to (optional)"
valuekey="email"
values="[]"
/>
Expand All @@ -286,7 +286,7 @@ exports[`TicketRouterForm updates should save changes 1`] = `
<input
data-testid="Body"
name="Body"
placeholder="Enter a body"
placeholder="Enter a body (optional)"
value="Where are my cookies"
/>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/components/flow/routers/ticket/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ export const getOriginalAction = (settings: NodeEditorSettings): OpenTicket => {

export const nodeToState = (settings: NodeEditorSettings): TicketRouterFormState => {
let subject = { value: '@run.flow.name' };
let body = { value: '@results' };
let resultName = { value: 'Result' };
let body = { value: '' };
let resultName = { value: '' };
let assignee: FormEntry = { value: null };
let topic: FormEntry = { value: null };

Expand Down
2 changes: 1 addition & 1 deletion src/config/i18n/defaults.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
"email_recipient_name": "Recipient",
"email_recipient_placeholder": "To",
"email_recipient_prompt": "Enter email address",
"enter_a_body": "Enter a body",
"enter_a_body": "Enter a body (optional)",
"enter_a_subject": "Enter a subject",
"enter_a_url": "Enter a URL",
"enter_field_value": "Enter a new value for [[field]]",
Expand Down
2 changes: 1 addition & 1 deletion src/config/i18n/es/resource.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
"email_recipient_name": "Destinatario",
"email_recipient_placeholder": "Para",
"email_recipient_prompt": "Introducir la dirección de correo electrónico",
"enter_a_body": "Introducir cuerpo",
"enter_a_body": "Introducir cuerpo (opcional)",
"enter_a_subject": "Introducir asunto",
"enter_a_url": "Introducir URL",
"enter_field_value": "Ingrese un nuevo valor para [[field]]",
Expand Down
2 changes: 1 addition & 1 deletion src/flowTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ export interface CallWebhook extends Action {
export interface OpenTicket extends Action {
subject?: string;
topic?: Topic;
body: string;
body?: string;
result_name: string;
assignee?: User;
}
Expand Down

0 comments on commit 92d6a68

Please sign in to comment.