Use ProjectGetter, not Project, in ProjectController.loadEditor

This commit is contained in:
James Allen 2016-03-15 14:12:43 +00:00
parent d09705142e
commit fe1f71413e
2 changed files with 3 additions and 6 deletions

View file

@ -5,7 +5,6 @@ projectDuplicator = require("./ProjectDuplicator")
projectCreationHandler = require("./ProjectCreationHandler")
editorController = require("../Editor/EditorController")
metrics = require('../../infrastructure/Metrics')
Project = require('../../models/Project').Project
User = require('../../models/User').User
TagsHandler = require("../Tags/TagsHandler")
SubscriptionLocator = require("../Subscription/SubscriptionLocator")
@ -195,7 +194,7 @@ module.exports = ProjectController =
async.parallel {
project: (cb)->
Project.findOne { _id: project_id }, cb
ProjectGetter.getProject project_id, { name: 1, lastUpdated: 1}, cb
user: (cb)->
if user_id == 'openUser'
cb null, defaultSettingsForAnonymousUser(user_id)

View file

@ -35,8 +35,6 @@ describe "ProjectController", ->
getAllTags: sinon.stub()
@NotificationsHandler =
getUserNotifications: sinon.stub()
@ProjectModel =
findOne: sinon.stub()
@UserModel =
findById: sinon.stub()
@AuthorizationManager =
@ -51,6 +49,7 @@ describe "ProjectController", ->
indexProjectReferences: sinon.stub()
@ProjectGetter =
findAllUsersProjects: sinon.stub()
getProject: sinon.stub()
@ProjectController = SandboxedModule.require modulePath, requires:
"settings-sharelatex":@settings
"logger-sharelatex":
@ -64,7 +63,6 @@ describe "ProjectController", ->
"../Subscription/LimitationsManager": @LimitationsManager
"../Tags/TagsHandler":@TagsHandler
"../Notifications/NotificationsHandler":@NotificationsHandler
'../../models/Project': Project:@ProjectModel
"../../models/User":User:@UserModel
"../Authorization/AuthorizationManager":@AuthorizationManager
"../InactiveData/InactiveProjectManager":@InactiveProjectManager
@ -296,7 +294,7 @@ describe "ProjectController", ->
fontSize:"massive"
theme:"sexy"
email: "bob@bob.com"
@ProjectModel.findOne.callsArgWith 1, null, @project
@ProjectGetter.getProject.callsArgWith 2, null, @project
@UserModel.findById.callsArgWith(1, null, @user)
@SubscriptionLocator.getUsersSubscription.callsArgWith(1, null, {})
@AuthorizationManager.getPrivilegeLevelForProject.callsArgWith 2, null, "owner"