Merge pull request #267 from sharelatex/as-remove-rollout

Remove rollout logic for auto compile and link sharing
This commit is contained in:
James Allen 2018-01-31 10:27:09 +00:00 committed by GitHub
commit 9a9938083c
10 changed files with 10 additions and 237 deletions

View file

@ -241,53 +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?
return cb()
# Extract data from user's ObjectId
timestamp = parseInt(user_id.toString().substring(0, 8), 16)
userSignupDate = new Date(timestamp * 1000)
if userSignupDate > new Date("2017-11-13")
# Don't show for users who registered after it was released
return cb(null, false)
timeout = setTimeout cb, 500
AnalyticsManager.getLastOccurance user_id, "shown-linksharing-onboarding", (error, event) ->
clearTimeout timeout
if error? || event?
return cb(null, false)
else
return cb(null, true)
}, (err, results)->
if err?
logger.err err:err, "error getting details for project page"
@ -295,7 +248,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 +292,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
@ -350,7 +300,6 @@ module.exports = ProjectController =
languages: Settings.languages
themes: THEME_LIST
maxDocLength: Settings.max_doc_length
showLinkSharingOnboarding: !!results.couldShowLinkSharingOnboarding
useV2History: !!project.overleaf?.history?.display
timer.done()

View file

@ -121,9 +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 = {
"paths" : {

View file

@ -93,35 +93,3 @@ div.full-size(
ng-show="ui.view == 'pdf'"
)
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'"
ng-class="placement"
)
.popover-inner
h3.popover-title #{translate("link_sharing")}
.popover-content
p #{translate("try_out_link_sharing")}
img(
src="/img/onboarding/linksharing/link-sharing.png"
alt="Link sharing demo"
width="100%"
)
p #{translate("try_link_sharing_description")}
button.btn.btn-default.btn-block(ng-click="dismiss()")
| #{translate("got_it")}

View file

@ -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")

View file

@ -13,8 +13,6 @@ define [
"ide/metadata/MetadataManager"
"ide/review-panel/ReviewPanelManager"
"ide/SafariScrollPatcher"
"ide/AutoCompileOnboardingController",
"ide/LinkSharingOnboardingController",
"ide/settings/index"
"ide/share/index"
"ide/chat/index"
@ -82,10 +80,6 @@ define [
chatResizerSizeOpen: window.uiConfig.chatResizerSizeOpen
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
$scope.shouldABTestPlans = false

View file

@ -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"

View file

@ -1,21 +0,0 @@
define [
"base"
], (App) ->
App.controller "LinkSharingOnboardingController", ($scope, $timeout, event_tracking) ->
popover = angular.element('#onboarding-linksharing')
popover.hide()
$scope.dismiss = () ->
$scope.onboarding.linkSharing = 'dismissed'
event_tracking.sendMB "shown-linksharing-onboarding"
$scope.$on 'ide:loaded', () ->
shareBtn = angular.element('#shareButton')
offset = shareBtn.offset()
popover.show()
$scope.placement = 'bottom'
popover.css({
top: '' + (2) + 'px',
right: '' + (window.innerWidth - offset.left - (shareBtn.width() * 1.5) ) + 'px'
})

View file

@ -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

View file

@ -12,7 +12,6 @@
@import "./editor/online-users.less";
@import "./editor/hotkeys.less";
@import "./editor/review-panel.less";
@import "./editor/feature-onboarding.less";
@ui-layout-toggler-def-height: 50px;
@ui-resizer-extra-hit-area: 8px;

View file

@ -1,82 +0,0 @@
.onboarding-autocompile {
display: block;
top: 10px;
img {
margin-bottom: 10px;
border: 1px solid @gray-lighter;
}
&::before, &::after {
content: '';
border-width: 11px;
border-style: solid;
border-color: transparent;
top: 7px;
display: block;
position: absolute;
}
&.right::before {
border-left-width: 0;
border-right-color: rgba(0, 0, 0, .3);
left: -11px;
}
&.right::after {
border-left-width: 0;
border-right-color: #f7f7f7;
left: -9.5px;
}
&.left::before {
border-right-width: 0;
border-left-color: rgba(0, 0, 0, .3);
right: -11px
}
&.left::after {
border-right-width: 0;
border-left-color: #f7f7f7;
right: -9.5px;
}
}
.onboarding-linksharing {
display: block;
top: 10px;
&.popover {
left: auto !important;
}
img {
margin-bottom: 10px;
border: 1px solid @gray-lighter;
}
&::before, &::after {
content: '';
border-width: 11px;
border-style: solid;
border-color: transparent;
top: 7px;
display: block;
position: absolute;
}
// Bottom
&.bottom::before {
border-top-width: 0;
border-bottom-color: rgba(0, 0, 0, .3);
top: -10px;
right: 38px;
}
&.bottom::after {
border-top-width: 0;
border-bottom-color: #f7f7f7;
top: -9.5px;
right: 38px;
}
}