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')
|
LimitationsManager = require('./LimitationsManager')
|
||||||
EmailHandler = require("../Email/EmailHandler")
|
EmailHandler = require("../Email/EmailHandler")
|
||||||
Events = require "../../infrastructure/Events"
|
Events = require "../../infrastructure/Events"
|
||||||
|
Analytics = require("../Analytics/AnalyticsManager")
|
||||||
|
|
||||||
|
|
||||||
module.exports =
|
module.exports =
|
||||||
|
|
||||||
|
@ -52,6 +54,7 @@ module.exports =
|
||||||
setTimeout (-> EmailHandler.sendEmail "canceledSubscription", emailOpts
|
setTimeout (-> EmailHandler.sendEmail "canceledSubscription", emailOpts
|
||||||
), ONE_HOUR_IN_MS
|
), ONE_HOUR_IN_MS
|
||||||
Events.emit "cancelSubscription", user._id
|
Events.emit "cancelSubscription", user._id
|
||||||
|
Analytics.recordEvent user._id, "subscription-canceled"
|
||||||
callback()
|
callback()
|
||||||
else
|
else
|
||||||
callback()
|
callback()
|
||||||
|
|
|
@ -57,6 +57,10 @@ describe "Subscription Handler sanboxed", ->
|
||||||
|
|
||||||
@EmailHandler =
|
@EmailHandler =
|
||||||
sendEmail:sinon.stub()
|
sendEmail:sinon.stub()
|
||||||
|
|
||||||
|
@AnalyticsManager =
|
||||||
|
recordEvent:sinon.stub()
|
||||||
|
|
||||||
@SubscriptionHandler = SandboxedModule.require modulePath, requires:
|
@SubscriptionHandler = SandboxedModule.require modulePath, requires:
|
||||||
"./RecurlyWrapper": @RecurlyWrapper
|
"./RecurlyWrapper": @RecurlyWrapper
|
||||||
"settings-sharelatex": @Settings
|
"settings-sharelatex": @Settings
|
||||||
|
@ -67,6 +71,7 @@ describe "Subscription Handler sanboxed", ->
|
||||||
"../Email/EmailHandler":@EmailHandler
|
"../Email/EmailHandler":@EmailHandler
|
||||||
"../Dropbox/DropboxHandler":@DropboxHandler
|
"../Dropbox/DropboxHandler":@DropboxHandler
|
||||||
"../../infrastructure/Events": @Events = {emit: sinon.stub()}
|
"../../infrastructure/Events": @Events = {emit: sinon.stub()}
|
||||||
|
"../Analytics/AnalyticsManager": @AnalyticsManager
|
||||||
|
|
||||||
@SubscriptionHandler.syncSubscriptionToUser = sinon.stub().callsArgWith(2)
|
@SubscriptionHandler.syncSubscriptionToUser = sinon.stub().callsArgWith(2)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue