mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-03 22:29:01 +02:00
0f19816bad
* Add `unicorn/prefer-node-protocol` * Revert non-web changes * Run `npm run lint:fix` (prefer-node-protocol) GitOrigin-RevId: c3cdd88ff9e6b3de6a4397d45935c4d026c1c1ed
36 lines
830 B
JavaScript
36 lines
830 B
JavaScript
import { callbackify } from 'node: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,
|
|
},
|
|
}
|