Merge pull request #2889 from overleaf/jpa-ns-disable-spell-check-at-runtime

[misc] disable spellcheck for unsupported languages at runtime

GitOrigin-RevId: 4214981930992abac054e78ce138adacaa99b801
This commit is contained in:
Hugh O'Brien 2020-06-09 09:36:50 +01:00 committed by Copybot
parent cedb075b34
commit f024483aa0

View file

@ -29,6 +29,28 @@ module.exports = {
_nameIsAcceptableLength
}
const unsupportedSpellcheckLanguages = [
'am',
'hy',
'bn',
'gu',
'he',
'hi',
'hu',
'is',
'kn',
'ml',
'mr',
'or',
'ss',
'ta',
'te',
'uk',
'uz',
'zu',
'fi'
]
async function joinProject(req, res, next) {
const projectId = req.params.Project_id
let userId = req.query.user_id
@ -53,6 +75,14 @@ async function joinProject(req, res, next) {
if (project.deletedByExternalDataSource) {
await ProjectDeleter.promises.unmarkAsDeletedByExternalSource(projectId)
}
// disable spellchecking for currently unsupported spell check languages
// preserve the value in the db so they can use it again once we add back
// support.
if (
unsupportedSpellcheckLanguages.indexOf(project.spellCheckLanguage) !== -1
) {
project.spellCheckLanguage = ''
}
res.json({
project,
privilegeLevel,