mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-04 14:49:01 +02:00
Migrate Features to ES modules
GitOrigin-RevId: 4e9d3176b4b5a5504afc102e569a27d7788864a3
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { callbackify } from 'util'
|
||||
import metrics from '@overleaf/metrics'
|
||||
import UserUpdater from '../User/UserUpdater.js'
|
||||
import AnalyticsManager from '../Analytics/AnalyticsManager.js'
|
||||
|
||||
async function optIn(userId) {
|
||||
await UserUpdater.promises.updateUser(userId, { $set: { betaProgram: true } })
|
||||
metrics.inc('beta-program.opt-in')
|
||||
AnalyticsManager.setUserPropertyForUserInBackground(
|
||||
userId,
|
||||
'beta-program',
|
||||
true
|
||||
)
|
||||
}
|
||||
|
||||
async function optOut(userId) {
|
||||
await UserUpdater.promises.updateUser(userId, {
|
||||
$set: { betaProgram: false },
|
||||
})
|
||||
metrics.inc('beta-program.opt-out')
|
||||
AnalyticsManager.setUserPropertyForUserInBackground(
|
||||
userId,
|
||||
'beta-program',
|
||||
false
|
||||
)
|
||||
}
|
||||
|
||||
export default {
|
||||
optIn: callbackify(optIn),
|
||||
optOut: callbackify(optOut),
|
||||
promises: {
|
||||
optIn,
|
||||
optOut,
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user