Skip to content

Commit

Permalink
Merge pull request #1196 from nyaruka/localized-attachments
Browse files Browse the repository at this point in the history
Localized attachments
  • Loading branch information
ericnewcomer authored Sep 12, 2023
2 parents a64b118 + ad0a1ff commit 76b2912
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,6 @@ export default class MsgLocalizationForm extends React.Component<
const attachments: any = mutate(this.state.attachments, {
$push: [{ type: response.data.type, url: response.data.url, uploaded: true }]
});
console.log(attachments);
this.setState({ attachments });

const uploadError: string = '';
Expand Down
5 changes: 4 additions & 1 deletion src/services/Localization.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { Action, Case, Category, Language, MsgTemplating } from 'flowTypes';
import { Asset } from 'store/flowContext';

// list of keys that should always be treated as an array
const ARRAY_KEYS = ['attachments'];

export class LocalizedObject {
public localizedKeys: { [key: string]: boolean } = {};

Expand Down Expand Up @@ -40,7 +43,7 @@ export class LocalizedObject {
this.localized = true;
}

if (Array.isArray(this.localizedObject[key])) {
if (Array.isArray(this.localizedObject[key]) || ARRAY_KEYS.includes(key)) {
this.localizedObject[key] = value;
} else {
if (value.length === 1) {
Expand Down
6 changes: 0 additions & 6 deletions src/temba/TembaSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,12 +165,6 @@ export default class TembaSelect extends React.Component<TembaSelectProps, Temba
}
return result;
});

resolved.forEach((option: any) => {
if (!option) {
throw new Error('No option found for selection');
}
});
}

if (this.props.onChange) {
Expand Down

0 comments on commit 76b2912

Please sign in to comment.