mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 14:13:43 +01:00
Fetch the whole user doc
Other attributes are needed to calculate features.
This commit is contained in:
@@ -5,7 +5,7 @@ Settings = require "settings-sharelatex"
|
|||||||
|
|
||||||
module.exports = ReferalFeatures =
|
module.exports = ReferalFeatures =
|
||||||
getBonusFeatures: (user_id, callback = (error) ->) ->
|
getBonusFeatures: (user_id, callback = (error) ->) ->
|
||||||
UserGetter.getUserOrUserStubById user_id, { _id: 1 }, (error, user) ->
|
UserGetter.getUserOrUserStubById user_id, null, (error, user) ->
|
||||||
return callback(error) if error
|
return callback(error) if error
|
||||||
return callback(new Error("user not found #{user_id} for assignBonus")) if !user?
|
return callback(new Error("user not found #{user_id} for assignBonus")) if !user?
|
||||||
logger.log user_id: user_id, refered_user_count: user.refered_user_count, "assigning bonus"
|
logger.log user_id: user_id, refered_user_count: user.refered_user_count, "assigning bonus"
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ describe 'ReferalFeatures', ->
|
|||||||
|
|
||||||
it "should get the users number of refered user", ->
|
it "should get the users number of refered user", ->
|
||||||
@UserGetter.getUserOrUserStubById
|
@UserGetter.getUserOrUserStubById
|
||||||
.calledWith(@user_id, { _id: 1 })
|
.calledWith(@user_id, null)
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
it "should call the callback with the features", ->
|
it "should call the callback with the features", ->
|
||||||
@@ -57,7 +57,7 @@ describe 'ReferalFeatures', ->
|
|||||||
|
|
||||||
it "should get the users number of refered user", ->
|
it "should get the users number of refered user", ->
|
||||||
@UserGetter.getUserOrUserStubById
|
@UserGetter.getUserOrUserStubById
|
||||||
.calledWith(@user_id, { _id: 1 })
|
.calledWith(@user_id, null)
|
||||||
.should.equal true
|
.should.equal true
|
||||||
|
|
||||||
it "should call the callback with no features", ->
|
it "should call the callback with no features", ->
|
||||||
|
|||||||
Reference in New Issue
Block a user