Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Commit

Permalink
feat: checks if language with requested codneame exists before updati…
Browse files Browse the repository at this point in the history
…ng language codename
  • Loading branch information
Enngage committed May 11, 2020
1 parent 24a1d27 commit aac1389
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/import/import.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,17 +267,21 @@ export class ImportService {
`Default language '${importLanguage.name}' with codename '${importLanguage.codename}' does not match default language in target project. Changing language codename in target project from '${defaultExistingLanguage.codename}' codename to '${importLanguage.codename}'`
);

await this.client
.modifyLanguage()
.byLanguageCodename(defaultExistingLanguage.codename)
.withData([
{
op: 'replace',
property_name: 'codename',
value: importLanguage.codename
}
])
.toPromise();
// check if language with imported codename exists
if (!currentLanguages.find(m => m.codename === importLanguage.codename)) {
// language with required codename does not exist, update it
await this.client
.modifyLanguage()
.byLanguageCodename(defaultExistingLanguage.codename)
.withData([
{
op: 'replace',
property_name: 'codename',
value: importLanguage.codename
}
])
.toPromise();
}
}
}
}
Expand Down

0 comments on commit aac1389

Please sign in to comment.