Skip to content

Commit

Permalink
feat: Add a flag around the attribute migration feature...
Browse files Browse the repository at this point in the history
...to avoid regressions before the migration script is ready
  • Loading branch information
Merkur39 committed Mar 17, 2023
1 parent ab3f6a3 commit 93790ce
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 10 deletions.
3 changes: 2 additions & 1 deletion react/Viewer/Panel/QualificationListItemInformation.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { forwardRef } from 'react'
import PropTypes from 'prop-types'

import { getBoundT } from 'cozy-client/dist/models/document/locales'
import flag from 'cozy-flags'

import ListItem from '../../MuiCozyTheme/ListItem'
import ListItemSecondaryAction from '../../MuiCozyTheme/ListItemSecondaryAction'
Expand Down Expand Up @@ -39,7 +40,7 @@ const QualificationListItemInformation = forwardRef(

const currentValue = makeInformationValue({ name, value, t, scannerT })
const title =
name === 'number'
name === 'number' && flag('mespapiers.migrated.metadata') // TODO Remove duplicate translations when remove this flag
? t(
`Viewer.panel.qualification.information.title.${qualificationLabel}.${name}`
)
Expand Down
25 changes: 18 additions & 7 deletions react/Viewer/helpers.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { models } from 'cozy-client'
import flag from 'cozy-flags'

const {
isEncrypted,
isFromKonnector,
Expand All @@ -19,13 +21,22 @@ export const knownDateMetadataNames = [
'date',
'datetime'
]
export const knownInformationMetadataNames = [
'number',
'country',
'refTaxIncome',
'contractType',
'noticePeriod'
]
export const knownInformationMetadataNames = flag(
'mespapiers.migrated.metadata'
)
? ['number', 'country', 'refTaxIncome', 'contractType', 'noticePeriod']
: [
'number',
'cafFileNumber',
'cardNumber',
'vinNumber',
'ibanNumber',
'country',
'passportNumber',
'refTaxIncome',
'contractType',
'noticePeriod'
]
export const knownOtherMetadataNames = ['contact', 'page', 'qualification']

export const getCurrentModel = metadataName => {
Expand Down
9 changes: 8 additions & 1 deletion react/Viewer/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,14 @@
"country": "Country of delivery",
"refTaxIncome": "Reference tax income",
"contractType": "Contract type",
"noticePeriod": "Expiration alert"
"noticePeriod": "Expiration alert",

"number": "License number",
"cafFileNumber": "CAF file number",
"cardNumber": "National ID card number",
"vinNumber": "Vehicle registration number (VIN)",
"ibanNumber": "IBAN number",
"passportNumber": "Passport number"
},
"day": "day |||| days"
},
Expand Down
9 changes: 8 additions & 1 deletion react/Viewer/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,14 @@
"country": "Pays de délivrance",
"refTaxIncome": "Revenu fiscal de référence",
"contractType": "Type de contat",
"noticePeriod": "Alerte d’expiration"
"noticePeriod": "Alerte d’expiration",

"number": "Numéro du permis",
"cafFileNumber": "Numéro de dossier CAF",
"cardNumber": "Numéro de la carte d'identité",
"vinNumber": "Numéro de la carte grise (VIN)",
"ibanNumber": "Numéro d'IBAN",
"passportNumber": "Numéro du passeport"
},
"day": "jour |||| jours"
},
Expand Down

0 comments on commit 93790ce

Please sign in to comment.