mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-20 17:55:55 +00:00
Merge pull request #3949 from overleaf/msm-reenable-eslint-const-rule
Reenable eslint `prefer-const` rule GitOrigin-RevId: 4f3825be8b8dff381095209085a36eaab76260d5
This commit is contained in:
parent
0874fcb8ca
commit
f9871103bf
129 changed files with 353 additions and 358 deletions
|
@ -43,7 +43,6 @@
|
|||
// TODO: re-enable and fix
|
||||
"no-prototype-builtins": "off",
|
||||
"no-var": "off",
|
||||
"prefer-const": "off",
|
||||
"array-callback-return": "off",
|
||||
"no-unreachable-loop": "off",
|
||||
"no-loss-of-precision": "off",
|
||||
|
|
|
@ -187,7 +187,7 @@ const AuthenticationController = {
|
|||
if (!sessionUser) {
|
||||
return
|
||||
}
|
||||
for (let key in props) {
|
||||
for (const key in props) {
|
||||
const value = props[key]
|
||||
sessionUser[key] = value
|
||||
}
|
||||
|
@ -362,7 +362,7 @@ const AuthenticationController = {
|
|||
},
|
||||
|
||||
httpAuth: basicAuth(function (user, pass) {
|
||||
let expectedPassword = Settings.httpAuthUsers[user]
|
||||
const expectedPassword = Settings.httpAuthUsers[user]
|
||||
const isValid =
|
||||
expectedPassword &&
|
||||
expectedPassword.length === pass.length &&
|
||||
|
@ -499,7 +499,7 @@ function _afterLoginSessionSetup(req, user, callback) {
|
|||
req.sessionStore.generate(req)
|
||||
// Note: the validation token is not writable, so it does not get
|
||||
// transferred to the new session below.
|
||||
for (let key in oldSession) {
|
||||
for (const key in oldSession) {
|
||||
const value = oldSession[key]
|
||||
if (key !== '__tmp' && key !== 'csrfSecret') {
|
||||
req.session[key] = value
|
||||
|
|
|
@ -86,7 +86,7 @@ async function getInvitedMembersWithPrivilegeLevelsFromFields(
|
|||
collaboratorIds,
|
||||
readOnlyIds
|
||||
) {
|
||||
let members = _getMemberIdsWithPrivilegeLevelsFromFields(
|
||||
const members = _getMemberIdsWithPrivilegeLevelsFromFields(
|
||||
ownerId,
|
||||
collaboratorIds,
|
||||
readOnlyIds,
|
||||
|
|
|
@ -651,7 +651,7 @@ const ClsiManager = {
|
|||
)
|
||||
}
|
||||
const docs = {}
|
||||
for (let doc of docUpdaterDocs || []) {
|
||||
for (const doc of docUpdaterDocs || []) {
|
||||
const path = docPath[doc._id]
|
||||
docs[path] = doc
|
||||
}
|
||||
|
|
|
@ -59,7 +59,7 @@ module.exports = ClsiStateManager = {
|
|||
const optionsList = (() => {
|
||||
const result = []
|
||||
const object = options || {}
|
||||
for (let key in object) {
|
||||
for (const key in object) {
|
||||
const value = object[key]
|
||||
if (!['isAutoCompile'].includes(key)) {
|
||||
result.push(`option ${key}:${value}`)
|
||||
|
|
|
@ -526,7 +526,7 @@ module.exports = CompileController = {
|
|||
// do not send any others, there's a proxying loop if Host: is passed!
|
||||
if (req.query != null ? req.query.pdfng : undefined) {
|
||||
const newHeaders = {}
|
||||
for (let h in req.headers) {
|
||||
for (const h in req.headers) {
|
||||
const v = req.headers[h]
|
||||
if (/^(If-|Range)/i.test(h)) {
|
||||
newHeaders[h] = req.headers[h]
|
||||
|
|
|
@ -69,7 +69,7 @@ module.exports = CompileManager = {
|
|||
if (error != null) {
|
||||
return callback(error)
|
||||
}
|
||||
for (let key in limits) {
|
||||
for (const key in limits) {
|
||||
const value = limits[key]
|
||||
options[key] = value
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ module.exports = CompileManager = {
|
|||
if (error != null) {
|
||||
return callback(error)
|
||||
}
|
||||
let ownerFeatures = (owner && owner.features) || {}
|
||||
const ownerFeatures = (owner && owner.features) || {}
|
||||
// put alpha users into their own compile group
|
||||
if (owner && owner.alphaProgram) {
|
||||
ownerFeatures.compileGroup = 'alpha'
|
||||
|
|
|
@ -19,7 +19,7 @@ module.exports = DocumentHelper = {
|
|||
}
|
||||
const TITLE_WITH_CURLY_BRACES = /\\[tT]itle\*?\s*{([^}]+)}/
|
||||
const TITLE_WITH_SQUARE_BRACES = /\\[tT]itle\s*\[([^\]]+)\]/
|
||||
for (let line of Array.from(
|
||||
for (const line of Array.from(
|
||||
DocumentHelper._getLinesFromContent(content, maxContentToScan)
|
||||
)) {
|
||||
var match
|
||||
|
@ -39,7 +39,7 @@ module.exports = DocumentHelper = {
|
|||
if (maxContentToScan == null) {
|
||||
maxContentToScan = 30000
|
||||
}
|
||||
for (let line of Array.from(
|
||||
for (const line of Array.from(
|
||||
DocumentHelper._getLinesFromContent(content, maxContentToScan)
|
||||
)) {
|
||||
// We've had problems with this regex locking up CPU.
|
||||
|
|
|
@ -38,7 +38,7 @@ module.exports = ProjectZipStreamManager = {
|
|||
callback(null, archive)
|
||||
|
||||
const jobs = []
|
||||
for (let project_id of Array.from(project_ids || [])) {
|
||||
for (const project_id of Array.from(project_ids || [])) {
|
||||
;(project_id =>
|
||||
jobs.push(callback =>
|
||||
ProjectGetter.getProject(
|
||||
|
@ -123,7 +123,7 @@ module.exports = ProjectZipStreamManager = {
|
|||
return callback(error)
|
||||
}
|
||||
const jobs = []
|
||||
for (let path in docs) {
|
||||
for (const path in docs) {
|
||||
const doc = docs[path]
|
||||
;(function (path, doc) {
|
||||
if (path[0] === '/') {
|
||||
|
@ -151,7 +151,7 @@ module.exports = ProjectZipStreamManager = {
|
|||
return callback(error)
|
||||
}
|
||||
const jobs = []
|
||||
for (let path in files) {
|
||||
for (const path in files) {
|
||||
const file = files[path]
|
||||
;((path, file) =>
|
||||
jobs.push(callback =>
|
||||
|
|
|
@ -83,7 +83,7 @@ async function sendEmail(options) {
|
|||
throw new OError('rate limit hit sending email')
|
||||
}
|
||||
metrics.inc('email')
|
||||
let sendMailOptions = {
|
||||
const sendMailOptions = {
|
||||
to: options.to,
|
||||
from: EMAIL_SETTINGS.fromAddress || '',
|
||||
subject: options.subject,
|
||||
|
|
|
@ -168,7 +168,7 @@ var checkFeatures = function (institutionId, users) {
|
|||
},
|
||||
}
|
||||
users.forEach(function (user) {
|
||||
let isSSOEntitled = SAMLIdentityManager.userHasEntitlement(
|
||||
const isSSOEntitled = SAMLIdentityManager.userHasEntitlement(
|
||||
user,
|
||||
institutionId
|
||||
)
|
||||
|
|
|
@ -85,7 +85,7 @@ module.exports = MetaHandler = {
|
|||
const label_re = MetaHandler.labelRegex()
|
||||
const package_re = MetaHandler.usepackageRegex()
|
||||
const req_package_re = MetaHandler.ReqPackageRegex()
|
||||
for (let line of Array.from(lines)) {
|
||||
for (const line of Array.from(lines)) {
|
||||
var labelMatch
|
||||
var clean, messy, packageMatch
|
||||
while ((labelMatch = label_re.exec(line))) {
|
||||
|
@ -123,7 +123,7 @@ module.exports = MetaHandler = {
|
|||
|
||||
extractMetaFromProjectDocs(projectDocs) {
|
||||
const projectMeta = {}
|
||||
for (let _path in projectDocs) {
|
||||
for (const _path in projectDocs) {
|
||||
const doc = projectDocs[_path]
|
||||
projectMeta[doc._id] = MetaHandler.extractMetaFromDoc(doc.lines)
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ async function setNewUserPassword(req, res, next) {
|
|||
password,
|
||||
auditLog
|
||||
)
|
||||
let { found, reset, userId } = result
|
||||
const { found, reset, userId } = result
|
||||
if (!found) return res.sendStatus(404)
|
||||
if (!reset) return res.sendStatus(500)
|
||||
await UserSessionsManager.promises.revokeAllUserSessions(
|
||||
|
|
|
@ -113,7 +113,7 @@ module.exports = ProjectCollabratecDetailsHandler = {
|
|||
if (!Array.isArray(collabratec_users)) {
|
||||
callback(new Error('collabratec_users must be array'))
|
||||
}
|
||||
for (let collabratec_user of Array.from(collabratec_users)) {
|
||||
for (const collabratec_user of Array.from(collabratec_users)) {
|
||||
try {
|
||||
collabratec_user.user_id = ObjectId(collabratec_user.user_id)
|
||||
} catch (error1) {
|
||||
|
|
|
@ -1035,7 +1035,7 @@ const ProjectController = {
|
|||
affiliations = []
|
||||
}
|
||||
const portalTemplates = []
|
||||
for (let aff of affiliations) {
|
||||
for (const aff of affiliations) {
|
||||
if (
|
||||
aff.portal &&
|
||||
aff.portal.slug &&
|
||||
|
@ -1082,7 +1082,7 @@ function generateThemeList() {
|
|||
Path.join(__dirname, '/../../../../node_modules/ace-builds/src-noconflict')
|
||||
)
|
||||
const result = []
|
||||
for (let file of files) {
|
||||
for (const file of files) {
|
||||
if (file.slice(-2) === 'js' && /^theme-/.test(file)) {
|
||||
const cleanName = file.slice(0, -3).slice(6)
|
||||
result.push(THEME_LIST.push(cleanName))
|
||||
|
|
|
@ -111,7 +111,7 @@ async function restoreProject(projectId) {
|
|||
|
||||
async function archiveProject(projectId, userId) {
|
||||
try {
|
||||
let project = await Project.findOne({ _id: projectId }).exec()
|
||||
const project = await Project.findOne({ _id: projectId }).exec()
|
||||
if (!project) {
|
||||
throw new Errors.NotFoundError('project not found')
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ async function archiveProject(projectId, userId) {
|
|||
|
||||
async function unarchiveProject(projectId, userId) {
|
||||
try {
|
||||
let project = await Project.findOne({ _id: projectId }).exec()
|
||||
const project = await Project.findOne({ _id: projectId }).exec()
|
||||
if (!project) {
|
||||
throw new Errors.NotFoundError('project not found')
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ async function unarchiveProject(projectId, userId) {
|
|||
|
||||
async function trashProject(projectId, userId) {
|
||||
try {
|
||||
let project = await Project.findOne({ _id: projectId }).exec()
|
||||
const project = await Project.findOne({ _id: projectId }).exec()
|
||||
if (!project) {
|
||||
throw new Errors.NotFoundError('project not found')
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ async function trashProject(projectId, userId) {
|
|||
|
||||
async function untrashProject(projectId, userId) {
|
||||
try {
|
||||
let project = await Project.findOne({ _id: projectId }).exec()
|
||||
const project = await Project.findOne({ _id: projectId }).exec()
|
||||
if (!project) {
|
||||
throw new Errors.NotFoundError('project not found')
|
||||
}
|
||||
|
@ -279,7 +279,7 @@ async function deleteProject(projectId, options = {}) {
|
|||
|
||||
async function undeleteProject(projectId, options = {}) {
|
||||
projectId = ObjectId(projectId)
|
||||
let deletedProject = await DeletedProject.findOne({
|
||||
const deletedProject = await DeletedProject.findOne({
|
||||
'deleterData.deletedProjectId': projectId,
|
||||
}).exec()
|
||||
|
||||
|
@ -291,7 +291,7 @@ async function undeleteProject(projectId, options = {}) {
|
|||
throw new Errors.NotFoundError('project_too_old_to_restore')
|
||||
}
|
||||
|
||||
let restored = new Project(deletedProject.project)
|
||||
const restored = new Project(deletedProject.project)
|
||||
|
||||
if (options.userId) {
|
||||
restored.owner_ref = options.userId
|
||||
|
|
|
@ -100,7 +100,7 @@ module.exports = ProjectEditorHandler = {
|
|||
let owner = null
|
||||
let ownerFeatures = null
|
||||
const filteredMembers = []
|
||||
for (let member of Array.from(members || [])) {
|
||||
for (const member of Array.from(members || [])) {
|
||||
if (member.privilegeLevel === 'owner') {
|
||||
ownerFeatures = member.user.features
|
||||
owner = this.buildUserModelView(member.user, 'owner')
|
||||
|
|
|
@ -15,7 +15,7 @@ const ProjectEntityHandler = {
|
|||
|
||||
// Turn array from docstore into a dictionary based on doc id
|
||||
const docContents = {}
|
||||
for (let docContent of docContentsArray) {
|
||||
for (const docContent of docContentsArray) {
|
||||
docContents[docContent._id] = docContent
|
||||
}
|
||||
|
||||
|
@ -27,9 +27,9 @@ const ProjectEntityHandler = {
|
|||
return callback(error)
|
||||
}
|
||||
const docs = {}
|
||||
for (let folderPath in folders) {
|
||||
for (const folderPath in folders) {
|
||||
const folder = folders[folderPath]
|
||||
for (let doc of folder.docs || []) {
|
||||
for (const doc of folder.docs || []) {
|
||||
const content = docContents[doc._id.toString()]
|
||||
if (content != null) {
|
||||
docs[path.join(folderPath, doc.name)] = {
|
||||
|
@ -56,9 +56,9 @@ const ProjectEntityHandler = {
|
|||
return callback(err)
|
||||
}
|
||||
const files = {}
|
||||
for (let folderPath in folders) {
|
||||
for (const folderPath in folders) {
|
||||
const folder = folders[folderPath]
|
||||
for (let file of folder.fileRefs || []) {
|
||||
for (const file of folder.fileRefs || []) {
|
||||
if (file != null) {
|
||||
files[path.join(folderPath, file.name)] = file
|
||||
}
|
||||
|
@ -91,14 +91,14 @@ const ProjectEntityHandler = {
|
|||
}
|
||||
const docs = []
|
||||
const files = []
|
||||
for (let folderPath in folders) {
|
||||
for (const folderPath in folders) {
|
||||
const folder = folders[folderPath]
|
||||
for (let doc of folder.docs || []) {
|
||||
for (const doc of folder.docs || []) {
|
||||
if (doc != null) {
|
||||
docs.push({ path: path.join(folderPath, doc.name), doc })
|
||||
}
|
||||
}
|
||||
for (let file of folder.fileRefs || []) {
|
||||
for (const file of folder.fileRefs || []) {
|
||||
if (file != null) {
|
||||
files.push({ path: path.join(folderPath, file.name), file })
|
||||
}
|
||||
|
@ -129,9 +129,9 @@ const ProjectEntityHandler = {
|
|||
return callback(err)
|
||||
}
|
||||
const docPath = {}
|
||||
for (let folderPath in folders) {
|
||||
for (const folderPath in folders) {
|
||||
const folder = folders[folderPath]
|
||||
for (let doc of folder.docs || []) {
|
||||
for (const doc of folder.docs || []) {
|
||||
docPath[doc._id] = path.join(folderPath, doc.name)
|
||||
}
|
||||
}
|
||||
|
@ -160,7 +160,7 @@ const ProjectEntityHandler = {
|
|||
return callback(new Errors.NotFoundError('no project'))
|
||||
}
|
||||
function recursivelyFindDocInFolder(basePath, docId, folder) {
|
||||
let docInCurrentFolder = (folder.docs || []).find(
|
||||
const docInCurrentFolder = (folder.docs || []).find(
|
||||
currentDoc => currentDoc._id.toString() === docId.toString()
|
||||
)
|
||||
if (docInCurrentFolder != null) {
|
||||
|
@ -208,7 +208,7 @@ const ProjectEntityHandler = {
|
|||
const folders = {}
|
||||
function processFolder(basePath, folder) {
|
||||
folders[basePath] = folder
|
||||
for (let childFolder of folder.folders || []) {
|
||||
for (const childFolder of folder.folders || []) {
|
||||
if (childFolder.name != null) {
|
||||
processFolder(path.join(basePath, childFolder.name), childFolder)
|
||||
}
|
||||
|
|
|
@ -1175,7 +1175,7 @@ const ProjectEntityUpdateHandler = {
|
|||
),
|
||||
|
||||
mkdirp: wrapWithLock(function (projectId, path, callback) {
|
||||
for (let folder of path.split('/')) {
|
||||
for (const folder of path.split('/')) {
|
||||
if (folder.length > 0 && !SafePath.isCleanFilename(folder)) {
|
||||
return callback(new Errors.InvalidNameError('invalid element name'))
|
||||
}
|
||||
|
@ -1189,7 +1189,7 @@ const ProjectEntityUpdateHandler = {
|
|||
}),
|
||||
|
||||
mkdirpWithExactCase: wrapWithLock(function (projectId, path, callback) {
|
||||
for (let folder of path.split('/')) {
|
||||
for (const folder of path.split('/')) {
|
||||
if (folder.length > 0 && !SafePath.isCleanFilename(folder)) {
|
||||
return callback(new Errors.InvalidNameError('invalid element name'))
|
||||
}
|
||||
|
@ -1381,7 +1381,7 @@ const ProjectEntityUpdateHandler = {
|
|||
),
|
||||
|
||||
isPathValidForRootDoc(docPath) {
|
||||
let docExtension = Path.extname(docPath)
|
||||
const docExtension = Path.extname(docPath)
|
||||
return VALID_ROOT_DOC_REGEXP.test(docExtension)
|
||||
},
|
||||
|
||||
|
@ -1458,10 +1458,10 @@ const ProjectEntityUpdateHandler = {
|
|||
} else if (entityType.indexOf('folder') !== -1) {
|
||||
changes = { oldDocs: [], oldFiles: [] }
|
||||
const _recurseFolder = (folder, folderPath) => {
|
||||
for (let doc of folder.docs) {
|
||||
for (const doc of folder.docs) {
|
||||
changes.oldDocs.push({ doc, path: Path.join(folderPath, doc.name) })
|
||||
}
|
||||
for (let file of folder.fileRefs) {
|
||||
for (const file of folder.fileRefs) {
|
||||
changes.oldFiles.push({
|
||||
file,
|
||||
path: Path.join(folderPath, file.name),
|
||||
|
|
|
@ -46,7 +46,7 @@ function findElement(options, _callback) {
|
|||
return
|
||||
}
|
||||
const newPath = {}
|
||||
for (let key of Object.keys(path)) {
|
||||
for (const key of Object.keys(path)) {
|
||||
const value = path[key]
|
||||
newPath[key] = value
|
||||
} // make a value copy of the string
|
||||
|
@ -179,7 +179,7 @@ function _findElementByPathWithProject(
|
|||
}
|
||||
const needleFolderName = foldersList[level]
|
||||
let found = false
|
||||
for (let folder of haystackFolder.folders) {
|
||||
for (const folder of haystackFolder.folders) {
|
||||
if (matchFn(folder.name, needleFolderName)) {
|
||||
found = true
|
||||
if (level === foldersList.length - 1) {
|
||||
|
@ -203,19 +203,19 @@ function _findElementByPathWithProject(
|
|||
if (entityName == null) {
|
||||
return cb(null, folder, 'folder')
|
||||
}
|
||||
for (let file of folder.fileRefs || []) {
|
||||
for (const file of folder.fileRefs || []) {
|
||||
if (matchFn(file != null ? file.name : undefined, entityName)) {
|
||||
result = file
|
||||
type = 'file'
|
||||
}
|
||||
}
|
||||
for (let doc of folder.docs || []) {
|
||||
for (const doc of folder.docs || []) {
|
||||
if (matchFn(doc != null ? doc.name : undefined, entityName)) {
|
||||
result = doc
|
||||
type = 'doc'
|
||||
}
|
||||
}
|
||||
for (let childFolder of folder.folders || []) {
|
||||
for (const childFolder of folder.folders || []) {
|
||||
if (
|
||||
matchFn(childFolder != null ? childFolder.name : undefined, entityName)
|
||||
) {
|
||||
|
|
|
@ -228,7 +228,7 @@ module.exports = ProjectRootDocManager = {
|
|||
return callback(error)
|
||||
}
|
||||
let rootDocValid = false
|
||||
for (let doc_id in docPaths) {
|
||||
for (const doc_id in docPaths) {
|
||||
const _path = docPaths[doc_id]
|
||||
if (doc_id === project.rootDoc_id) {
|
||||
rootDocValid = true
|
||||
|
|
|
@ -112,7 +112,7 @@ prototype\
|
|||
return false
|
||||
}
|
||||
|
||||
for (let element of Array.from(elements)) {
|
||||
for (const element of Array.from(elements)) {
|
||||
if (element.length > 0 && !SafePath.isCleanFilename(element)) {
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -139,8 +139,8 @@ const FeaturesUpdater = {
|
|||
) {
|
||||
return callback(null, {})
|
||||
}
|
||||
let activeFeaturesOverrides = []
|
||||
for (let featuresOverride of user.featuresOverrides) {
|
||||
const activeFeaturesOverrides = []
|
||||
for (const featuresOverride of user.featuresOverrides) {
|
||||
if (
|
||||
!featuresOverride.expiresAt ||
|
||||
featuresOverride.expiresAt > new Date()
|
||||
|
@ -181,7 +181,7 @@ const FeaturesUpdater = {
|
|||
|
||||
_mergeFeatures(featuresA, featuresB) {
|
||||
const features = Object.assign({}, featuresA)
|
||||
for (let key in featuresB) {
|
||||
for (const key in featuresB) {
|
||||
// Special merging logic for non-boolean features
|
||||
if (key === 'compileGroup') {
|
||||
if (
|
||||
|
@ -239,7 +239,7 @@ const FeaturesUpdater = {
|
|||
return {}
|
||||
}
|
||||
|
||||
let mismatchReasons = {}
|
||||
const mismatchReasons = {}
|
||||
const featureKeys = [
|
||||
...new Set([
|
||||
...Object.keys(currentFeatures),
|
||||
|
|
|
@ -11,7 +11,7 @@ function ensurePlansAreSetupCorrectly() {
|
|||
}
|
||||
|
||||
function findLocalPlanInSettings(planCode) {
|
||||
for (let plan of Settings.plans) {
|
||||
for (const plan of Settings.plans) {
|
||||
if (plan.planCode === planCode) {
|
||||
return plan
|
||||
}
|
||||
|
|
|
@ -184,7 +184,7 @@ const SubscriptionUpdater = {
|
|||
if (err) {
|
||||
return callback(err)
|
||||
}
|
||||
let subscription = deletedSubscription.subscription
|
||||
const subscription = deletedSubscription.subscription
|
||||
async.series(
|
||||
[
|
||||
cb =>
|
||||
|
|
|
@ -4,7 +4,7 @@ module.exports = {
|
|||
updateFeatures(userId, features, callback) {
|
||||
const conditions = { _id: userId }
|
||||
const update = {}
|
||||
for (let key in features) {
|
||||
for (const key in features) {
|
||||
const value = features[key]
|
||||
update[`features.${key}`] = value
|
||||
}
|
||||
|
|
|
@ -168,7 +168,7 @@ const TemplatesManager = {
|
|||
|
||||
promises: {
|
||||
async fetchFromV1(templateId) {
|
||||
let { body, statusCode } = await requestPromise({
|
||||
const { body, statusCode } = await requestPromise({
|
||||
baseUrl: settings.apis.v1.url,
|
||||
url: `/api/v2/templates/${templateId}`,
|
||||
method: 'GET',
|
||||
|
|
|
@ -88,7 +88,7 @@ const ArchiveManager = {
|
|||
return callback() // don't give a destfile for directory
|
||||
}
|
||||
// check that the file does not use a relative path
|
||||
for (let dir of Array.from(transformedFilename.split('/'))) {
|
||||
for (const dir of Array.from(transformedFilename.split('/'))) {
|
||||
if (dir === '..') {
|
||||
return callback(new Error('relative path'))
|
||||
}
|
||||
|
|
|
@ -99,7 +99,7 @@ const FileTypeManager = {
|
|||
|
||||
shouldIgnore(path, callback) {
|
||||
const name = Path.basename(path)
|
||||
let extension = Path.extname(name).toLowerCase()
|
||||
const extension = Path.extname(name).toLowerCase()
|
||||
let ignore = false
|
||||
if (name.startsWith('.') && name !== '.latexmkrc') {
|
||||
ignore = true
|
||||
|
|
|
@ -216,7 +216,7 @@ const UserController = {
|
|||
{ deleterUser: user, ipAddress: req.ip },
|
||||
err => {
|
||||
if (err) {
|
||||
let errorData = {
|
||||
const errorData = {
|
||||
message: 'error while deleting user account',
|
||||
info: { userId },
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ async function deleteUser(userId, options = {}) {
|
|||
}
|
||||
|
||||
try {
|
||||
let user = await User.findById(userId).exec()
|
||||
const user = await User.findById(userId).exec()
|
||||
logger.log({ user }, 'deleting user')
|
||||
|
||||
await ensureCanDeleteUser(user)
|
||||
|
@ -62,7 +62,7 @@ async function deleteMongoUser(userId) {
|
|||
}
|
||||
|
||||
async function expireDeletedUser(userId) {
|
||||
let deletedUser = await DeletedUser.findOne({
|
||||
const deletedUser = await DeletedUser.findOne({
|
||||
'deleterData.deletedUserId': userId,
|
||||
}).exec()
|
||||
|
||||
|
@ -73,7 +73,7 @@ async function expireDeletedUser(userId) {
|
|||
|
||||
async function expireDeletedUsersAfterDuration() {
|
||||
const DURATION = 90
|
||||
let deletedUsers = await DeletedUser.find({
|
||||
const deletedUsers = await DeletedUser.find({
|
||||
'deleterData.deletedAt': {
|
||||
$lt: new Date(moment().subtract(DURATION, 'days')),
|
||||
},
|
||||
|
|
|
@ -65,7 +65,7 @@ module.exports = UserController = {
|
|||
return {}
|
||||
}
|
||||
const formattedUser = { id: user._id.toString() }
|
||||
for (let key of [
|
||||
for (const key of [
|
||||
'first_name',
|
||||
'last_name',
|
||||
'email',
|
||||
|
|
|
@ -173,7 +173,7 @@ const UserPagesController = {
|
|||
_translateProviderDescriptions(providers, req) {
|
||||
const result = {}
|
||||
if (providers) {
|
||||
for (let provider in providers) {
|
||||
for (const provider in providers) {
|
||||
const data = providers[provider]
|
||||
data.description = req.i18n.translate(
|
||||
data.descriptionKey,
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
let UserSessionsManager
|
||||
const OError = require('@overleaf/o-error')
|
||||
const Settings = require('settings-sharelatex')
|
||||
const logger = require('logger-sharelatex')
|
||||
|
@ -8,7 +7,7 @@ const { promisify } = require('util')
|
|||
const UserSessionsRedis = require('./UserSessionsRedis')
|
||||
const rclient = UserSessionsRedis.client()
|
||||
|
||||
UserSessionsManager = {
|
||||
const UserSessionsManager = {
|
||||
// mimic the key used by the express sessions
|
||||
_sessionKey(sessionId) {
|
||||
return `sess:${sessionId}`
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
let UserMembershipAuthorization = {
|
||||
const UserMembershipAuthorization = {
|
||||
hasStaffAccess(requiredStaffAccess) {
|
||||
return req => {
|
||||
if (!req.user) {
|
||||
|
|
|
@ -94,8 +94,8 @@ var getPopulatedListOfMembers = function (entity, attributes, callback) {
|
|||
}
|
||||
const userObjects = []
|
||||
|
||||
for (let attribute of Array.from(attributes)) {
|
||||
for (let userObject of Array.from(entity[attribute] || [])) {
|
||||
for (const attribute of Array.from(attributes)) {
|
||||
for (const userObject of Array.from(entity[attribute] || [])) {
|
||||
// userObject can be an email as String, a user id as ObjectId or an
|
||||
// invite as Object with an email attribute as String. We want to pass to
|
||||
// UserMembershipViewModel either an email as (String) or a user id (ObjectId)
|
||||
|
|
|
@ -10,7 +10,7 @@ const TemplatesManager = require('../Templates/TemplatesManager')
|
|||
|
||||
// set of middleware arrays or functions that checks user access to an entity
|
||||
// (publisher, institution, group, template, etc.)
|
||||
let UserMembershipMiddleware = {
|
||||
const UserMembershipMiddleware = {
|
||||
requireTeamMetricsAccess: [
|
||||
AuthenticationController.requireLogin(),
|
||||
fetchEntityConfig('team'),
|
||||
|
@ -198,7 +198,7 @@ function fetchEntityConfig(entityName) {
|
|||
// fetch the entity with id and config, and set it in the request
|
||||
function fetchEntity() {
|
||||
return expressify(async (req, res, next) => {
|
||||
let entity = await UserMembershipHandler.promises.getEntityWithoutAuthorizationCheck(
|
||||
const entity = await UserMembershipHandler.promises.getEntityWithoutAuthorizationCheck(
|
||||
req.params.id,
|
||||
req.entityConfig
|
||||
)
|
||||
|
@ -281,7 +281,7 @@ function requireV1Template() {
|
|||
// retur values is truly. Redirect to restricted otherwise
|
||||
function allowAccessIfAny(accessFunctions) {
|
||||
return (req, res, next) => {
|
||||
for (let accessFunction of accessFunctions) {
|
||||
for (const accessFunction of accessFunctions) {
|
||||
if (accessFunction(req)) {
|
||||
return next()
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ const UserMembershipsHandler = {
|
|||
callback = function (error) {}
|
||||
}
|
||||
const entityConfigs = []
|
||||
for (let key in UserMembershipEntityConfigs) {
|
||||
for (const key in UserMembershipEntityConfigs) {
|
||||
const entityConfig = UserMembershipEntityConfigs[key]
|
||||
if (entityConfig.fields && entityConfig.fields.write != null) {
|
||||
entityConfigs.push(entityConfig)
|
||||
|
|
|
@ -299,7 +299,7 @@ module.exports = function (webRouter, privateApiRouter, publicApiRouter) {
|
|||
webRouter.use(function (req, res, next) {
|
||||
// Clone the nav settings so they can be modified for each request
|
||||
res.locals.nav = {}
|
||||
for (let key in Settings.nav) {
|
||||
for (const key in Settings.nav) {
|
||||
res.locals.nav[key] = _.clone(Settings.nav[key])
|
||||
}
|
||||
res.locals.templates = Settings.templateLinks
|
||||
|
|
|
@ -12,7 +12,7 @@ const _hooks = {}
|
|||
let _viewIncludes = {}
|
||||
|
||||
function loadModules() {
|
||||
for (let moduleName of fs.readdirSync(MODULE_BASE_PATH)) {
|
||||
for (const moduleName of fs.readdirSync(MODULE_BASE_PATH)) {
|
||||
if (fs.existsSync(Path.join(MODULE_BASE_PATH, moduleName, 'index.js'))) {
|
||||
const loadedModule = require(Path.join(
|
||||
MODULE_BASE_PATH,
|
||||
|
@ -35,7 +35,7 @@ function applyRouter(webRouter, privateApiRouter, publicApiRouter) {
|
|||
}
|
||||
|
||||
function applyNonCsrfRouter(webRouter, privateApiRouter, publicApiRouter) {
|
||||
for (let module of _modules) {
|
||||
for (const module of _modules) {
|
||||
if (module.nonCsrfRouter != null) {
|
||||
module.nonCsrfRouter.apply(webRouter, privateApiRouter, publicApiRouter)
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ function loadViewIncludes(app) {
|
|||
_viewIncludes = {}
|
||||
for (const module of _modules) {
|
||||
const object = module.viewIncludes || {}
|
||||
for (let view in object) {
|
||||
for (const view in object) {
|
||||
const partial = object[view]
|
||||
if (!_viewIncludes[view]) {
|
||||
_viewIncludes[view] = []
|
||||
|
@ -77,7 +77,7 @@ function loadViewIncludes(app) {
|
|||
function moduleIncludes(view, locals) {
|
||||
const compiledPartials = _viewIncludes[view] || []
|
||||
let html = ''
|
||||
for (let compiledPartial of compiledPartials) {
|
||||
for (const compiledPartial of compiledPartials) {
|
||||
html += compiledPartial(locals)
|
||||
}
|
||||
return html
|
||||
|
@ -89,8 +89,8 @@ function moduleIncludesAvailable(view) {
|
|||
|
||||
function linkedFileAgentsIncludes() {
|
||||
const agents = {}
|
||||
for (let module of _modules) {
|
||||
for (let name in module.linkedFileAgents) {
|
||||
for (const module of _modules) {
|
||||
for (const name in module.linkedFileAgents) {
|
||||
const agentFunction = module.linkedFileAgents[name]
|
||||
agents[name] = agentFunction()
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ function linkedFileAgentsIncludes() {
|
|||
function attachHooks() {
|
||||
for (var module of _modules) {
|
||||
if (module.hooks != null) {
|
||||
for (let hook in module.hooks) {
|
||||
for (const hook in module.hooks) {
|
||||
const method = module.hooks[hook]
|
||||
attachHook(hook, method)
|
||||
}
|
||||
|
|
|
@ -28,11 +28,11 @@ const viewList = globby
|
|||
|
||||
module.exports = {
|
||||
precompileViews(app) {
|
||||
let startTime = Date.now()
|
||||
const startTime = Date.now()
|
||||
let success = 0
|
||||
let failures = 0
|
||||
viewList.forEach(view => {
|
||||
let filename = path.resolve(view + '.pug') // express views are cached using the absolute path
|
||||
const filename = path.resolve(view + '.pug') // express views are cached using the absolute path
|
||||
try {
|
||||
pug.compileFile(filename, {
|
||||
cache: true,
|
||||
|
|
|
@ -36,7 +36,7 @@ App.directive('asyncForm', ($http, validateCaptcha, validateCaptchaV3) => ({
|
|||
|
||||
const submitRequest = function (grecaptchaResponse) {
|
||||
const formData = {}
|
||||
for (let data of Array.from(element.serializeArray())) {
|
||||
for (const data of Array.from(element.serializeArray())) {
|
||||
formData[data.name] = data.value
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
||||
*/
|
||||
import App from '../base'
|
||||
let selectName
|
||||
App.directive('focusWhen', $timeout => ({
|
||||
restrict: 'A',
|
||||
link(scope, element, attr) {
|
||||
|
@ -79,7 +78,7 @@ App.directive('focus', $timeout => ({
|
|||
},
|
||||
}))
|
||||
|
||||
selectName = function (element) {
|
||||
function selectName(element) {
|
||||
// Select up to last '.'. I.e. everything except the file extension
|
||||
element.focus()
|
||||
const name = element.val()
|
||||
|
|
|
@ -25,7 +25,7 @@ function MessageContent({ content }) {
|
|||
|
||||
useEffect(() => {
|
||||
// adds attributes to all the links generated by <Linkify/>, required due to https://github.com/tasti/react-linkify/issues/99
|
||||
for (let a of root.current.getElementsByTagName('a')) {
|
||||
for (const a of root.current.getElementsByTagName('a')) {
|
||||
a.setAttribute('target', '_blank')
|
||||
a.setAttribute('rel', 'noreferrer noopener')
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@ export function findInTreeOrThrow(tree, id) {
|
|||
}
|
||||
|
||||
export function findAllInTreeOrThrow(tree, ids) {
|
||||
let list = new Set()
|
||||
const list = new Set()
|
||||
ids.forEach(id => {
|
||||
list.add(findInTreeOrThrow(tree, id))
|
||||
})
|
||||
|
@ -26,7 +26,7 @@ export function findAllFolderIdsInFolder(folder) {
|
|||
}
|
||||
|
||||
export function findAllFolderIdsInFolders(folders) {
|
||||
let list = new Set()
|
||||
const list = new Set()
|
||||
folders.forEach(folder => {
|
||||
findAllFolderIdsInFolder(folder).forEach(folderId => {
|
||||
list.add(folderId)
|
||||
|
|
|
@ -91,7 +91,7 @@ export function isCleanPath(path) {
|
|||
return false
|
||||
}
|
||||
|
||||
for (let element of Array.from(elements)) {
|
||||
for (const element of Array.from(elements)) {
|
||||
if (element.length > 0 && !isCleanFilename(element)) {
|
||||
return false
|
||||
}
|
||||
|
|
|
@ -94,8 +94,8 @@ function matchDisplayTitle(title) {
|
|||
}
|
||||
|
||||
function nestOutline(flatOutline) {
|
||||
let parentOutlines = {}
|
||||
let nestedOutlines = []
|
||||
const parentOutlines = {}
|
||||
const nestedOutlines = []
|
||||
flatOutline.forEach(outline => {
|
||||
const parentOutlineLevels = Object.keys(parentOutlines)
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ function PreviewToolbar({
|
|||
|
||||
itemsWidth += 10 // add extra for some spacing between items
|
||||
|
||||
let canShowText = itemsWidth < toolbarWidth
|
||||
const canShowText = itemsWidth < toolbarWidth
|
||||
|
||||
if (!canShowText) {
|
||||
_checkToggleText(
|
||||
|
|
|
@ -176,7 +176,7 @@ App.controller(
|
|||
|
||||
ide.validFileRegex = '^[^*/]*$' // Don't allow * and /
|
||||
|
||||
let useFallbackWebsocket =
|
||||
const useFallbackWebsocket =
|
||||
window.location &&
|
||||
window.location.search &&
|
||||
window.location.search.match(/ws=fallback/)
|
||||
|
|
|
@ -82,7 +82,7 @@ export default ColorManager = {
|
|||
|
||||
getHueForId(id) {
|
||||
const hash = CryptoJS(id)
|
||||
let hue =
|
||||
const hue =
|
||||
parseInt(hash.toString().slice(0, 8), 16) %
|
||||
(this.TOTAL_HUES - this.OWN_HUE_BLOCKED_SIZE * 2)
|
||||
return hue
|
||||
|
|
|
@ -140,7 +140,7 @@ export default ConnectionManager = (function () {
|
|||
// handle network-level websocket errors (e.g. failed dns lookups)
|
||||
|
||||
let connectionAttempt = 1
|
||||
let connectionErrorHandler = err => {
|
||||
const connectionErrorHandler = err => {
|
||||
if (
|
||||
window.wsRetryHandshake &&
|
||||
connectionAttempt++ < window.wsRetryHandshake
|
||||
|
@ -195,7 +195,7 @@ export default ConnectionManager = (function () {
|
|||
})
|
||||
|
||||
// we have passed authentication so we can now join the project
|
||||
let connectionJobId = this.$scope.connection.jobId
|
||||
const connectionJobId = this.$scope.connection.jobId
|
||||
setTimeout(() => {
|
||||
this.joinProject(connectionJobId)
|
||||
}, 100)
|
||||
|
@ -279,7 +279,7 @@ The editor will refresh automatically in ${delay} seconds.\
|
|||
updateConnectionManagerState(state) {
|
||||
this.$scope.$apply(() => {
|
||||
this.$scope.connection.jobId += 1
|
||||
let jobId = this.$scope.connection.jobId
|
||||
const jobId = this.$scope.connection.jobId
|
||||
sl_console.log(
|
||||
`[updateConnectionManagerState ${jobId}] from ${this.$scope.connection.state} to ${state}`
|
||||
)
|
||||
|
@ -473,7 +473,7 @@ Something went wrong connecting to your project. Please refresh if this continue
|
|||
|
||||
startAutoReconnectCountdown() {
|
||||
this.updateConnectionManagerState('waitingCountdown')
|
||||
let connectionId = this.$scope.connection.jobId
|
||||
const connectionId = this.$scope.connection.jobId
|
||||
let countdown
|
||||
sl_console.log('[ConnectionManager] starting autoreconnect countdown')
|
||||
const twoMinutes = 2 * 60 * 1000
|
||||
|
|
|
@ -16,7 +16,7 @@ const transparentMethods = [
|
|||
'on',
|
||||
'removeListener',
|
||||
]
|
||||
for (let method of transparentMethods) {
|
||||
for (const method of transparentMethods) {
|
||||
SocketShimBase.prototype[method] = function () {
|
||||
this._socket[method].apply(this._socket, arguments)
|
||||
}
|
||||
|
|
|
@ -169,7 +169,7 @@ export default App.directive('layout', ($parse, $compile, ide) => ({
|
|||
element.layout().resizeAll()
|
||||
|
||||
if (attrs.resizeOn != null) {
|
||||
for (let event of Array.from(attrs.resizeOn.split(','))) {
|
||||
for (const event of Array.from(attrs.resizeOn.split(','))) {
|
||||
scope.$on(event, () => onExternalResize())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ export default Document = (function () {
|
|||
|
||||
static hasUnsavedChanges() {
|
||||
const object = this.openDocs || {}
|
||||
for (let doc_id in object) {
|
||||
for (const doc_id in object) {
|
||||
const doc = object[doc_id]
|
||||
if (doc.hasBufferedOps()) {
|
||||
return true
|
||||
|
@ -69,7 +69,7 @@ export default Document = (function () {
|
|||
static flushAll() {
|
||||
return (() => {
|
||||
const result = []
|
||||
for (let doc_id in this.openDocs) {
|
||||
for (const doc_id in this.openDocs) {
|
||||
const doc = this.openDocs[doc_id]
|
||||
result.push(doc.flush())
|
||||
}
|
||||
|
@ -464,7 +464,7 @@ export default Document = (function () {
|
|||
}
|
||||
|
||||
_callJoinCallbacks() {
|
||||
for (let callback of Array.from(this._joinCallbacks || [])) {
|
||||
for (const callback of Array.from(this._joinCallbacks || [])) {
|
||||
callback()
|
||||
}
|
||||
return delete this._joinCallbacks
|
||||
|
@ -537,7 +537,7 @@ export default Document = (function () {
|
|||
_decodeRanges(ranges) {
|
||||
const decodeFromWebsockets = text => decodeURIComponent(escape(text))
|
||||
try {
|
||||
for (let change of Array.from(ranges.changes || [])) {
|
||||
for (const change of Array.from(ranges.changes || [])) {
|
||||
if (change.op.i != null) {
|
||||
change.op.i = decodeFromWebsockets(change.op.i)
|
||||
}
|
||||
|
@ -547,7 +547,7 @@ export default Document = (function () {
|
|||
}
|
||||
return (() => {
|
||||
const result = []
|
||||
for (let comment of Array.from(ranges.comments || [])) {
|
||||
for (const comment of Array.from(ranges.comments || [])) {
|
||||
if (comment.op.c != null) {
|
||||
result.push((comment.op.c = decodeFromWebsockets(comment.op.c)))
|
||||
} else {
|
||||
|
@ -717,7 +717,7 @@ export default Document = (function () {
|
|||
;({ track_changes_as } = this)
|
||||
}
|
||||
this.ranges.track_changes = track_changes_as != null
|
||||
for (let op of Array.from(ops)) {
|
||||
for (const op of Array.from(ops)) {
|
||||
this.ranges.applyOp(op, { user_id: track_changes_as })
|
||||
}
|
||||
if (old_id_seed != null) {
|
||||
|
|
|
@ -320,7 +320,7 @@ export default ShareJsDoc = (function () {
|
|||
// compute size of an op from its components
|
||||
// (total number of characters inserted and deleted)
|
||||
let size = 0
|
||||
for (let component of Array.from(op || [])) {
|
||||
for (const component of Array.from(op || [])) {
|
||||
if ((component != null ? component.i : undefined) != null) {
|
||||
size += component.i.length
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ export default App.controller(
|
|||
let newUnsavedCount = 0
|
||||
let maxUnsavedSeconds = 0
|
||||
|
||||
for (let doc_id in Document.openDocs) {
|
||||
for (const doc_id in Document.openDocs) {
|
||||
const doc = Document.openDocs[doc_id]
|
||||
const saving = doc.pollSavedStatus()
|
||||
if (!saving) {
|
||||
|
|
|
@ -408,7 +408,7 @@ App.directive(
|
|||
}
|
||||
|
||||
if (attrs.resizeOn != null) {
|
||||
for (let event of Array.from(attrs.resizeOn.split(','))) {
|
||||
for (const event of Array.from(attrs.resizeOn.split(','))) {
|
||||
scope.$on(event, function () {
|
||||
scope.$applyAsync(() => {
|
||||
const previousScreenPosition = getCursorScreenPosition()
|
||||
|
|
|
@ -69,12 +69,12 @@ class AutoCompleteManager {
|
|||
)
|
||||
if (match) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
let commandName = match[1]
|
||||
const commandName = match[1]
|
||||
const graphicsPaths = Preamble.getGraphicsPaths()
|
||||
const result = []
|
||||
for (let graphic of Graphics.getGraphicsFiles()) {
|
||||
for (const graphic of Graphics.getGraphicsFiles()) {
|
||||
let { path } = graphic
|
||||
for (let graphicsPath of graphicsPaths) {
|
||||
for (const graphicsPath of graphicsPaths) {
|
||||
if (path.indexOf(graphicsPath) === 0) {
|
||||
path = path.slice(graphicsPath.length)
|
||||
break
|
||||
|
@ -103,10 +103,10 @@ class AutoCompleteManager {
|
|||
// eslint-disable-next-line no-unused-vars
|
||||
const commandName = match[1]
|
||||
const result = []
|
||||
for (let file of Files.getTeXFiles()) {
|
||||
for (const file of Files.getTeXFiles()) {
|
||||
if (file.id !== this.$scope.docId && !file.deleted && file.path) {
|
||||
const { path } = file
|
||||
let cleanPath = path.replace(/(.+)\.tex$/i, '$1')
|
||||
const cleanPath = path.replace(/(.+)\.tex$/i, '$1')
|
||||
result.push({
|
||||
caption: `\\${commandName}{${path}}`,
|
||||
value: `\\${commandName}{${cleanPath}}`,
|
||||
|
@ -141,7 +141,7 @@ class AutoCompleteManager {
|
|||
score: 60,
|
||||
})
|
||||
}
|
||||
for (let label of metadataManager.getAllLabels()) {
|
||||
for (const label of metadataManager.getAllLabels()) {
|
||||
result.push({
|
||||
caption: `\\${commandName}{${label}}`,
|
||||
value: `\\${commandName}{${label}}`,
|
||||
|
@ -414,7 +414,6 @@ class AutoCompleteManager {
|
|||
Autocomplete.startCommand = {
|
||||
name: 'startAutocomplete',
|
||||
exec: editor => {
|
||||
let filtered
|
||||
if (!editor.completer) {
|
||||
editor.completer = new Autocomplete()
|
||||
}
|
||||
|
@ -429,7 +428,7 @@ class AutoCompleteManager {
|
|||
)
|
||||
container.css({ 'font-size': this.$scope.fontSize + 'px' })
|
||||
// Dynamically set width of autocomplete popup
|
||||
filtered =
|
||||
const filtered =
|
||||
editor.completer.completions &&
|
||||
editor.completer.completions.filtered
|
||||
if (filtered) {
|
||||
|
|
|
@ -152,7 +152,7 @@ export default CommandManager = class CommandManager {
|
|||
|
||||
const packages = this.metadataManager.getAllPackages()
|
||||
const packageCommands = []
|
||||
for (let pkg in packages) {
|
||||
for (const pkg in packages) {
|
||||
const snippets = packages[pkg]
|
||||
for (snippet of Array.from(snippets)) {
|
||||
packageCommands.push(snippet)
|
||||
|
@ -164,7 +164,7 @@ export default CommandManager = class CommandManager {
|
|||
const parser = new Parser(doc, prefix)
|
||||
const commands = parser.parse()
|
||||
let completions = []
|
||||
for (let command of Array.from(commands)) {
|
||||
for (const command of Array.from(commands)) {
|
||||
if (!commandNames[command[0]]) {
|
||||
let caption = `\\${command[0]}`
|
||||
const score = caption === prefix ? 99 : 50
|
||||
|
|
|
@ -201,10 +201,10 @@ class EnvironmentManager {
|
|||
}
|
||||
|
||||
const parsedItemsMap = {}
|
||||
for (let environment of Array.from(customEnvironments)) {
|
||||
for (const environment of Array.from(customEnvironments)) {
|
||||
parsedItemsMap[environment.name] = environment
|
||||
}
|
||||
for (let command of Array.from(beginCommands)) {
|
||||
for (const command of Array.from(beginCommands)) {
|
||||
parsedItemsMap[command.name] = command
|
||||
}
|
||||
const parsedItems = _.values(parsedItemsMap)
|
||||
|
|
|
@ -120,7 +120,7 @@ class PackageManager {
|
|||
getCompletions(editor, session, pos, prefix, callback) {
|
||||
const usedPackages = Object.keys(this.metadataManager.getAllPackages())
|
||||
const packageSnippets = []
|
||||
for (let pkg of Array.from(packages)) {
|
||||
for (const pkg of Array.from(packages)) {
|
||||
if (!Array.from(usedPackages).includes(pkg)) {
|
||||
packageSnippets.push({
|
||||
caption: `\\usepackage{${pkg}}`,
|
||||
|
|
|
@ -109,7 +109,7 @@ export default HighlightsManager = class HighlightsManager {
|
|||
this._clearMarkers()
|
||||
this._clearLabels()
|
||||
|
||||
for (let annotation of Array.from(this.$scope.highlights || [])) {
|
||||
for (const annotation of Array.from(this.$scope.highlights || [])) {
|
||||
;(annotation => {
|
||||
const colorScheme = ColorManager.getColorScheme(
|
||||
annotation.hue,
|
||||
|
@ -161,7 +161,7 @@ export default HighlightsManager = class HighlightsManager {
|
|||
|
||||
showAnnotationLabels(position) {
|
||||
let labelToShow = null
|
||||
for (let label of Array.from(this.labels || [])) {
|
||||
for (const label of Array.from(this.labels || [])) {
|
||||
if (label.range.contains(position.row, position.column)) {
|
||||
labelToShow = label
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ export default HighlightsManager = class HighlightsManager {
|
|||
let highlightsAfter = 0
|
||||
this.lastHiddenHighlightBefore = null
|
||||
this.firstHiddenHighlightAfter = null
|
||||
for (let annotation of Array.from(this.$scope.highlights || [])) {
|
||||
for (const annotation of Array.from(this.$scope.highlights || [])) {
|
||||
const range = annotation.highlight || annotation.strikeThrough
|
||||
if (range == null) {
|
||||
continue
|
||||
|
@ -281,7 +281,7 @@ export default HighlightsManager = class HighlightsManager {
|
|||
scrollToFirstHighlight() {
|
||||
return (() => {
|
||||
const result = []
|
||||
for (let annotation of Array.from(this.$scope.highlights || [])) {
|
||||
for (const annotation of Array.from(this.$scope.highlights || [])) {
|
||||
const range = annotation.highlight || annotation.strikeThrough
|
||||
if (range == null) {
|
||||
continue
|
||||
|
@ -294,7 +294,7 @@ export default HighlightsManager = class HighlightsManager {
|
|||
}
|
||||
|
||||
_clearMarkers() {
|
||||
for (let marker_id of Array.from(this.markerIds)) {
|
||||
for (const marker_id of Array.from(this.markerIds)) {
|
||||
this.editor.getSession().removeMarker(marker_id)
|
||||
}
|
||||
return (this.markerIds = [])
|
||||
|
|
|
@ -298,7 +298,7 @@ class SpellCheckManager {
|
|||
return null
|
||||
}
|
||||
const misspelled = []
|
||||
for (let misspelling of result.misspellings) {
|
||||
for (const misspelling of result.misspellings) {
|
||||
word = words[misspelling.index]
|
||||
const position = positions[misspelling.index]
|
||||
misspelled[misspelling.index] = true
|
||||
|
@ -360,7 +360,7 @@ class SpellCheckManager {
|
|||
const positions = []
|
||||
for (let row = 0; row < lines.length; row++) {
|
||||
let line = lines[row]
|
||||
let rowIdx = rowNumsToCheck[row]
|
||||
const rowIdx = rowNumsToCheck[row]
|
||||
line = this.blankOutBlacklistedCommands(line)
|
||||
var result
|
||||
WORD_REGEX.lastIndex = 0 // reset global stateful regexp for this usage
|
||||
|
|
|
@ -16,9 +16,9 @@ class TrackChangesAdapter {
|
|||
|
||||
clearAnnotations() {
|
||||
const session = this.editor.getSession()
|
||||
for (let change_id in this.changeIdToMarkerIdMap) {
|
||||
for (const change_id in this.changeIdToMarkerIdMap) {
|
||||
const markers = this.changeIdToMarkerIdMap[change_id]
|
||||
for (let marker_name in markers) {
|
||||
for (const marker_name in markers) {
|
||||
const marker_id = markers[marker_name]
|
||||
session.removeMarker(marker_id)
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ class TrackChangesManager {
|
|||
}
|
||||
|
||||
redrawAnnotations() {
|
||||
for (let change of Array.from(this.rangesTracker.changes)) {
|
||||
for (const change of Array.from(this.rangesTracker.changes)) {
|
||||
if (change.op.i != null) {
|
||||
this.adapter.onInsertAdded(change)
|
||||
} else if (change.op.d != null) {
|
||||
|
@ -350,7 +350,7 @@ class TrackChangesManager {
|
|||
changes.sort((a, b) => b.op.p - a.op.p)
|
||||
|
||||
const session = this.editor.getSession()
|
||||
for (let change of Array.from(changes)) {
|
||||
for (const change of Array.from(changes)) {
|
||||
if (change.op.d != null) {
|
||||
const content = change.op.d
|
||||
const position = this.adapter.shareJsOffsetToRowColumn(change.op.p)
|
||||
|
@ -387,12 +387,12 @@ class TrackChangesManager {
|
|||
|
||||
hideCommentsByThreadIds(thread_ids) {
|
||||
const resolve_ids = {}
|
||||
let comments = this.rangesTracker.comments || []
|
||||
for (let id of Array.from(thread_ids)) {
|
||||
const comments = this.rangesTracker.comments || []
|
||||
for (const id of Array.from(thread_ids)) {
|
||||
resolve_ids[id] = true
|
||||
}
|
||||
|
||||
for (let comment of comments) {
|
||||
for (const comment of comments) {
|
||||
if (resolve_ids[comment.op.t]) {
|
||||
this.adapter.onCommentRemoved(comment)
|
||||
}
|
||||
|
@ -401,8 +401,8 @@ class TrackChangesManager {
|
|||
}
|
||||
|
||||
showCommentByThreadId(thread_id) {
|
||||
let comments = this.rangesTracker.comments || []
|
||||
for (let comment of comments) {
|
||||
const comments = this.rangesTracker.comments || []
|
||||
for (const comment of comments) {
|
||||
if (comment.op.t === thread_id && !this.isCommentResolved(comment)) {
|
||||
this.adapter.onCommentAdded(comment)
|
||||
}
|
||||
|
@ -427,7 +427,7 @@ class TrackChangesManager {
|
|||
this._cutState.docId = this.$scope.docId
|
||||
return (() => {
|
||||
const result = []
|
||||
for (let comment of Array.from(this.rangesTracker.comments)) {
|
||||
for (const comment of Array.from(this.rangesTracker.comments)) {
|
||||
const comment_start = comment.op.p
|
||||
const comment_end = comment_start + comment.op.c.length
|
||||
if (selection_start <= comment_start && comment_end <= selection_end) {
|
||||
|
@ -465,7 +465,7 @@ class TrackChangesManager {
|
|||
pasted_text === this._cutState.text &&
|
||||
this.$scope.docId === this._cutState.docId
|
||||
) {
|
||||
for (let { comment, offset, text } of Array.from(
|
||||
for (const { comment, offset, text } of Array.from(
|
||||
this._cutState.comments
|
||||
)) {
|
||||
const op = { c: text, p: paste_offset + offset, t: comment.id }
|
||||
|
@ -519,7 +519,7 @@ class TrackChangesManager {
|
|||
}
|
||||
}
|
||||
|
||||
for (let comment of Array.from(this.rangesTracker.comments)) {
|
||||
for (const comment of Array.from(this.rangesTracker.comments)) {
|
||||
if (this.adapter.changeIdToMarkerIdMap[comment.id] != null) {
|
||||
;({
|
||||
background_marker_id,
|
||||
|
@ -583,7 +583,7 @@ class TrackChangesManager {
|
|||
const { renderer } = this.editor
|
||||
const entries = this._getCurrentDocEntries()
|
||||
const object = entries || {}
|
||||
for (let entry_id in object) {
|
||||
for (const entry_id in object) {
|
||||
const entry = object[entry_id]
|
||||
const doc_position = this.adapter.shareJsOffsetToRowColumn(entry.offset)
|
||||
const screen_position = session.documentToScreenPosition(
|
||||
|
@ -612,7 +612,7 @@ class TrackChangesManager {
|
|||
const entries = this._getCurrentDocEntries() || {}
|
||||
const entriesLength = Object.keys(entries).length
|
||||
let changed = false
|
||||
for (let entry_id in entries) {
|
||||
for (const entry_id in entries) {
|
||||
const entry = entries[entry_id]
|
||||
const old = entry.visible
|
||||
entry.visible =
|
||||
|
|
|
@ -275,7 +275,7 @@ export default FileTreeManager = class FileTreeManager {
|
|||
}
|
||||
|
||||
_findEntityByIdInFolder(folder, id) {
|
||||
for (let entity of Array.from(folder.children || [])) {
|
||||
for (const entity of Array.from(folder.children || [])) {
|
||||
if (entity.id === id) {
|
||||
return entity
|
||||
} else if (entity.children != null) {
|
||||
|
@ -309,7 +309,7 @@ export default FileTreeManager = class FileTreeManager {
|
|||
return this._findEntityByPathInFolder(folder, rest)
|
||||
}
|
||||
|
||||
for (let entity of Array.from(folder.children)) {
|
||||
for (const entity of Array.from(folder.children)) {
|
||||
if (entity.name === name) {
|
||||
if (rest === '') {
|
||||
return entity
|
||||
|
@ -329,7 +329,7 @@ export default FileTreeManager = class FileTreeManager {
|
|||
|
||||
return (() => {
|
||||
const result = []
|
||||
for (let entity of Array.from(this.$scope.deletedDocs || [])) {
|
||||
for (const entity of Array.from(this.$scope.deletedDocs || [])) {
|
||||
result.push(callback(entity))
|
||||
}
|
||||
return result
|
||||
|
@ -339,7 +339,7 @@ export default FileTreeManager = class FileTreeManager {
|
|||
_forEachEntityInFolder(folder, path, callback) {
|
||||
return (() => {
|
||||
const result = []
|
||||
for (let entity of Array.from(folder.children || [])) {
|
||||
for (const entity of Array.from(folder.children || [])) {
|
||||
var childPath
|
||||
if (path != null) {
|
||||
childPath = path + '/' + entity.name
|
||||
|
@ -362,7 +362,7 @@ export default FileTreeManager = class FileTreeManager {
|
|||
}
|
||||
|
||||
_getEntityPathInFolder(folder, entity) {
|
||||
for (let child of Array.from(folder.children || [])) {
|
||||
for (const child of Array.from(folder.children || [])) {
|
||||
if (child === entity) {
|
||||
return entity.name
|
||||
} else if (child.type === 'folder') {
|
||||
|
@ -417,7 +417,7 @@ export default FileTreeManager = class FileTreeManager {
|
|||
selected: rawFolder._id === this.selected_entity_id,
|
||||
}
|
||||
|
||||
for (let doc of Array.from(rawFolder.docs || [])) {
|
||||
for (const doc of Array.from(rawFolder.docs || [])) {
|
||||
folder.children.push({
|
||||
name: doc.name,
|
||||
id: doc._id,
|
||||
|
@ -426,7 +426,7 @@ export default FileTreeManager = class FileTreeManager {
|
|||
})
|
||||
}
|
||||
|
||||
for (let file of Array.from(rawFolder.fileRefs || [])) {
|
||||
for (const file of Array.from(rawFolder.fileRefs || [])) {
|
||||
folder.children.push({
|
||||
name: file.name,
|
||||
id: file._id,
|
||||
|
@ -437,7 +437,7 @@ export default FileTreeManager = class FileTreeManager {
|
|||
})
|
||||
}
|
||||
|
||||
for (let childFolder of Array.from(rawFolder.folders || [])) {
|
||||
for (const childFolder of Array.from(rawFolder.folders || [])) {
|
||||
folder.children.push(this._parseFolder(childFolder))
|
||||
}
|
||||
|
||||
|
@ -487,7 +487,7 @@ export default FileTreeManager = class FileTreeManager {
|
|||
}
|
||||
|
||||
_getEntityPathInFolder(folder, entity) {
|
||||
for (let child of Array.from(folder.children || [])) {
|
||||
for (const child of Array.from(folder.children || [])) {
|
||||
if (child === entity) {
|
||||
return entity.name
|
||||
} else if (child.type === 'folder') {
|
||||
|
@ -511,7 +511,7 @@ export default FileTreeManager = class FileTreeManager {
|
|||
if (startFolder == null) {
|
||||
startFolder = this.$scope.rootFolder
|
||||
}
|
||||
for (let entity of Array.from(startFolder.children || [])) {
|
||||
for (const entity of Array.from(startFolder.children || [])) {
|
||||
// The 'current' folder is either the one selected, or
|
||||
// the one containing the selected doc/file
|
||||
if (entity.selected) {
|
||||
|
@ -534,7 +534,7 @@ export default FileTreeManager = class FileTreeManager {
|
|||
}
|
||||
|
||||
projectContainsFolder() {
|
||||
for (let entity of Array.from(this.$scope.rootFolder.children)) {
|
||||
for (const entity of Array.from(this.$scope.rootFolder.children)) {
|
||||
if (entity.type === 'folder') {
|
||||
return true
|
||||
}
|
||||
|
@ -543,7 +543,7 @@ export default FileTreeManager = class FileTreeManager {
|
|||
}
|
||||
|
||||
existsInThisFolder(folder, name) {
|
||||
for (let entity of Array.from(
|
||||
for (const entity of Array.from(
|
||||
(folder != null ? folder.children : undefined) || []
|
||||
)) {
|
||||
if (entity.name === name) {
|
||||
|
|
|
@ -150,7 +150,7 @@ export default App.controller(
|
|||
|
||||
$scope.delete = function () {
|
||||
$scope.state.inflight = true
|
||||
for (let entity of Array.from($scope.entities)) {
|
||||
for (const entity of Array.from($scope.entities)) {
|
||||
ide.fileTreeManager.deleteEntity(entity)
|
||||
}
|
||||
return $modalInstance.close()
|
||||
|
|
|
@ -44,7 +44,7 @@ export default App.controller(
|
|||
|
||||
const ids = $scope.entity.children.map(entity => entity.id)
|
||||
|
||||
for (let dropped_entity of Array.from(entities)) {
|
||||
for (const dropped_entity of Array.from(entities)) {
|
||||
if (!ids.includes(dropped_entity.id)) {
|
||||
try {
|
||||
ide.fileTreeManager.moveEntity(dropped_entity, $scope.entity)
|
||||
|
|
|
@ -27,7 +27,7 @@ export default App.controller(
|
|||
|
||||
const ids = rootFolder.children.map(entity => entity.id)
|
||||
|
||||
for (let dropped_entity of Array.from(entities)) {
|
||||
for (const dropped_entity of Array.from(entities)) {
|
||||
if (!ids.includes(dropped_entity.id)) {
|
||||
try {
|
||||
ide.fileTreeManager.moveEntity(dropped_entity, rootFolder)
|
||||
|
|
|
@ -4,7 +4,7 @@ import App from '../../../base'
|
|||
export default App.factory('files', function (ide) {
|
||||
const Files = {
|
||||
getTeXFiles() {
|
||||
let texFiles = []
|
||||
const texFiles = []
|
||||
ide.fileTreeManager.forEachEntity(function (entity, _folder, path) {
|
||||
if (
|
||||
entity.type === 'doc' &&
|
||||
|
|
|
@ -273,10 +273,10 @@ export default HistoryManager = (function () {
|
|||
this.$scope.history.updates.length - 1
|
||||
]
|
||||
|
||||
for (let update of Array.from(updates)) {
|
||||
for (const update of Array.from(updates)) {
|
||||
update.pathnames = [] // Used for display
|
||||
const object = update.docs || {}
|
||||
for (let doc_id in object) {
|
||||
for (const doc_id in object) {
|
||||
const doc = object[doc_id]
|
||||
doc.entity = this.ide.fileTreeManager.findEntityById(doc_id, {
|
||||
includeDeleted: true,
|
||||
|
@ -284,7 +284,7 @@ export default HistoryManager = (function () {
|
|||
update.pathnames.push(doc.entity.name)
|
||||
}
|
||||
|
||||
for (let user of Array.from(update.meta.users || [])) {
|
||||
for (const user of Array.from(update.meta.users || [])) {
|
||||
if (user != null) {
|
||||
user.hue = ColorManager.getHueForUserId(user.id)
|
||||
}
|
||||
|
@ -322,10 +322,10 @@ export default HistoryManager = (function () {
|
|||
? this.$scope.history.selection.doc.id
|
||||
: undefined
|
||||
|
||||
for (let update of Array.from(
|
||||
for (const update of Array.from(
|
||||
this.$scope.history.selection.updates || []
|
||||
)) {
|
||||
for (let doc_id in update.docs) {
|
||||
for (const doc_id in update.docs) {
|
||||
const doc = update.docs[doc_id]
|
||||
if (doc_id === selected_doc_id) {
|
||||
if (fromV != null && toV != null) {
|
||||
|
@ -353,7 +353,7 @@ export default HistoryManager = (function () {
|
|||
_selectDocFromUpdates() {
|
||||
let doc, doc_id
|
||||
const affected_docs = {}
|
||||
for (let update of Array.from(this.$scope.history.selection.updates)) {
|
||||
for (const update of Array.from(this.$scope.history.selection.updates)) {
|
||||
for (doc_id in update.docs) {
|
||||
doc = update.docs[doc_id]
|
||||
affected_docs[doc_id] = doc.entity
|
||||
|
@ -376,7 +376,7 @@ export default HistoryManager = (function () {
|
|||
}
|
||||
|
||||
_updateContainsUserId(update, user_id) {
|
||||
for (let user of Array.from(update.meta.users)) {
|
||||
for (const user of Array.from(update.meta.users)) {
|
||||
if ((user != null ? user.id : undefined) === user_id) {
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ export default HistoryManager = (function () {
|
|||
}
|
||||
|
||||
this.$scope.isHistoryLoading = () => {
|
||||
let selection = this.$scope.history.selection
|
||||
const selection = this.$scope.history.selection
|
||||
return (
|
||||
this.$scope.history.loadingFileTree ||
|
||||
(this.$scope.history.viewMode === HistoryViewModes.POINT_IN_TIME &&
|
||||
|
@ -153,7 +153,7 @@ export default HistoryManager = (function () {
|
|||
labels: null,
|
||||
loadingFileTree: true,
|
||||
}
|
||||
let _deregisterFeatureWatcher = this.$scope.$watch(
|
||||
const _deregisterFeatureWatcher = this.$scope.$watch(
|
||||
'project.features.versioning',
|
||||
hasVersioning => {
|
||||
if (hasVersioning != null) {
|
||||
|
@ -222,21 +222,21 @@ export default HistoryManager = (function () {
|
|||
}
|
||||
|
||||
setHoverFrom(fromV) {
|
||||
let selection = this.$scope.history.selection
|
||||
const selection = this.$scope.history.selection
|
||||
selection.hoveredRange.fromV = fromV
|
||||
selection.hoveredRange.toV = selection.range.toV
|
||||
this.$scope.history.hoveringOverListSelectors = true
|
||||
}
|
||||
|
||||
setHoverTo(toV) {
|
||||
let selection = this.$scope.history.selection
|
||||
const selection = this.$scope.history.selection
|
||||
selection.hoveredRange.toV = toV
|
||||
selection.hoveredRange.fromV = selection.range.fromV
|
||||
this.$scope.history.hoveringOverListSelectors = true
|
||||
}
|
||||
|
||||
resetHover() {
|
||||
let selection = this.$scope.history.selection
|
||||
const selection = this.$scope.history.selection
|
||||
selection.hoveredRange.toV = null
|
||||
selection.hoveredRange.fromV = null
|
||||
this.$scope.history.hoveringOverListSelectors = false
|
||||
|
@ -278,7 +278,7 @@ export default HistoryManager = (function () {
|
|||
|
||||
_loadFileTree(toV, fromV) {
|
||||
let url = `/project/${this.$scope.project_id}/filetree/diff`
|
||||
let selection = this.$scope.history.selection
|
||||
const selection = this.$scope.history.selection
|
||||
const query = [`from=${fromV}`, `to=${toV}`]
|
||||
url += `?${query.join('&')}`
|
||||
|
||||
|
@ -300,7 +300,7 @@ export default HistoryManager = (function () {
|
|||
.get(url, { timeout: this._loadFileTreeRequestCanceller.promise })
|
||||
.then(response => {
|
||||
this.$scope.history.selection.files = response.data.diff
|
||||
for (let file of this.$scope.history.selection.files) {
|
||||
for (const file of this.$scope.history.selection.files) {
|
||||
if (file.newPathname != null) {
|
||||
file.oldPathname = file.pathname
|
||||
file.pathname = file.newPathname
|
||||
|
@ -334,12 +334,12 @@ export default HistoryManager = (function () {
|
|||
}
|
||||
|
||||
autoSelectFile() {
|
||||
let selectedPathname = null
|
||||
let files = this.$scope.history.selection.files
|
||||
const selectedPathname = null
|
||||
const files = this.$scope.history.selection.files
|
||||
let fileToSelect = null
|
||||
let previouslySelectedFile = null
|
||||
let previouslySelectedFileHasOp = false
|
||||
let filesWithOps = this._getFilesWithOps()
|
||||
const filesWithOps = this._getFilesWithOps()
|
||||
const orderedOpTypes = ['edited', 'added', 'renamed', 'removed']
|
||||
|
||||
if (this._previouslySelectedPathname != null) {
|
||||
|
@ -353,8 +353,8 @@ export default HistoryManager = (function () {
|
|||
if (previouslySelectedFile != null && previouslySelectedFileHasOp) {
|
||||
fileToSelect = previouslySelectedFile
|
||||
} else {
|
||||
for (let opType of orderedOpTypes) {
|
||||
let fileWithMatchingOpType = _.find(filesWithOps, {
|
||||
for (const opType of orderedOpTypes) {
|
||||
const fileWithMatchingOpType = _.find(filesWithOps, {
|
||||
operation: opType,
|
||||
})
|
||||
if (fileWithMatchingOpType != null) {
|
||||
|
@ -368,13 +368,13 @@ export default HistoryManager = (function () {
|
|||
if (previouslySelectedFile != null) {
|
||||
fileToSelect = previouslySelectedFile
|
||||
} else {
|
||||
let mainFile = _.find(files, function (file) {
|
||||
const mainFile = _.find(files, function (file) {
|
||||
return /main\.tex$/.test(file.pathname)
|
||||
})
|
||||
if (mainFile != null) {
|
||||
fileToSelect = mainFile
|
||||
} else {
|
||||
let anyTeXFile = _.find(files, function (file) {
|
||||
const anyTeXFile = _.find(files, function (file) {
|
||||
return /\.tex$/.test(file.pathname)
|
||||
})
|
||||
if (anyTeXFile != null) {
|
||||
|
@ -393,18 +393,18 @@ export default HistoryManager = (function () {
|
|||
_getFilesWithOps() {
|
||||
let filesWithOps
|
||||
if (this.$scope.history.viewMode === HistoryViewModes.POINT_IN_TIME) {
|
||||
let currentUpdate = this.getUpdateForVersion(
|
||||
const currentUpdate = this.getUpdateForVersion(
|
||||
this.$scope.history.selection.range.toV
|
||||
)
|
||||
filesWithOps = []
|
||||
if (currentUpdate != null) {
|
||||
for (let pathname of currentUpdate.pathnames) {
|
||||
for (const pathname of currentUpdate.pathnames) {
|
||||
filesWithOps.push({
|
||||
pathname: pathname,
|
||||
operation: 'edited',
|
||||
})
|
||||
}
|
||||
for (let op of currentUpdate.project_ops) {
|
||||
for (const op of currentUpdate.project_ops) {
|
||||
let fileWithOp
|
||||
if (op.add != null) {
|
||||
fileWithOp = {
|
||||
|
@ -450,7 +450,7 @@ export default HistoryManager = (function () {
|
|||
return
|
||||
}
|
||||
|
||||
let toV = this.$scope.history.updates[0].toV
|
||||
const toV = this.$scope.history.updates[0].toV
|
||||
let fromV = null
|
||||
|
||||
let indexOfLastUpdateNotByMe = 0
|
||||
|
@ -474,7 +474,7 @@ export default HistoryManager = (function () {
|
|||
return
|
||||
}
|
||||
let versionToSelect = this.$scope.history.updates[0].toV
|
||||
let range = this.$scope.history.selection.range
|
||||
const range = this.$scope.history.selection.range
|
||||
if (
|
||||
range.toV != null &&
|
||||
range.fromV != null &&
|
||||
|
@ -504,7 +504,7 @@ export default HistoryManager = (function () {
|
|||
}
|
||||
|
||||
selectVersionForPointInTime(version) {
|
||||
let selection = this.$scope.history.selection
|
||||
const selection = this.$scope.history.selection
|
||||
if (
|
||||
selection.range.toV !== version &&
|
||||
selection.range.fromV !== version
|
||||
|
@ -516,7 +516,7 @@ export default HistoryManager = (function () {
|
|||
}
|
||||
|
||||
selectVersionsForCompare(toV, fromV) {
|
||||
let range = this.$scope.history.selection.range
|
||||
const range = this.$scope.history.selection.range
|
||||
if (range.toV !== toV || range.fromV !== fromV) {
|
||||
range.toV = toV
|
||||
range.fromV = fromV
|
||||
|
@ -559,7 +559,7 @@ export default HistoryManager = (function () {
|
|||
return
|
||||
}
|
||||
|
||||
for (let update of Array.from(this.$scope.history.updates)) {
|
||||
for (const update of Array.from(this.$scope.history.updates)) {
|
||||
if (update.toV === labelToSelect.version) {
|
||||
updateToSelect = update
|
||||
break
|
||||
|
@ -569,7 +569,7 @@ export default HistoryManager = (function () {
|
|||
if (updateToSelect != null) {
|
||||
this.selectVersionForPointInTime(updateToSelect.toV)
|
||||
} else {
|
||||
let selection = this.$scope.history.selection
|
||||
const selection = this.$scope.history.selection
|
||||
selection.range.toV = labelToSelect.version
|
||||
selection.range.fromV = labelToSelect.version
|
||||
this.loadFileTreeForVersion(labelToSelect.version)
|
||||
|
@ -577,7 +577,7 @@ export default HistoryManager = (function () {
|
|||
}
|
||||
|
||||
getUpdateForVersion(version) {
|
||||
for (let update of this.$scope.history.updates) {
|
||||
for (const update of this.$scope.history.updates) {
|
||||
if (update.toV === version) {
|
||||
return update
|
||||
}
|
||||
|
@ -585,7 +585,7 @@ export default HistoryManager = (function () {
|
|||
}
|
||||
|
||||
autoSelectLabelsForComparison() {
|
||||
let labels = this.$scope.history.labels
|
||||
const labels = this.$scope.history.labels
|
||||
let nLabels = 0
|
||||
if (Array.isArray(labels)) {
|
||||
nLabels = labels.length
|
||||
|
@ -657,11 +657,11 @@ export default HistoryManager = (function () {
|
|||
}
|
||||
|
||||
_loadLabels(labels, lastUpdateToV) {
|
||||
let sortedLabels = this._sortLabelsByVersionAndDate(labels)
|
||||
let labelsWithoutPseudoLabel = this._deletePseudoCurrentStateLabelIfExistent(
|
||||
const sortedLabels = this._sortLabelsByVersionAndDate(labels)
|
||||
const labelsWithoutPseudoLabel = this._deletePseudoCurrentStateLabelIfExistent(
|
||||
sortedLabels
|
||||
)
|
||||
let labelsWithPseudoLabelIfNeeded = this._addPseudoCurrentStateLabelIfNeeded(
|
||||
const labelsWithPseudoLabelIfNeeded = this._addPseudoCurrentStateLabelIfNeeded(
|
||||
labelsWithoutPseudoLabel,
|
||||
lastUpdateToV
|
||||
)
|
||||
|
@ -680,7 +680,7 @@ export default HistoryManager = (function () {
|
|||
(labels.length && labels[0].version !== mostRecentVersion) ||
|
||||
labels.length === 0
|
||||
) {
|
||||
let pseudoCurrentStateLabel = {
|
||||
const pseudoCurrentStateLabel = {
|
||||
id: '1',
|
||||
isPseudoCurrentStateLabel: true,
|
||||
version: mostRecentVersion,
|
||||
|
@ -911,7 +911,7 @@ export default HistoryManager = (function () {
|
|||
const iterable = updates || []
|
||||
for (let i = 0; i < iterable.length; i++) {
|
||||
const update = iterable[i]
|
||||
for (let user of Array.from(update.meta.users || [])) {
|
||||
for (const user of Array.from(update.meta.users || [])) {
|
||||
if (user != null) {
|
||||
user.hue = ColorManager.getHueForUserId(user.id)
|
||||
}
|
||||
|
@ -986,7 +986,7 @@ export default HistoryManager = (function () {
|
|||
}
|
||||
|
||||
_updateContainsUserId(update, user_id) {
|
||||
for (let user of Array.from(update.meta.users)) {
|
||||
for (const user of Array.from(update.meta.users)) {
|
||||
if ((user != null ? user.id : undefined) === user_id) {
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ const historyFileEntityController = function ($scope, $element, $attrs) {
|
|||
const ctrl = this
|
||||
ctrl.hasOperation = false
|
||||
ctrl.getRenameTooltip = i18nRenamedStr => {
|
||||
let [simplifiedOldPathname, simplifiedPathname] = _getSimplifiedPaths(
|
||||
const [simplifiedOldPathname, simplifiedPathname] = _getSimplifiedPaths(
|
||||
ctrl.fileEntity.oldPathname,
|
||||
ctrl.fileEntity.pathname
|
||||
)
|
||||
|
@ -37,9 +37,9 @@ const historyFileEntityController = function ($scope, $element, $attrs) {
|
|||
}
|
||||
|
||||
const _getSimplifiedPaths = (path1, path2) => {
|
||||
let path1Parts = path1.split('/')
|
||||
let path2Parts = path2.split('/')
|
||||
let maxIterations = Math.min(path1Parts.length, path2Parts.length) - 1
|
||||
const path1Parts = path1.split('/')
|
||||
const path2Parts = path2.split('/')
|
||||
const maxIterations = Math.min(path1Parts.length, path2Parts.length) - 1
|
||||
for (
|
||||
var commonPartIndex = 0;
|
||||
commonPartIndex < maxIterations;
|
||||
|
|
|
@ -61,7 +61,7 @@ App.controller('HistoryListController', function ($scope, $modal, ide) {
|
|||
$scope.history.selection.updates = []
|
||||
return (() => {
|
||||
const result = []
|
||||
for (let update of Array.from($scope.history.updates)) {
|
||||
for (const update of Array.from($scope.history.updates)) {
|
||||
var inSelection
|
||||
if (update.selectedTo) {
|
||||
inSelection = true
|
||||
|
@ -140,7 +140,7 @@ App.controller('HistoryListController', function ($scope, $modal, ide) {
|
|||
$scope.resetHoverState = () =>
|
||||
(() => {
|
||||
const result = []
|
||||
for (let update of Array.from($scope.history.updates)) {
|
||||
for (const update of Array.from($scope.history.updates)) {
|
||||
delete update.hoverSelectedFrom
|
||||
delete update.hoverSelectedTo
|
||||
result.push(delete update.inHoverSelection)
|
||||
|
@ -160,7 +160,7 @@ export default App.controller(
|
|||
'update.selectedFrom',
|
||||
function (selectedFrom, oldSelectedFrom) {
|
||||
if (selectedFrom) {
|
||||
for (let update of Array.from($scope.history.updates)) {
|
||||
for (const update of Array.from($scope.history.updates)) {
|
||||
if (update !== $scope.update) {
|
||||
update.selectedFrom = false
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ export default App.controller(
|
|||
|
||||
$scope.$watch('update.selectedTo', function (selectedTo, oldSelectedTo) {
|
||||
if (selectedTo) {
|
||||
for (let update of Array.from($scope.history.updates)) {
|
||||
for (const update of Array.from($scope.history.updates)) {
|
||||
if (update !== $scope.update) {
|
||||
update.selectedTo = false
|
||||
}
|
||||
|
|
|
@ -15,8 +15,6 @@ import App from '../../../base'
|
|||
export default App.controller(
|
||||
'HistoryV2ToolbarController',
|
||||
($scope, $modal, ide, eventTracking, waitFor) => {
|
||||
let openEntity
|
||||
|
||||
$scope.currentUpdate = null
|
||||
$scope.currentLabel = null
|
||||
|
||||
|
@ -29,7 +27,7 @@ export default App.controller(
|
|||
showOnlyLabels: false,
|
||||
}
|
||||
|
||||
let _deregistershowOnlyLabelsWatcher = $scope.$watch(
|
||||
const _deregistershowOnlyLabelsWatcher = $scope.$watch(
|
||||
'history.showOnlyLabels',
|
||||
showOnlyLabels => {
|
||||
if (showOnlyLabels != null) {
|
||||
|
@ -103,7 +101,7 @@ export default App.controller(
|
|||
})
|
||||
}
|
||||
|
||||
openEntity = function (data) {
|
||||
function openEntity(data) {
|
||||
const { id, type } = data
|
||||
return waitFor(() => ide.fileTreeManager.findEntityById(id), 3000)
|
||||
.then(function (entity) {
|
||||
|
|
|
@ -11,7 +11,7 @@ export default {
|
|||
}
|
||||
|
||||
const _getRule = function (logMessage) {
|
||||
for (let rule of ruleset) {
|
||||
for (const rule of ruleset) {
|
||||
if (rule.regexToMatch.test(logMessage)) {
|
||||
return rule
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ export default {
|
|||
|
||||
const seenErrorTypes = {} // keep track of types of errors seen
|
||||
|
||||
for (let entry of parsedLogEntries.all) {
|
||||
for (const entry of parsedLogEntries.all) {
|
||||
const ruleDetails = _getRule(entry.message)
|
||||
|
||||
if (ruleDetails != null) {
|
||||
|
@ -70,7 +70,7 @@ export default {
|
|||
}
|
||||
|
||||
// filter out the suppressed errors (from the array entries in parsedLogEntries)
|
||||
for (let key in parsedLogEntries) {
|
||||
for (const key in parsedLogEntries) {
|
||||
const errors = parsedLogEntries[key]
|
||||
if (typeof errors === 'object' && errors.length > 0) {
|
||||
parsedLogEntries[key] = Array.from(errors).filter(
|
||||
|
|
|
@ -42,7 +42,7 @@ export default App.factory('metadata', function ($http, ide) {
|
|||
_.flattenDeep(
|
||||
(() => {
|
||||
const result = []
|
||||
for (let docId in state.documents) {
|
||||
for (const docId in state.documents) {
|
||||
const meta = state.documents[docId]
|
||||
result.push(meta.labels)
|
||||
}
|
||||
|
@ -52,9 +52,9 @@ export default App.factory('metadata', function ($http, ide) {
|
|||
|
||||
metadata.getAllPackages = function () {
|
||||
const packageCommandMapping = {}
|
||||
for (let _docId in state.documents) {
|
||||
for (const _docId in state.documents) {
|
||||
const meta = state.documents[_docId]
|
||||
for (let packageName in meta.packages) {
|
||||
for (const packageName in meta.packages) {
|
||||
const commandSnippets = meta.packages[packageName]
|
||||
packageCommandMapping[packageName] = commandSnippets
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ export default App.factory('metadata', function ($http, ide) {
|
|||
if (data.projectMeta) {
|
||||
return (() => {
|
||||
const result = []
|
||||
for (let docId in data.projectMeta) {
|
||||
for (const docId in data.projectMeta) {
|
||||
const docMeta = data.projectMeta[docId]
|
||||
result.push((state.documents[docId] = docMeta))
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ export default OnlineUsersManager = (function () {
|
|||
'clientTracking.getConnectedUsers',
|
||||
(error, connectedUsers) => {
|
||||
this.$scope.onlineUsers = {}
|
||||
for (let user of Array.from(connectedUsers || [])) {
|
||||
for (const user of Array.from(connectedUsers || [])) {
|
||||
if (user.client_id === this.ide.socket.publicId) {
|
||||
// Don't store myself
|
||||
continue
|
||||
|
|
|
@ -565,10 +565,10 @@ App.controller(
|
|||
}
|
||||
|
||||
function accumulateResults(newEntries) {
|
||||
for (let key of ['all', 'errors', 'warnings', 'typesetting']) {
|
||||
for (const key of ['all', 'errors', 'warnings', 'typesetting']) {
|
||||
if (newEntries[key]) {
|
||||
if (newEntries.type != null) {
|
||||
for (let entry of newEntries[key]) {
|
||||
for (const entry of newEntries[key]) {
|
||||
entry.type = newEntries.type
|
||||
}
|
||||
}
|
||||
|
@ -590,7 +590,7 @@ App.controller(
|
|||
function processChkTex(log) {
|
||||
const errors = []
|
||||
const warnings = []
|
||||
for (let line of log.split('\n')) {
|
||||
for (const line of log.split('\n')) {
|
||||
var m
|
||||
if ((m = line.match(/^(\S+):(\d+):(\d+): (Error|Warning): (.*)/))) {
|
||||
const result = {
|
||||
|
@ -731,7 +731,7 @@ App.controller(
|
|||
if (doc == null) {
|
||||
return null
|
||||
}
|
||||
for (let line of doc.split('\n')) {
|
||||
for (const line of doc.split('\n')) {
|
||||
if (/^[^%]*\\documentclass/.test(line)) {
|
||||
return ide.editorManager.getCurrentDocId()
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ App.factory('pdfAnnotations', function () {
|
|||
|
||||
setAnnotations(annotations) {
|
||||
const result = []
|
||||
for (let annotation of annotations) {
|
||||
for (const annotation of annotations) {
|
||||
switch (annotation.subtype) {
|
||||
case 'Link':
|
||||
result.push(this.addLink(annotation))
|
||||
|
|
|
@ -42,7 +42,7 @@ export default App.factory('pdfHighlights', function () {
|
|||
}
|
||||
|
||||
clearHighlights() {
|
||||
for (let h of Array.from(this.highlightElements)) {
|
||||
for (const h of Array.from(this.highlightElements)) {
|
||||
if (h != null) {
|
||||
h.parentNode.removeChild(h)
|
||||
}
|
||||
|
|
|
@ -124,7 +124,7 @@ export default App.directive('pdfng', ($timeout, localStorage) => ({
|
|||
}
|
||||
|
||||
if (attrs.resizeOn != null) {
|
||||
for (let event of Array.from(attrs.resizeOn.split(','))) {
|
||||
for (const event of Array.from(attrs.resizeOn.split(','))) {
|
||||
scope.$on(event, function (e) {})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ export default App.directive(
|
|||
scope.document.getPdfViewport(scope.page.pageNum).then(viewport =>
|
||||
(() => {
|
||||
const result1 = []
|
||||
for (let hl of Array.from(pageHighlights)) {
|
||||
for (const hl of Array.from(pageHighlights)) {
|
||||
// console.log 'adding highlight', h, viewport
|
||||
const top = viewport.viewBox[3] - hl.v
|
||||
result1.push(
|
||||
|
|
|
@ -95,10 +95,10 @@ export default App.factory(
|
|||
clearTimeout(this.queueTimer)
|
||||
}
|
||||
// clear any existing timers, render tasks
|
||||
for (let timer of Array.from(this.spinTimer || [])) {
|
||||
for (const timer of Array.from(this.spinTimer || [])) {
|
||||
clearTimeout(timer)
|
||||
}
|
||||
for (let page of Array.from(this.pageState || [])) {
|
||||
for (const page of Array.from(this.pageState || [])) {
|
||||
__guard__(page != null ? page.loadTask : undefined, x => x.cancel())
|
||||
__guard__(page != null ? page.renderTask : undefined, x1 =>
|
||||
x1.cancel()
|
||||
|
@ -233,7 +233,7 @@ export default App.factory(
|
|||
this.queuedPages[page.pagenum] = true
|
||||
}
|
||||
// clear any unfinished spinner timers on pages that aren't in the queue any more
|
||||
for (let pagenum in this.spinTimer) {
|
||||
for (const pagenum in this.spinTimer) {
|
||||
if (!this.queuedPages[pagenum]) {
|
||||
clearTimeout(this.spinTimer[pagenum])
|
||||
delete this.spinTimer[pagenum]
|
||||
|
@ -258,7 +258,7 @@ export default App.factory(
|
|||
const [canvas, pagenum] = Array.from(this.getPageDetails(page))
|
||||
canvas.addClass('pdfng-loading')
|
||||
return (this.spinTimer[pagenum] = setTimeout(() => {
|
||||
for (let queuedPage of Array.from(this.renderQueue)) {
|
||||
for (const queuedPage of Array.from(this.renderQueue)) {
|
||||
if (pagenum === queuedPage.pagenum) {
|
||||
this.spinner.add(canvas, { static: true })
|
||||
this.spinTimerDone[pagenum] = true
|
||||
|
|
|
@ -829,9 +829,9 @@ export default App.directive('pdfViewer', ($q, $timeout, pdfSpinner) => ({
|
|||
}))
|
||||
|
||||
function __range__(left, right, inclusive) {
|
||||
let range = []
|
||||
let ascending = left < right
|
||||
let end = !inclusive ? right : ascending ? right + 1 : right - 1
|
||||
const range = []
|
||||
const ascending = left < right
|
||||
const end = !inclusive ? right : ascending ? right + 1 : right - 1
|
||||
for (let i = left; ascending ? i < end : i > end; ascending ? i++ : i--) {
|
||||
range.push(i)
|
||||
}
|
||||
|
|
|
@ -106,7 +106,7 @@ export default RangesTracker = class RangesTracker {
|
|||
|
||||
getComment(comment_id) {
|
||||
let comment = null
|
||||
for (let c of Array.from(this.comments)) {
|
||||
for (const c of Array.from(this.comments)) {
|
||||
if (c.id === comment_id) {
|
||||
comment = c
|
||||
break
|
||||
|
@ -127,7 +127,7 @@ export default RangesTracker = class RangesTracker {
|
|||
moveCommentId(comment_id, position, text) {
|
||||
return (() => {
|
||||
const result = []
|
||||
for (let comment of Array.from(this.comments)) {
|
||||
for (const comment of Array.from(this.comments)) {
|
||||
if (comment.id === comment_id) {
|
||||
comment.op.p = position
|
||||
comment.op.c = text
|
||||
|
@ -142,7 +142,7 @@ export default RangesTracker = class RangesTracker {
|
|||
|
||||
getChange(change_id) {
|
||||
let change = null
|
||||
for (let c of Array.from(this.changes)) {
|
||||
for (const c of Array.from(this.changes)) {
|
||||
if (c.id === change_id) {
|
||||
change = c
|
||||
break
|
||||
|
@ -155,11 +155,11 @@ export default RangesTracker = class RangesTracker {
|
|||
const changes_response = []
|
||||
const ids_map = {}
|
||||
|
||||
for (let change_id of Array.from(change_ids)) {
|
||||
for (const change_id of Array.from(change_ids)) {
|
||||
ids_map[change_id] = true
|
||||
}
|
||||
|
||||
for (let change of Array.from(this.changes)) {
|
||||
for (const change of Array.from(this.changes)) {
|
||||
if (ids_map[change.id]) {
|
||||
delete ids_map[change.id]
|
||||
changes_response.push(change)
|
||||
|
@ -187,13 +187,13 @@ export default RangesTracker = class RangesTracker {
|
|||
}
|
||||
const i = this.changes.length
|
||||
const remove_change_id = {}
|
||||
for (let change_id of Array.from(change_to_remove_ids)) {
|
||||
for (const change_id of Array.from(change_to_remove_ids)) {
|
||||
remove_change_id[change_id] = true
|
||||
}
|
||||
|
||||
const remaining_changes = []
|
||||
|
||||
for (let change of Array.from(this.changes)) {
|
||||
for (const change of Array.from(this.changes)) {
|
||||
if (remove_change_id[change.id]) {
|
||||
delete remove_change_id[change.id]
|
||||
this._markAsDirty(change, 'change', 'removed')
|
||||
|
@ -207,7 +207,7 @@ export default RangesTracker = class RangesTracker {
|
|||
|
||||
validate(text) {
|
||||
let content
|
||||
for (let change of Array.from(this.changes)) {
|
||||
for (const change of Array.from(this.changes)) {
|
||||
if (change.op.i != null) {
|
||||
content = text.slice(change.op.p, change.op.p + change.op.i.length)
|
||||
if (content !== change.op.i) {
|
||||
|
@ -219,7 +219,7 @@ export default RangesTracker = class RangesTracker {
|
|||
}
|
||||
}
|
||||
}
|
||||
for (let comment of Array.from(this.comments)) {
|
||||
for (const comment of Array.from(this.comments)) {
|
||||
content = text.slice(comment.op.p, comment.op.p + comment.op.c.length)
|
||||
if (content !== comment.op.c) {
|
||||
throw new Error(
|
||||
|
@ -287,7 +287,7 @@ export default RangesTracker = class RangesTracker {
|
|||
applyInsertToComments(op) {
|
||||
return (() => {
|
||||
const result = []
|
||||
for (let comment of Array.from(this.comments)) {
|
||||
for (const comment of Array.from(this.comments)) {
|
||||
if (op.p <= comment.op.p) {
|
||||
comment.op.p += op.i.length
|
||||
result.push(this._markAsDirty(comment, 'comment', 'moved'))
|
||||
|
@ -312,7 +312,7 @@ export default RangesTracker = class RangesTracker {
|
|||
const op_end = op.p + op_length
|
||||
return (() => {
|
||||
const result = []
|
||||
for (let comment of Array.from(this.comments)) {
|
||||
for (const comment of Array.from(this.comments)) {
|
||||
const comment_start = comment.op.p
|
||||
const comment_end = comment.op.p + comment.op.c.length
|
||||
const comment_length = comment_end - comment_start
|
||||
|
@ -492,7 +492,7 @@ export default RangesTracker = class RangesTracker {
|
|||
},
|
||||
metadata: {},
|
||||
}
|
||||
for (let key in change.metadata) {
|
||||
for (const key in change.metadata) {
|
||||
const value = change.metadata[key]
|
||||
after_change.metadata[key] = value
|
||||
}
|
||||
|
@ -736,7 +736,7 @@ export default RangesTracker = class RangesTracker {
|
|||
}
|
||||
})
|
||||
|
||||
for (let modification of Array.from(op_modifications)) {
|
||||
for (const modification of Array.from(op_modifications)) {
|
||||
if (modification.i != null) {
|
||||
content =
|
||||
content.slice(0, modification.p) +
|
||||
|
@ -770,7 +770,7 @@ export default RangesTracker = class RangesTracker {
|
|||
let previous_change = null
|
||||
const remove_changes = []
|
||||
const moved_changes = []
|
||||
for (let change of Array.from(this.changes)) {
|
||||
for (const change of Array.from(this.changes)) {
|
||||
if (
|
||||
(previous_change != null ? previous_change.op.i : undefined) != null &&
|
||||
change.op.i != null
|
||||
|
@ -830,7 +830,7 @@ export default RangesTracker = class RangesTracker {
|
|||
|
||||
_clone(object) {
|
||||
const clone = {}
|
||||
for (let k in object) {
|
||||
for (const k in object) {
|
||||
const v = object[k]
|
||||
clone[k] = v
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ export default App.controller(
|
|||
) {
|
||||
return UserTypes.MEMBER
|
||||
}
|
||||
for (let member of Array.from(project.members)) {
|
||||
for (const member of Array.from(project.members)) {
|
||||
if (member._id === user_id) {
|
||||
return UserTypes.MEMBER
|
||||
}
|
||||
|
@ -106,7 +106,7 @@ export default App.controller(
|
|||
|
||||
window.addEventListener('beforeunload', function () {
|
||||
const collapsedStates = {}
|
||||
for (let doc in $scope.reviewPanel.overview.docsCollapsedState) {
|
||||
for (const doc in $scope.reviewPanel.overview.docsCollapsedState) {
|
||||
const state = $scope.reviewPanel.overview.docsCollapsedState[doc]
|
||||
if (state) {
|
||||
collapsedStates[doc] = state
|
||||
|
@ -159,7 +159,7 @@ export default App.controller(
|
|||
) {
|
||||
return (() => {
|
||||
const result = []
|
||||
for (let member of Array.from(members)) {
|
||||
for (const member of Array.from(members)) {
|
||||
if (member.privileges === 'readAndWrite') {
|
||||
if ($scope.reviewPanel.trackChangesState[member._id] == null) {
|
||||
// An added member will have track changes enabled if track changes is on for everyone
|
||||
|
@ -347,7 +347,7 @@ export default App.controller(
|
|||
const entries =
|
||||
$scope.reviewPanel.entries[$scope.editor.open_doc_id] || {}
|
||||
const permEntries = {}
|
||||
for (let entry in entries) {
|
||||
for (const entry in entries) {
|
||||
const entryData = entries[entry]
|
||||
if (!['add-comment', 'bulk-actions'].includes(entry)) {
|
||||
permEntries[entry] = entryData
|
||||
|
@ -374,7 +374,7 @@ export default App.controller(
|
|||
const docs = response.data
|
||||
return (() => {
|
||||
const result = []
|
||||
for (let doc of Array.from(docs)) {
|
||||
for (const doc of Array.from(docs)) {
|
||||
if (
|
||||
$scope.reviewPanel.overview.docsCollapsedState[doc.id] == null
|
||||
) {
|
||||
|
@ -485,7 +485,7 @@ export default App.controller(
|
|||
ensureThreadsAreLoaded()
|
||||
}
|
||||
|
||||
for (let comment of Array.from(rangesTracker.comments)) {
|
||||
for (const comment of Array.from(rangesTracker.comments)) {
|
||||
var new_comment
|
||||
changed = true
|
||||
delete delete_changes[comment.id]
|
||||
|
@ -515,7 +515,7 @@ export default App.controller(
|
|||
}
|
||||
}
|
||||
|
||||
for (let change_id in delete_changes) {
|
||||
for (const change_id in delete_changes) {
|
||||
const _ = delete_changes[change_id]
|
||||
changed = true
|
||||
delete entries[change_id]
|
||||
|
@ -567,7 +567,7 @@ export default App.controller(
|
|||
}
|
||||
}
|
||||
|
||||
for (let id in entries) {
|
||||
for (const id in entries) {
|
||||
const entry = entries[id]
|
||||
let isChangeEntryAndWithinSelection = false
|
||||
if (
|
||||
|
@ -604,7 +604,7 @@ export default App.controller(
|
|||
}
|
||||
|
||||
if (isChangeEntryAndWithinSelection) {
|
||||
for (let entry_id of Array.from(entry.entry_ids)) {
|
||||
for (const entry_id of Array.from(entry.entry_ids)) {
|
||||
$scope.reviewPanel.selectedEntryIds.push(entry_id)
|
||||
}
|
||||
$scope.reviewPanel.nVisibleSelectedChanges++
|
||||
|
@ -841,7 +841,7 @@ export default App.controller(
|
|||
if (thread == null) {
|
||||
return
|
||||
}
|
||||
for (let message of Array.from(thread.messages)) {
|
||||
for (const message of Array.from(thread.messages)) {
|
||||
if (message.id === comment_id) {
|
||||
message.content = content
|
||||
}
|
||||
|
@ -955,7 +955,7 @@ export default App.controller(
|
|||
}
|
||||
$scope.reviewPanel.trackChangesOnForEveryone = newValue
|
||||
const { project } = $scope
|
||||
for (let member of Array.from(project.members)) {
|
||||
for (const member of Array.from(project.members)) {
|
||||
_setUserTCState(member._id, newValue, isLocal)
|
||||
}
|
||||
_setGuestsTCState(newValue, isLocal)
|
||||
|
@ -981,7 +981,7 @@ export default App.controller(
|
|||
data.on = true
|
||||
} else {
|
||||
data.on_for = {}
|
||||
for (let userId in $scope.reviewPanel.trackChangesState) {
|
||||
for (const userId in $scope.reviewPanel.trackChangesState) {
|
||||
const userState = $scope.reviewPanel.trackChangesState[userId]
|
||||
data.on_for[userId] = userState.value
|
||||
}
|
||||
|
@ -1001,7 +1001,7 @@ export default App.controller(
|
|||
const { project } = $scope
|
||||
$scope.reviewPanel.trackChangesOnForEveryone = false
|
||||
_setGuestsTCState(state.__guests__ === true)
|
||||
for (let member of Array.from(project.members)) {
|
||||
for (const member of Array.from(project.members)) {
|
||||
_setUserTCState(
|
||||
member._id,
|
||||
state[member._id] != null ? state[member._id] : false
|
||||
|
@ -1130,7 +1130,7 @@ export default App.controller(
|
|||
}
|
||||
return (() => {
|
||||
const result = []
|
||||
for (let user of Array.from(users)) {
|
||||
for (const user of Array.from(users)) {
|
||||
if (user.id != null) {
|
||||
result.push(($scope.users[user.id] = formatUser(user)))
|
||||
} else {
|
||||
|
@ -1162,7 +1162,7 @@ export default App.controller(
|
|||
}
|
||||
for (thread_id in threads) {
|
||||
const thread = threads[thread_id]
|
||||
for (let comment of Array.from(thread.messages)) {
|
||||
for (const comment of Array.from(thread.messages)) {
|
||||
formatComment(comment)
|
||||
}
|
||||
if (thread.resolved_by_user != null) {
|
||||
|
|
|
@ -75,7 +75,7 @@ export default App.directive('resolvedCommentsDropdown', () => ({
|
|||
result.push(
|
||||
(() => {
|
||||
const result1 = []
|
||||
for (let entryId in docEntries) {
|
||||
for (const entryId in docEntries) {
|
||||
const entry = docEntries[entryId]
|
||||
if (
|
||||
entry.type === 'comment' &&
|
||||
|
|
|
@ -48,7 +48,7 @@ export default App.directive('reviewPanelSorted', $timeout => ({
|
|||
}
|
||||
|
||||
const entries = []
|
||||
for (let el of Array.from(element.find('.rp-entry-wrapper'))) {
|
||||
for (const el of Array.from(element.find('.rp-entry-wrapper'))) {
|
||||
entry = {
|
||||
$indicator_el: $(el).find('.rp-entry-indicator'),
|
||||
$box_el: $(el).find('.rp-entry'),
|
||||
|
|
|
@ -12,7 +12,7 @@ export default App.filter(
|
|||
() =>
|
||||
function (items) {
|
||||
const array = []
|
||||
for (let key in items) {
|
||||
for (const key in items) {
|
||||
const value = items[key]
|
||||
value.entry_id = key
|
||||
array.push(value)
|
||||
|
|
|
@ -66,7 +66,7 @@ App.factory(
|
|||
meta.recent_events = this.recentEvents
|
||||
const errorObj = {}
|
||||
if (typeof error === 'object') {
|
||||
for (let key of Array.from(Object.getOwnPropertyNames(error))) {
|
||||
for (const key of Array.from(Object.getOwnPropertyNames(error))) {
|
||||
errorObj[key] = error[key]
|
||||
}
|
||||
} else if (typeof error === 'string') {
|
||||
|
|
|
@ -15,7 +15,7 @@ import App from '../../../base'
|
|||
export default App.factory('settings', (ide, eventTracking) => ({
|
||||
saveSettings(data) {
|
||||
// Tracking code.
|
||||
for (let key of Array.from(Object.keys(data))) {
|
||||
for (const key of Array.from(Object.keys(data))) {
|
||||
const changedSetting = key
|
||||
const changedSettingVal = data[key]
|
||||
eventTracking.sendMB('setting-changed', {
|
||||
|
|
|
@ -69,7 +69,7 @@ App.controller('ShareProjectModalController', function (
|
|||
function processContactsResponse(response) {
|
||||
const { data } = response
|
||||
$scope.autocompleteContacts = data.contacts || []
|
||||
for (let contact of $scope.autocompleteContacts) {
|
||||
for (const contact of $scope.autocompleteContacts) {
|
||||
if (contact.type === 'user') {
|
||||
if (
|
||||
contact.first_name === contact.email.split('@')[0] &&
|
||||
|
@ -103,7 +103,7 @@ App.controller('ShareProjectModalController', function (
|
|||
) {
|
||||
return false
|
||||
}
|
||||
for (let text of [contact.name, contact.email]) {
|
||||
for (const text of [contact.name, contact.email]) {
|
||||
if (
|
||||
text != null &&
|
||||
text.toLowerCase().indexOf($query.toLowerCase()) > -1
|
||||
|
|
|
@ -30,11 +30,10 @@ function startFreeTrial(source, version, $scope, eventTracking) {
|
|||
function upgradePlan(source, $scope) {
|
||||
const w = window.open()
|
||||
const go = function () {
|
||||
let url
|
||||
if (typeof ga === 'function') {
|
||||
ga('send', 'event', 'subscription-funnel', 'upgraded-plan', source)
|
||||
}
|
||||
url = '/user/subscription'
|
||||
const url = '/user/subscription'
|
||||
|
||||
if ($scope) {
|
||||
$scope.startedFreeTrial = true
|
||||
|
|
|
@ -189,7 +189,7 @@ export default App.controller(
|
|||
_monitorRequest(
|
||||
UserAffiliationsDataService.setDefaultUserEmail(userEmail.email)
|
||||
).then(function () {
|
||||
for (let email of $scope.userEmails || []) {
|
||||
for (const email of $scope.userEmails || []) {
|
||||
email.default = false
|
||||
}
|
||||
userEmail.default = true
|
||||
|
|
|
@ -400,8 +400,8 @@ const commonDomains = [
|
|||
'foxmail',
|
||||
]
|
||||
|
||||
for (let domain of commonDomains) {
|
||||
for (let tld of commonTLDs) {
|
||||
for (const domain of commonDomains) {
|
||||
for (const tld of commonTLDs) {
|
||||
domainsBlackList[`${domain}.${tld}`] = true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,7 +58,7 @@ App.controller(
|
|||
const lines = content.split('\n')
|
||||
// Only show the lines that have a highlighted match
|
||||
const matching_lines = []
|
||||
for (let line of Array.from(lines)) {
|
||||
for (const line of Array.from(lines)) {
|
||||
if (!/^\[edit\]/.test(line)) {
|
||||
content += line + '\n'
|
||||
if (/<em>/.test(line)) {
|
||||
|
|
|
@ -125,7 +125,7 @@ export default App.controller(
|
|||
$scope.monthlyBilling = pricing.items.plan.period.length === 1
|
||||
|
||||
$scope.availableCurrencies = {}
|
||||
for (let currencyCode in pricing.items.plan.price) {
|
||||
for (const currencyCode in pricing.items.plan.price) {
|
||||
if (MultiCurrencyPricing.plans[currencyCode]) {
|
||||
$scope.availableCurrencies[currencyCode] =
|
||||
MultiCurrencyPricing.plans[currencyCode]
|
||||
|
|
|
@ -244,8 +244,6 @@ App.controller(
|
|||
$filter,
|
||||
$location
|
||||
) {
|
||||
let switchEvent
|
||||
|
||||
$scope.plans = MultiCurrencyPricing.plans
|
||||
|
||||
$scope.currencyCode = MultiCurrencyPricing.currencyCode
|
||||
|
@ -331,7 +329,7 @@ App.controller(
|
|||
|
||||
var eventLabel = (label, location) => label
|
||||
|
||||
switchEvent = function (e, label, location) {
|
||||
function switchEvent(e, label, location) {
|
||||
e.preventDefault()
|
||||
const gaLabel = eventLabel(label, location)
|
||||
eventTracking.send('subscription-funnel', 'plans-page', gaLabel)
|
||||
|
@ -439,7 +437,7 @@ App.controller(
|
|||
}
|
||||
|
||||
$scope.recalculatePrice = function () {
|
||||
let { usage, plan_code, currency, size } = $scope.selected
|
||||
const { usage, plan_code, currency, size } = $scope.selected
|
||||
const price = $scope.prices[usage][plan_code][currency][size]
|
||||
const currencySymbol = $scope.options.currencySymbols[currency]
|
||||
$scope.displayPrice = `${currencySymbol}${price}`
|
||||
|
|
|
@ -2,7 +2,7 @@ import App from '../../base'
|
|||
|
||||
const ExposedSettings = window.ExposedSettings
|
||||
App.controller('NotificationsController', function ($scope, $http) {
|
||||
for (let notification of $scope.notifications || []) {
|
||||
for (const notification of $scope.notifications || []) {
|
||||
notification.hide = false
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ App.controller(
|
|||
}
|
||||
return false
|
||||
}
|
||||
for (let userEmail of $scope.userEmails) {
|
||||
for (const userEmail of $scope.userEmails) {
|
||||
userEmail.hide = false
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue