Merge pull request #3264 from overleaf/jpa-translations-cleanup

[ExpressLocals] drop support for htmlEncoding the translate content

GitOrigin-RevId: d70621dadda96feee0db9e424db368f9197a2162
This commit is contained in:
Hugh O'Brien 2020-10-07 11:48:47 +01:00 committed by Copybot
parent 22046266e1
commit 372a9323ba
4 changed files with 4 additions and 23 deletions

View file

@ -3,7 +3,6 @@ const Settings = require('settings-sharelatex')
const querystring = require('querystring')
const _ = require('lodash')
const Url = require('url')
const NodeHtmlEncoder = require('node-html-encoder').Encoder
const Path = require('path')
const moment = require('moment')
@ -14,8 +13,6 @@ const AuthenticationController = require('../Features/Authentication/Authenticat
const PackageVersions = require('./PackageVersions')
const Modules = require('./Modules')
const htmlEncoder = new NodeHtmlEncoder('numerical')
let webpackManifest
if (!IS_DEV_ENV) {
// Only load webpack manifest file in production. In dev, the web and webpack
@ -179,20 +176,10 @@ module.exports = function(webRouter, privateApiRouter, publicApiRouter) {
})
webRouter.use(function(req, res, next) {
res.locals.translate = function(key, vars, htmlEncode) {
if (vars == null) {
vars = {}
}
if (htmlEncode == null) {
htmlEncode = false
}
res.locals.translate = function(key, vars) {
vars = vars || {}
vars.appName = Settings.appName
const str = req.i18n.translate(key, vars)
if (htmlEncode) {
return htmlEncoder.htmlEncode(str)
} else {
return str
}
return req.i18n.translate(key, vars)
}
// Don't include the query string parameters, otherwise Google
// treats ?nocdn=true as the canonical version

View file

@ -105,7 +105,7 @@ div.full-size(
i.synctex-control-icon(ng-show="!syncToPdfInFlight")
i.synctex-spin-icon.fa.fa-refresh.fa-spin(ng-show="syncToPdfInFlight")
a.btn.btn-default.btn-xs.synctex-control.synctex-control-goto-code(
tooltip-html="'"+translate('go_to_pdf_location_in_code', {}, true)+"'"
tooltip=translate('go_to_pdf_location_in_code')
tooltip-placement="right"
tooltip-append-to-body="true"
ng-click="syncToCode()"

View file

@ -24675,11 +24675,6 @@
"resolved": "https://registry.npmjs.org/node-gyp-build/-/node-gyp-build-3.7.0.tgz",
"integrity": "sha512-L/Eg02Epx6Si2NXmedx+Okg+4UHqmaf3TNcxd50SF9NQGcJaON3AtU++kax69XV7YWz4tUspqZSAsVofhFKG2w=="
},
"node-html-encoder": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/node-html-encoder/-/node-html-encoder-0.0.2.tgz",
"integrity": "sha512-ZiuSweV3goJorYOkG7FFApxq/BPkiSVIBwQqR/tiDBq8y7Ty2GQ4OOmckgSSHSQXhBoB6RcpeXF6Yn84PoLKiQ=="
},
"node-int64": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz",

View file

@ -101,7 +101,6 @@
"mongoose": "^4.13.19",
"multer": "git+https://github.com/overleaf/multer.git",
"nocache": "^2.1.0",
"node-html-encoder": "0.0.2",
"nodemailer": "2.1.0",
"nodemailer-mandrill-transport": "^1.2.0",
"nodemailer-ses-transport": "^1.5.1",