mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #19348 from overleaf/tm-link-sharing-changes-events-fixes
Link sharing changes events fixes for collaborator sharing-updates prompt and project open event GitOrigin-RevId: 45449f0dd27e07de189a9c2620b0aa9a8849dc41
This commit is contained in:
parent
5871dafc02
commit
ab4a4df931
3 changed files with 16 additions and 5 deletions
|
@ -553,17 +553,18 @@ const _ProjectController = {
|
|||
const ownerFeatures = await UserGetter.promises.getUserFeatures(
|
||||
project.owner_ref
|
||||
)
|
||||
const planLimit = ownerFeatures?.collaborators || 0
|
||||
const namedEditors = project.collaberator_refs?.length || 0
|
||||
const exceedAtLimit = planLimit > -1 && namedEditors >= planLimit
|
||||
const projectOpenedSegmentation = {
|
||||
projectId: project._id,
|
||||
// temporary link sharing segmentation:
|
||||
linkSharingWarning: linkSharingChanges?.variant,
|
||||
namedEditors: project.collaberator_refs?.length || 0,
|
||||
namedEditors,
|
||||
tokenEditors: project.tokenAccessReadAndWrite_refs?.length || 0,
|
||||
planLimit: ownerFeatures?.collaborators || 0,
|
||||
planLimit,
|
||||
exceedAtLimit,
|
||||
}
|
||||
projectOpenedSegmentation.exceedAtLimit =
|
||||
projectOpenedSegmentation.namedEditors >=
|
||||
projectOpenedSegmentation.planLimit
|
||||
AnalyticsManager.recordEventForUserInBackground(
|
||||
userId,
|
||||
'project-opened',
|
||||
|
|
|
@ -18,6 +18,7 @@ const EditorRealTimeController = require('../Editor/EditorRealTimeController')
|
|||
const CollaboratorsGetter = require('../Collaborators/CollaboratorsGetter')
|
||||
const ProjectGetter = require('../Project/ProjectGetter')
|
||||
const AsyncFormHelper = require('../Helpers/AsyncFormHelper')
|
||||
const AnalyticsManager = require('../Analytics/AnalyticsManager')
|
||||
|
||||
const orderedPrivilegeLevels = [
|
||||
PrivilegeLevels.NONE,
|
||||
|
@ -476,6 +477,10 @@ async function ensureUserCanUseSharingUpdatesConsentPage(req, res, next) {
|
|||
|
||||
async function sharingUpdatesConsent(req, res, next) {
|
||||
const { Project_id: projectId } = req.params
|
||||
AnalyticsManager.recordEventForSession(req.session, 'notification-prompt', {
|
||||
page: req.path,
|
||||
name: 'link-sharing-collaborator',
|
||||
})
|
||||
res.render('project/token/sharing-updates', {
|
||||
projectId,
|
||||
})
|
||||
|
|
|
@ -100,6 +100,10 @@ describe('TokenAccessController', function () {
|
|||
},
|
||||
}
|
||||
|
||||
this.AnalyticsManager = {
|
||||
recordEventForSession: sinon.stub(),
|
||||
}
|
||||
|
||||
this.TokenAccessController = SandboxedModule.require(MODULE_PATH, {
|
||||
requires: {
|
||||
'@overleaf/settings': this.Settings,
|
||||
|
@ -120,6 +124,7 @@ describe('TokenAccessController', function () {
|
|||
'../Helpers/AsyncFormHelper': (this.AsyncFormHelper = {
|
||||
redirect: sinon.stub(),
|
||||
}),
|
||||
'../Analytics/AnalyticsManager': this.AnalyticsManager,
|
||||
},
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue