Merge pull request #3016 from overleaf/ta-editor-load-events

Fix Editor Load Events

GitOrigin-RevId: bb23f17ccab2d53933ad9da870f8ce26fdd169df
This commit is contained in:
Eric Mc Sween 2020-07-20 09:23:20 -04:00 committed by Copybot
parent 60bdd4641a
commit c200511f86
3 changed files with 10 additions and 5 deletions

View file

@ -35,6 +35,7 @@ const Features = require('../../infrastructure/Features')
const BrandVariationsHandler = require('../BrandVariations/BrandVariationsHandler')
const { getUserAffiliations } = require('../Institutions/InstitutionsAPI')
const UserController = require('../User/UserController')
const AnalyticsManager = require('../Analytics/AnalyticsManager')
const _ssoAvailable = (affiliation, session, linkedInstitutionIds) => {
if (!affiliation.institution) return false
@ -773,6 +774,12 @@ const ProjectController = {
const enableOptimize =
!!Settings.experimentId && !user.features.zotero
if (userId) {
AnalyticsManager.recordEvent(userId, 'project-opened', {
projectId: project._id
})
}
res.render('project/editor', {
title: project.name,
priority_title: true,

View file

@ -192,10 +192,7 @@ export default App.controller('SettingsController', function(
}
// don't save on initialisation, Angular passes oldRootDoc_id as
// undefined in this case.
if (
typeof rootDoc_id === 'undefined' &&
typeof oldRootDoc_id === 'undefined'
) {
if (typeof oldRootDoc_id === 'undefined') {
return
}
// otherwise only save changes, null values are allowed

View file

@ -178,7 +178,8 @@ describe('ProjectController', function() {
getUserAffiliations: this.getUserAffiliations
},
'../ThirdPartyDataStore/TpdsProjectFlusher': this.TpdsProjectFlusher,
'../../models/Project': {}
'../../models/Project': {},
'../Analytics/AnalyticsManager': { recordEvent: () => {} }
}
})