mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
record when a subscription is canceled
This commit is contained in:
parent
92e3101d81
commit
adc6b429e6
2 changed files with 8 additions and 0 deletions
|
@ -7,6 +7,8 @@ SubscriptionUpdater = require("./SubscriptionUpdater")
|
|||
LimitationsManager = require('./LimitationsManager')
|
||||
EmailHandler = require("../Email/EmailHandler")
|
||||
Events = require "../../infrastructure/Events"
|
||||
Analytics = require("../Analytics/AnalyticsManager")
|
||||
|
||||
|
||||
module.exports =
|
||||
|
||||
|
@ -52,6 +54,7 @@ module.exports =
|
|||
setTimeout (-> EmailHandler.sendEmail "canceledSubscription", emailOpts
|
||||
), ONE_HOUR_IN_MS
|
||||
Events.emit "cancelSubscription", user._id
|
||||
Analytics.recordEvent user._id, "subscription-canceled"
|
||||
callback()
|
||||
else
|
||||
callback()
|
||||
|
|
|
@ -57,6 +57,10 @@ describe "Subscription Handler sanboxed", ->
|
|||
|
||||
@EmailHandler =
|
||||
sendEmail:sinon.stub()
|
||||
|
||||
@AnalyticsManager =
|
||||
recordEvent:sinon.stub()
|
||||
|
||||
@SubscriptionHandler = SandboxedModule.require modulePath, requires:
|
||||
"./RecurlyWrapper": @RecurlyWrapper
|
||||
"settings-sharelatex": @Settings
|
||||
|
@ -67,6 +71,7 @@ describe "Subscription Handler sanboxed", ->
|
|||
"../Email/EmailHandler":@EmailHandler
|
||||
"../Dropbox/DropboxHandler":@DropboxHandler
|
||||
"../../infrastructure/Events": @Events = {emit: sinon.stub()}
|
||||
"../Analytics/AnalyticsManager": @AnalyticsManager
|
||||
|
||||
@SubscriptionHandler.syncSubscriptionToUser = sinon.stub().callsArgWith(2)
|
||||
|
||||
|
|
Loading…
Reference in a new issue