Merge pull request #74 from overleaf/jpa-ignored-misspellings-via-env

[SpellingAPIManager] get the list of ignored misspellings from settings
This commit is contained in:
Jakob Ackermann 2020-10-09 12:27:03 +02:00 committed by GitHub
commit 9dd64cd824
3 changed files with 16 additions and 1 deletions

View file

@ -10,12 +10,13 @@ const ASpell = require('./ASpell')
const LearnedWordsManager = require('./LearnedWordsManager')
const { callbackify } = require('util')
const OError = require('@overleaf/o-error')
const Settings = require('settings-sharelatex')
// The max number of words checked in a single request
const REQUEST_LIMIT = 10000
const SpellingAPIManager = {
whitelist: ['ShareLaTeX', 'sharelatex', 'LaTeX', 'http', 'https', 'www'],
whitelist: Settings.ignoredMisspellings,
learnWord(token, request, callback) {
if (callback == null) {

View file

@ -22,6 +22,19 @@ module.exports = {
healthCheckUserId: '53c64d2fd68c8d000010bb5f',
ignoredMisspellings: process.env.IGNORED_MISSPELLINGS
? process.env.IGNORED_MISSPELLINGS.split(',')
: [
'Overleaf',
'overleaf',
'ShareLaTeX',
'sharelatex',
'LaTeX',
'http',
'https',
'www'
],
sentry: {
dsn: process.env.SENTRY_DSN
}

View file

@ -30,6 +30,7 @@ describe('SpellingAPIManager', function () {
this.SpellingAPIManager = SandboxedModule.require(modulePath, {
requires: {
'./ASpell': this.ASpell,
'settings-sharelatex': { ignoredMisspellings: ['ShareLaTeX'] },
'./LearnedWordsManager': this.LearnedWordsManager
}
})