Merge pull request #9918 from overleaf/ii-dashboard-prevent-double-escape

[web] Project dashboard prevent double escape of user name

GitOrigin-RevId: be32c185438aabfc96a403e609ee9c612a9e4035
This commit is contained in:
Alasdair Smith 2022-10-11 09:36:24 +01:00 committed by Copybot
parent 980b62aa39
commit 8a173a000e
3 changed files with 25 additions and 19 deletions

24
package-lock.json generated
View file

@ -16366,7 +16366,8 @@
"node_modules/html-escaper": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz",
"integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg=="
"integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==",
"dev": true
},
"node_modules/html-minifier-terser": {
"version": "6.1.0",
@ -25141,12 +25142,11 @@
}
},
"node_modules/react-i18next": {
"version": "11.15.3",
"resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-11.15.3.tgz",
"integrity": "sha512-RSUEM4So3Tu2JHV0JsZ5Yje+4nz66YViMfPZoywxOy0xyn3L7tE2CHvJ7Y9LUsrTU7vGmZ5bwb8PpjnkatdIxg==",
"version": "11.18.6",
"resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-11.18.6.tgz",
"integrity": "sha512-yHb2F9BiT0lqoQDt8loZ5gWP331GwctHz9tYQ8A2EIEUu+CcEdjBLQWli1USG3RdWQt3W+jqQLg/d4rrQR96LA==",
"dependencies": {
"@babel/runtime": "^7.14.5",
"html-escaper": "^2.0.2",
"html-parse-stringify": "^3.0.1"
},
"peerDependencies": {
@ -35058,7 +35058,7 @@
"react-dnd-html5-backend": "^11.1.3",
"react-dom": "^17.0.2",
"react-error-boundary": "^2.3.1",
"react-i18next": "^11.7.1",
"react-i18next": "^11.18.6",
"react-linkify": "^1.0.0-alpha",
"react-refresh": "^0.14.0",
"react2angular": "^4.0.6",
@ -42844,7 +42844,7 @@
"react-dnd-html5-backend": "^11.1.3",
"react-dom": "^17.0.2",
"react-error-boundary": "^2.3.1",
"react-i18next": "^11.7.1",
"react-i18next": "11.18.6",
"react-linkify": "^1.0.0-alpha",
"react-refresh": "^0.14.0",
"react2angular": "^4.0.6",
@ -53808,7 +53808,8 @@
"html-escaper": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz",
"integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg=="
"integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==",
"dev": true
},
"html-minifier-terser": {
"version": "6.1.0",
@ -61122,12 +61123,11 @@
}
},
"react-i18next": {
"version": "11.15.3",
"resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-11.15.3.tgz",
"integrity": "sha512-RSUEM4So3Tu2JHV0JsZ5Yje+4nz66YViMfPZoywxOy0xyn3L7tE2CHvJ7Y9LUsrTU7vGmZ5bwb8PpjnkatdIxg==",
"version": "11.18.6",
"resolved": "https://registry.npmjs.org/react-i18next/-/react-i18next-11.18.6.tgz",
"integrity": "sha512-yHb2F9BiT0lqoQDt8loZ5gWP331GwctHz9tYQ8A2EIEUu+CcEdjBLQWli1USG3RdWQt3W+jqQLg/d4rrQR96LA==",
"requires": {
"@babel/runtime": "^7.14.5",
"html-escaper": "^2.0.2",
"html-parse-stringify": "^3.0.1"
}
},

View file

@ -1,4 +1,4 @@
import { useTranslation } from 'react-i18next'
import { Trans } from 'react-i18next'
import { formatDate, fromNowDate } from '../../../../../utils/dates'
import { Project } from '../../../../../../../types/project/dashboard/api'
import Tooltip from '../../../../../shared/components/tooltip'
@ -9,13 +9,19 @@ type LastUpdatedCellProps = {
}
export default function LastUpdatedCell({ project }: LastUpdatedCellProps) {
const { t } = useTranslation()
const displayText = project.lastUpdatedBy
? t('last_updated_date_by_x', {
const displayText = project.lastUpdatedBy ? (
<Trans
i18nKey="last_updated_date_by_x"
values={{
lastUpdatedDate: fromNowDate(project.lastUpdated),
person: getUserName(project.lastUpdatedBy),
})
: fromNowDate(project.lastUpdated)
}}
shouldUnescape
/>
) : (
fromNowDate(project.lastUpdated)
)
const tooltipText = formatDate(project.lastUpdated)
return (
<Tooltip

View file

@ -197,7 +197,7 @@
"react-dnd-html5-backend": "^11.1.3",
"react-dom": "^17.0.2",
"react-error-boundary": "^2.3.1",
"react-i18next": "^11.7.1",
"react-i18next": "^11.18.6",
"react-linkify": "^1.0.0-alpha",
"react-refresh": "^0.14.0",
"react2angular": "^4.0.6",