From 45de9bb5dca87282797096f5baf8ed46da0d433b Mon Sep 17 00:00:00 2001 From: Alasdair Smith Date: Wed, 17 Jan 2018 15:04:24 +0000 Subject: [PATCH] Remove unused autocompile rollout logic now that at 100% --- .../Features/Project/ProjectController.coffee | 33 ------------------- services/web/app/views/project/editor.pug | 2 -- .../web/app/views/project/editor/editor.pug | 14 -------- services/web/app/views/project/editor/pdf.pug | 20 +++++------ services/web/public/coffee/ide.coffee | 2 -- .../AutoCompileOnboardingController.coffee | 26 --------------- .../ide/pdf/controllers/PdfController.coffee | 5 +-- 7 files changed, 10 insertions(+), 92 deletions(-) delete mode 100644 services/web/public/coffee/ide/AutoCompileOnboardingController.coffee diff --git a/services/web/app/coffee/Features/Project/ProjectController.coffee b/services/web/app/coffee/Features/Project/ProjectController.coffee index 722d0b73b4..5a91a43843 100644 --- a/services/web/app/coffee/Features/Project/ProjectController.coffee +++ b/services/web/app/coffee/Features/Project/ProjectController.coffee @@ -241,36 +241,6 @@ module.exports = ProjectController = if !user_id? return cb() CollaboratorsHandler.userIsTokenMember user_id, project_id, cb - showAutoCompileOnboarding: (cb) -> - cb = underscore.once(cb) - # Force autocompile rollout if query param set - if req.query?.ac == 't' - return cb(null, { enabled: true, showOnboarding: true }) - - if !user_id? - return cb() - - # Extract data from user's ObjectId - timestamp = parseInt(user_id.toString().substring(0, 8), 16) - - rolloutPercentage = 100 # Percentage of users to roll out to - if !ProjectController._isInPercentageRollout('autocompile', user_id, rolloutPercentage) - # Don't show if user is not part of roll out - return cb(null, { enabled: false, showOnboarding: false }) - userSignupDate = new Date(timestamp * 1000) - if userSignupDate > new Date("2017-10-16") - # Don't show for users who registered after it was released - return cb(null, { enabled: true, showOnboarding: false }) - timeout = setTimeout cb, 500 - AnalyticsManager.getLastOccurance user_id, "shown-autocompile-onboarding-2", (error, event) -> - clearTimeout timeout - if error? - return cb(null, { enabled: true, showOnboarding: false }) - else if event? - return cb(null, { enabled: true, showOnboarding: false }) - else - logger.log { user_id, event }, "autocompile onboarding not shown yet to this user" - return cb(null, { enabled: true, showOnboarding: true }) couldShowLinkSharingOnboarding: (cb) -> cb = underscore.once(cb) if !user_id? @@ -295,7 +265,6 @@ module.exports = ProjectController = project = results.project user = results.user subscription = results.subscription - { showAutoCompileOnboarding } = results daysSinceLastUpdated = (new Date() - project.lastUpdated) / 86400000 logger.log project_id:project_id, daysSinceLastUpdated:daysSinceLastUpdated, "got db results for loading editor" @@ -340,8 +309,6 @@ module.exports = ProjectController = syntaxValidation: user.ace.syntaxValidation } trackChangesState: project.track_changes - autoCompileEnabled: !!showAutoCompileOnboarding?.enabled - showAutoCompileOnboarding: !!showAutoCompileOnboarding?.showOnboarding privilegeLevel: privilegeLevel chatUrl: Settings.apis.chat.url anonymous: anonymous diff --git a/services/web/app/views/project/editor.pug b/services/web/app/views/project/editor.pug index d47bed2223..3b42e93150 100644 --- a/services/web/app/views/project/editor.pug +++ b/services/web/app/views/project/editor.pug @@ -121,8 +121,6 @@ block requirejs window.isTokenMember = #{!!isTokenMember}; window.maxDocLength = #{maxDocLength}; window.trackChangesState = data.trackChangesState; - window.autoCompileEnabled = #{!!autoCompileEnabled}; - window.showAutoCompileOnboarding = #{!!showAutoCompileOnboarding} window.showLinkSharingOnboarding = #{!!showLinkSharingOnboarding} window.wikiEnabled = #{!!(settings.apis.wiki && settings.apis.wiki.url)}; window.requirejs = { diff --git a/services/web/app/views/project/editor/editor.pug b/services/web/app/views/project/editor/editor.pug index 1ed95a75ac..23d5d96dbf 100644 --- a/services/web/app/views/project/editor/editor.pug +++ b/services/web/app/views/project/editor/editor.pug @@ -94,20 +94,6 @@ div.full-size( ) include ./pdf -#onboarding-autocompile.onboarding-autocompile.popover( - ng-controller="AutoCompileOnboardingController" - ng-if="onboarding.autoCompile == 'show'" - ng-class="placement" -) - .popover-inner - h3.popover-title #{translate("auto_compile")} - .popover-content - p #{translate("try_out_auto_compile_setting")} - img(src="/img/onboarding/autocompile/setting-dropdown.png" width="100%") - p #{translate("auto_compile_onboarding_description")} - button.btn.btn-default.btn-block(ng-click="dismiss()") - | #{translate("got_it")} - #onboarding-linksharing.onboarding-linksharing.popover( ng-controller="LinkSharingOnboardingController" ng-if="permissions.admin && onboarding.linkSharing == 'unseen'" diff --git a/services/web/app/views/project/editor/pdf.pug b/services/web/app/views/project/editor/pdf.pug index a3b3a2e2f9..9681c4fc9a 100644 --- a/services/web/app/views/project/editor/pdf.pug +++ b/services/web/app/views/project/editor/pdf.pug @@ -26,17 +26,15 @@ div.full-size.pdf(ng-controller="PdfController") ) span.caret ul.dropdown-menu.dropdown-menu-left - // Only show if on beta program or part of rollout - if user.betaProgram || autoCompileEnabled - li.dropdown-header #{translate("auto_compile")} - li - a(href, ng-click="autocompile_enabled = true") - i.fa.fa-fw(ng-class="{'fa-check': autocompile_enabled}") - |  #{translate('on')} - li - a(href, ng-click="autocompile_enabled = false") - i.fa.fa-fw(ng-class="{'fa-check': !autocompile_enabled}") - |  #{translate('off')} + li.dropdown-header #{translate("auto_compile")} + li + a(href, ng-click="autocompile_enabled = true") + i.fa.fa-fw(ng-class="{'fa-check': autocompile_enabled}") + |  #{translate('on')} + li + a(href, ng-click="autocompile_enabled = false") + i.fa.fa-fw(ng-class="{'fa-check': !autocompile_enabled}") + |  #{translate('off')} li.dropdown-header #{translate("compile_mode")} li a(href, ng-click="draft = false") diff --git a/services/web/public/coffee/ide.coffee b/services/web/public/coffee/ide.coffee index 3d514d093c..e97c900cac 100644 --- a/services/web/public/coffee/ide.coffee +++ b/services/web/public/coffee/ide.coffee @@ -13,7 +13,6 @@ define [ "ide/metadata/MetadataManager" "ide/review-panel/ReviewPanelManager" "ide/SafariScrollPatcher" - "ide/AutoCompileOnboardingController", "ide/LinkSharingOnboardingController", "ide/settings/index" "ide/share/index" @@ -83,7 +82,6 @@ define [ chatResizerSizeClosed: window.uiConfig.chatResizerSizeClosed } $scope.onboarding = { - autoCompile: if window.showAutoCompileOnboarding then 'unseen' else 'dismissed' linkSharing: if window.showLinkSharingOnboarding then 'unseen' else 'dismissed' } $scope.user = window.user diff --git a/services/web/public/coffee/ide/AutoCompileOnboardingController.coffee b/services/web/public/coffee/ide/AutoCompileOnboardingController.coffee deleted file mode 100644 index 30a629f1fe..0000000000 --- a/services/web/public/coffee/ide/AutoCompileOnboardingController.coffee +++ /dev/null @@ -1,26 +0,0 @@ -define [ - "base" -], (App) -> - App.controller "AutoCompileOnboardingController", ($scope, event_tracking) -> - recompileBtn = angular.element('#recompile') - popover = angular.element('#onboarding-autocompile') - { top, left } = recompileBtn.offset() - - # If pdf panel smaller than recompile button + popover, show to left. - # Otherwise show to right - if $scope.ui.pdfWidth < 475 - $scope.placement = 'left' - popover.offset({ - top: top, - left: left - popover.width() - }) - else - $scope.placement = 'right' - popover.offset({ - top: top, - left: left + recompileBtn.width() - }) - - $scope.dismiss = () -> - $scope.onboarding.autoCompile = 'dismissed' - event_tracking.sendMB "shown-autocompile-onboarding-2" diff --git a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee index 7bce498ba8..d5d3a41af5 100644 --- a/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee +++ b/services/web/public/coffee/ide/pdf/controllers/PdfController.coffee @@ -115,7 +115,7 @@ define [ toggleAutoCompile(newValue) event_tracking.sendMB "autocompile-setting-changed", { value: newValue } - if (window.user?.betaProgram or window.autoCompileEnabled) and $scope.autocompile_enabled + if $scope.autocompile_enabled toggleAutoCompile(true) # abort compile if syntax checks fail @@ -426,9 +426,6 @@ define [ $scope.recompile = (options = {}) -> return if $scope.pdf.compiling - if !options.isAutoCompileOnLoad and $scope.onboarding.autoCompile == 'unseen' - $scope.onboarding.autoCompile = 'show' - event_tracking.sendMBSampled "editor-recompile-sampled", options $scope.pdf.compiling = true