diff --git a/services/web/app/src/Features/Project/ProjectController.js b/services/web/app/src/Features/Project/ProjectController.js index e56e8a77f0..b206463522 100644 --- a/services/web/app/src/Features/Project/ProjectController.js +++ b/services/web/app/src/Features/Project/ProjectController.js @@ -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, diff --git a/services/web/frontend/js/ide/settings/controllers/SettingsController.js b/services/web/frontend/js/ide/settings/controllers/SettingsController.js index d87537c276..cbe2180086 100644 --- a/services/web/frontend/js/ide/settings/controllers/SettingsController.js +++ b/services/web/frontend/js/ide/settings/controllers/SettingsController.js @@ -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 diff --git a/services/web/test/unit/src/Project/ProjectControllerTests.js b/services/web/test/unit/src/Project/ProjectControllerTests.js index 148aa721d2..ed8907791a 100644 --- a/services/web/test/unit/src/Project/ProjectControllerTests.js +++ b/services/web/test/unit/src/Project/ProjectControllerTests.js @@ -178,7 +178,8 @@ describe('ProjectController', function() { getUserAffiliations: this.getUserAffiliations }, '../ThirdPartyDataStore/TpdsProjectFlusher': this.TpdsProjectFlusher, - '../../models/Project': {} + '../../models/Project': {}, + '../Analytics/AnalyticsManager': { recordEvent: () => {} } } })