mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
fix issues in first commit
This commit is contained in:
parent
476eaa8b84
commit
2d11705837
3 changed files with 31 additions and 16 deletions
|
@ -8,8 +8,8 @@ metrics = require('../../infrastructure/Metrics')
|
|||
Project = require('../../models/Project').Project
|
||||
User = require('../../models/User').User
|
||||
TagsHandler = require("../Tags/TagsHandler")
|
||||
NotificationsHandler = require("../Notifications/NotificationsHandler")
|
||||
SubscriptionLocator = require("../Subscription/SubscriptionLocator")
|
||||
NotificationsHandler = require("../Notifications/NotificationsHandler")
|
||||
LimitationsManager = require("../Subscription/LimitationsManager")
|
||||
_ = require("underscore")
|
||||
Settings = require("settings-sharelatex")
|
||||
|
@ -17,6 +17,8 @@ SecurityManager = require("../../managers/SecurityManager")
|
|||
fs = require "fs"
|
||||
InactiveProjectManager = require("../InactiveData/InactiveProjectManager")
|
||||
ProjectUpdateHandler = require("./ProjectUpdateHandler")
|
||||
ReferencesSearchHandler = require("../ReferencesSearch/ReferencesSearchHandler")
|
||||
|
||||
|
||||
module.exports = ProjectController =
|
||||
|
||||
|
@ -210,6 +212,7 @@ module.exports = ProjectController =
|
|||
user = results.user
|
||||
subscription = results.subscription
|
||||
|
||||
|
||||
daysSinceLastUpdated = (new Date() - project.lastUpdated) /86400000
|
||||
logger.log project_id:project_id, daysSinceLastUpdated:daysSinceLastUpdated, "got db results for loading editor"
|
||||
|
||||
|
@ -219,6 +222,10 @@ module.exports = ProjectController =
|
|||
|
||||
if subscription? and subscription.freeTrial? and subscription.freeTrial.expiresAt?
|
||||
allowedFreeTrial = !!subscription.freeTrial.allowed || true
|
||||
|
||||
# HACK: don't do it for now
|
||||
ReferencesSearchHandler.indexProjectReferences project, -> # don't need to wait on this
|
||||
|
||||
logger.log project_id:project_id, "rendering editor page"
|
||||
res.render 'project/editor',
|
||||
title: project.name
|
||||
|
@ -316,4 +323,3 @@ do generateThemeList = () ->
|
|||
if file.slice(-2) == "js" and file.match(/^theme-/)
|
||||
cleanName = file.slice(0,-3).slice(6)
|
||||
THEME_LIST.push cleanName
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ RateLimiterMiddlewear = require('./Features/Security/RateLimiterMiddlewear')
|
|||
RealTimeProxyRouter = require('./Features/RealTimeProxy/RealTimeProxyRouter')
|
||||
InactiveProjectController = require("./Features/InactiveData/InactiveProjectController")
|
||||
ContactRouter = require("./Features/Contacts/ContactRouter")
|
||||
ReferencesSearchController = require('./Features/ReferencesSearch/ReferencesSearchController')
|
||||
|
||||
logger = require("logger-sharelatex")
|
||||
_ = require("underscore")
|
||||
|
@ -174,6 +175,9 @@ module.exports = class Router
|
|||
|
||||
webRouter.get /learn(\/.*)?/, WikiController.getPage
|
||||
|
||||
webRouter.post "/project/:Project_id/references", SecurityManager.requestCanAccessProject, ReferencesSearchController.indexFile
|
||||
webRouter.get "/project/:Project_id/references/keys", SecurityManager.requestCanAccessProject, ReferencesSearchController.getKeys
|
||||
|
||||
#Admin Stuff
|
||||
webRouter.get '/admin', SecurityManager.requestIsAdmin, AdminController.index
|
||||
webRouter.get '/admin/user', SecurityManager.requestIsAdmin, (req, res)-> res.redirect("/admin/register") #this gets removed by admin-panel addon
|
||||
|
|
|
@ -33,6 +33,8 @@ describe "ProjectController", ->
|
|||
userHasSubscriptionOrIsGroupMember: sinon.stub()
|
||||
@TagsHandler =
|
||||
getAllTags: sinon.stub()
|
||||
@NotificationsHandler =
|
||||
getUserNotifications: sinon.stub()
|
||||
@ProjectModel =
|
||||
findAllUsersProjects: sinon.stub()
|
||||
findPopulatedById: sinon.stub()
|
||||
|
@ -60,6 +62,7 @@ describe "ProjectController", ->
|
|||
"../Subscription/SubscriptionLocator": @SubscriptionLocator
|
||||
"../Subscription/LimitationsManager": @LimitationsManager
|
||||
"../Tags/TagsHandler":@TagsHandler
|
||||
"../Notifications/NotificationsHandler":@NotificationsHandler
|
||||
'../../models/Project': Project:@ProjectModel
|
||||
"../../models/User":User:@UserModel
|
||||
"../../managers/SecurityManager":@SecurityManager
|
||||
|
@ -198,6 +201,7 @@ describe "ProjectController", ->
|
|||
|
||||
beforeEach ->
|
||||
@tags = [{name:1, project_ids:["1","2","3"]}, {name:2, project_ids:["a","1"]}, {name:3, project_ids:["a", "b", "c", "d"]}]
|
||||
@notifications = [{_id:'1',user_id:'2',templateKey:'3',messageOpts:'4',key:'5'}]
|
||||
@projects = [{lastUpdated:1, _id:1, owner_ref: "user-1"}, {lastUpdated:2, _id:2, owner_ref: "user-2"}]
|
||||
@collabertions = [{lastUpdated:5, _id:5, owner_ref: "user-1"}]
|
||||
@readOnly = [{lastUpdated:3, _id:3, owner_ref: "user-1"}]
|
||||
|
@ -213,6 +217,7 @@ describe "ProjectController", ->
|
|||
|
||||
@LimitationsManager.userHasSubscriptionOrIsGroupMember.callsArgWith(1, null, false)
|
||||
@TagsHandler.getAllTags.callsArgWith(1, null, @tags, {})
|
||||
@NotificationsHandler.getUserNotifications = sinon.stub().callsArgWith(1, null, @notifications, {})
|
||||
@ProjectModel.findAllUsersProjects.callsArgWith(2, null, @projects, @collabertions, @readOnly)
|
||||
|
||||
it "should render the project/list page", (done)->
|
||||
|
|
Loading…
Reference in a new issue