From 93b936d2fb60d1f1908399881a002084f84f49c9 Mon Sep 17 00:00:00 2001 From: Aileen Nowak Date: Tue, 5 Feb 2019 23:38:40 +0700 Subject: [PATCH] Added back "theme.uploaded" analytics event (#10450) no issue - With the changes in https://github.com/TryGhost/Ghost/commit/79ca6c575c2a10e77ddf618dfb20a571bd4c5655 we removed old unused events - The theme upload event is still used and needed to be put back - Added the event emit right after the successful upload of the theme - Renamed analytics events for more consistency - We need to add the same event emitter to the v0.1 API as it's not deprecated - emits a `theme.uploaded` event after the theme was successfully uploaded and saved --- core/server/analytics-events.js | 8 ++++++-- core/server/api/v0.1/themes.js | 2 ++ core/server/api/v2/themes.js | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/core/server/analytics-events.js b/core/server/analytics-events.js index 3fc7e15cb6..c0efa7a5ac 100644 --- a/core/server/analytics-events.js +++ b/core/server/analytics-events.js @@ -13,11 +13,15 @@ module.exports.init = function () { toTrack = [ { event: 'post.published', - name: 'Blog Post Published' + name: 'Post Published' }, { event: 'page.published', - name: 'Blog Page Published' + name: 'Page Published' + }, + { + event: 'theme.uploaded', + name: 'Theme Uploaded' } ]; diff --git a/core/server/api/v0.1/themes.js b/core/server/api/v0.1/themes.js index f27e4a16cb..53b1c86e9d 100644 --- a/core/server/api/v0.1/themes.js +++ b/core/server/api/v0.1/themes.js @@ -136,6 +136,8 @@ themes = { themeUtils.activate(loadedTheme, checkedTheme); } + common.events.emit('theme.uploaded'); + // @TODO: unify the name across gscan and Ghost! return themeUtils.toJSON(zip.shortName, checkedTheme); }) diff --git a/core/server/api/v2/themes.js b/core/server/api/v2/themes.js index 5386236141..0e7da2a47e 100644 --- a/core/server/api/v2/themes.js +++ b/core/server/api/v2/themes.js @@ -122,6 +122,8 @@ module.exports = { this.headers.cacheInvalidate = true; } + common.events.emit('theme.uploaded'); + // @TODO: unify the name across gscan and Ghost! return themeService.toJSON(zip.shortName, checkedTheme); })