mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-04 16:05:54 +00:00
Update references to UserLocator
UserLocator was refactored in another branch: UserLocator -> UserGetter
This commit is contained in:
parent
25d7196570
commit
58c4e72b2a
2 changed files with 9 additions and 9 deletions
|
@ -8,7 +8,7 @@ ObjectId = require("mongojs").ObjectId
|
|||
TeamInvite = require("../../models/TeamInvite").TeamInvite
|
||||
Subscription = require("../../models/Subscription").Subscription
|
||||
|
||||
UserLocator = require("../User/UserLocator")
|
||||
UserGetter = require("../User/UserGetter")
|
||||
SubscriptionLocator = require("./SubscriptionLocator")
|
||||
SubscriptionUpdater = require("./SubscriptionUpdater")
|
||||
LimitationsManager = require("./LimitationsManager")
|
||||
|
@ -26,7 +26,7 @@ module.exports = TeamInvitesHandler =
|
|||
|
||||
createManagerInvite: (teamManagerId, email, callback) ->
|
||||
logger.log {teamManagerId, email}, "Creating manager team invite"
|
||||
UserLocator.findById teamManagerId, (error, teamManager) ->
|
||||
UserGetter.getUser teamManagerId, (error, teamManager) ->
|
||||
return callback(error) if error?
|
||||
|
||||
SubscriptionLocator.getUsersSubscription teamManagerId, (error, subscription) ->
|
||||
|
@ -108,7 +108,7 @@ checkIfInviteIsPossible = (subscription, email, callback = (error, possible, rea
|
|||
logger.log {subscriptionId: subscription.id, email}, "user already invited"
|
||||
return callback(null, false, alreadyInvited: true)
|
||||
|
||||
async.map subscription.member_ids, UserLocator.findById, (error, members) ->
|
||||
async.map subscription.member_ids, UserGetter.getUser, (error, members) ->
|
||||
return callback(error) if error?
|
||||
|
||||
existingMember = members.find (member) -> member.email == email
|
||||
|
|
|
@ -36,8 +36,8 @@ describe "TeamInvitesHandler", ->
|
|||
getSubscription: sinon.stub().yields(null, @subscription)
|
||||
}
|
||||
|
||||
@UserLocator = {
|
||||
findById: sinon.stub()
|
||||
@UserGetter = {
|
||||
getUser: sinon.stub()
|
||||
}
|
||||
|
||||
@SubscriptionUpdater = {
|
||||
|
@ -64,7 +64,7 @@ describe "TeamInvitesHandler", ->
|
|||
toString: sinon.stub().returns(@newToken)
|
||||
}
|
||||
|
||||
@UserLocator.findById.withArgs(@manager.id).yields(null, @manager)
|
||||
@UserGetter.getUser.withArgs(@manager.id).yields(null, @manager)
|
||||
@SubscriptionLocator.getUsersSubscription.yields(null, @subscription)
|
||||
@Subscription.findOne.yields(null, @subscription)
|
||||
|
||||
|
@ -74,7 +74,7 @@ describe "TeamInvitesHandler", ->
|
|||
"settings-sharelatex": { siteUrl: "http://example.com" }
|
||||
"../../models/TeamInvite": { TeamInvite: @TeamInvite = {} }
|
||||
"../../models/Subscription": { Subscription: @Subscription }
|
||||
"../User/UserLocator": @UserLocator
|
||||
"../User/UserGetter": @UserGetter
|
||||
"./SubscriptionLocator": @SubscriptionLocator
|
||||
"./SubscriptionUpdater": @SubscriptionUpdater
|
||||
"./LimitationsManager": @LimitationsManager
|
||||
|
@ -154,7 +154,7 @@ describe "TeamInvitesHandler", ->
|
|||
email: "tyrion@lannister.com"
|
||||
}
|
||||
|
||||
@UserLocator.findById.withArgs(@user.id).yields(null, @user)
|
||||
@UserGetter.getUser.withArgs(@user.id).yields(null, @user)
|
||||
|
||||
@subscription.teamInvites.push({
|
||||
email: "john.snow@nightwatch.com",
|
||||
|
@ -205,7 +205,7 @@ describe "TeamInvitesHandler", ->
|
|||
}
|
||||
|
||||
@subscription.member_ids = [member.id]
|
||||
@UserLocator.findById.withArgs(member.id).yields(null, member)
|
||||
@UserGetter.getUser.withArgs(member.id).yields(null, member)
|
||||
|
||||
@TeamInvitesHandler.createManagerInvite @manager.id, "tyrion@lannister.com", (err, invite) =>
|
||||
expect(err).to.deep.equal(alreadyInTeam: true)
|
||||
|
|
Loading…
Reference in a new issue