mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-08 15:21:24 +00:00
OlProjectGetter now just detects if integration module is loaded and proxies to integration module. If module not loaded, it just bails
22 lines
929 B
CoffeeScript
22 lines
929 B
CoffeeScript
fs = require 'fs'
|
|
path = require 'path'
|
|
logger = require 'logger-sharelatex'
|
|
|
|
INTEGRATION_MODULE_PATH = path.resolve(__dirname, '../../../../modules/overleaf-integration-web-module')
|
|
|
|
module.exports = OlProjectGetter =
|
|
integrationModuleExists: (callback = (error, stats) ->) ->
|
|
fs.stat INTEGRATION_MODULE_PATH, (error, stats) ->
|
|
if error? or !stats.isDirectory()
|
|
return callback(false)
|
|
return callback(true)
|
|
|
|
findAllUsersProjects: (userId, callback = (error, projects) ->) ->
|
|
OlProjectGetter.integrationModuleExists (exists) ->
|
|
if exists
|
|
logger.log {exists}, "integration module does exist, loading V1 projects"
|
|
V1ProjectListGetter = require(path.join(INTEGRATION_MODULE_PATH, 'app/coffee/ProjectList/ProjectListGetter'))
|
|
V1ProjectListGetter.findAllUsersProjects(userId, callback)
|
|
else
|
|
logger.log {exists}, "integration modules doesn't exists, not loading V1 projects"
|
|
return callback()
|