Skip to content

Commit

Permalink
Merge pull request #43 from glific/feature/expression-attachment
Browse files Browse the repository at this point in the history
Added expression in attachment
  • Loading branch information
mdshamoon authored Jul 15, 2021
2 parents ca97921 + 57f4e40 commit 5f7845b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@glific/flow-editor",
"license": "AGPL-3.0",
"repository": "git://github.com/glific/floweditor.git",
"version": "1.13.9-7",
"version": "1.13.9-8",
"description": "'Standalone flow editing tool designed for use within the Glific suite of messaging tools'",
"browser": "umd/flow-editor.min.js",
"unpkg": "umd/flow-editor.min.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ export default class MsgLocalizationForm extends React.Component<
private handleAttachmentChanged(index: number, type: string, url: string) {
let attachments: any = this.state.attachments;

if (type && url) {
const isExpression = type === 'expression';

if (type && !isExpression && url) {
window.clearTimeout(this.timeout);
this.timeout = setTimeout(() => {
validateURL(this.props.assetStore.validateMedia.endpoint, attachments[0], this);
Expand All @@ -196,7 +198,7 @@ export default class MsgLocalizationForm extends React.Component<
} else {
attachments = mutate(attachments, {
[index]: {
$set: { type, url, valid: true }
$set: { type, url, valid: !isExpression }
}
});
}
Expand Down
6 changes: 4 additions & 2 deletions src/components/flow/actions/sendmsg/SendMsgForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,9 @@ export default class SendMsgForm extends React.Component<ActionFormProps, SendMs
private handleAttachmentChanged(index: number, type: string, url: string) {
let attachments: any = this.state.attachments;

if (type && url) {
const isExpression = type === 'expression';

if (type && !isExpression && url) {
window.clearTimeout(this.timeout);
this.timeout = setTimeout(() => {
validateURL(this.props.assetStore.validateMedia.endpoint, attachments[0], this);
Expand All @@ -323,7 +325,7 @@ export default class SendMsgForm extends React.Component<ActionFormProps, SendMs
} else {
attachments = mutate(attachments, {
[index]: {
$set: { type, url, valid: true }
$set: { type, url, valid: !isExpression }
}
});
}
Expand Down
3 changes: 2 additions & 1 deletion src/components/flow/actions/sendmsg/attachments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const TYPE_OPTIONS: SelectOption[] = [
{ value: 'image', name: i18n.t('forms.image_url', 'Image URL') },
{ value: 'audio', name: i18n.t('forms.audio_url', 'Audio URL') },
{ value: 'video', name: i18n.t('forms.video_url', 'Video URL') },
{ value: 'document', name: i18n.t('forms.pdf_url', 'PDF Document URL') }
{ value: 'document', name: i18n.t('forms.pdf_url', 'PDF Document URL') },
{ value: 'expression', name: i18n.t('forms.expression', 'Expression') }
];

const NEW_TYPE_OPTIONS = TYPE_OPTIONS.concat([
Expand Down

0 comments on commit 5f7845b

Please sign in to comment.