Merge pull request #38 from sharelatex/as-autocompile-rollout

Rollout for auto compile; Connects to #20
This commit is contained in:
Alasdair Smith 2017-10-16 10:48:43 +01:00 committed by GitHub
commit 5d3371a52c
5 changed files with 17 additions and 13 deletions

View file

@ -252,9 +252,17 @@ module.exports = ProjectController =
cb = underscore.once(cb)
if !user_id?
return cb()
timestamp = user_id.toString().substring(0,8)
userSignupDate = new Date( parseInt( timestamp, 16 ) * 1000 )
if userSignupDate > new Date("2017-10-03")
# Extract data from user's ObjectId
timestamp = parseInt(user_id.toString().substring(0, 8), 16)
counter = parseInt(user_id.toString().substring(18, 24), 16)
rolloutProportion = 0
if counter % 1000 < rolloutProportion
# Don't show if user is not part of roll out
return cb(null, 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, false)
timeout = setTimeout cb, 500

View file

@ -101,9 +101,7 @@ div.full-size(
ng-class="placement"
)
.popover-inner
h3.popover-title
| #{translate("auto_compile")}
span.beta-feature-badge
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%")

View file

@ -26,11 +26,9 @@ div.full-size.pdf(ng-controller="PdfController")
)
span.caret
ul.dropdown-menu.dropdown-menu-left
// Only show on beta program?
if user.betaProgram
li.dropdown-header
| #{translate("auto_compile")}
span.beta-feature-badge
// Only show if on beta program or part of rollout
if user.betaProgram || showAutoCompileOnboarding
li.dropdown-header #{translate("auto_compile")}
li
a(href, ng-click="autocompile_enabled = true")
i.fa.fa-fw(ng-class="{'fa-check': autocompile_enabled}")

View file

@ -78,7 +78,7 @@ define [
miniReviewPanelVisible: false,
}
$scope.onboarding = {
autoCompile: if window.user.betaProgram and window.showAutoCompileOnboarding then 'unseen' else 'dismissed'
autoCompile: if window.showAutoCompileOnboarding then 'unseen' else 'dismissed'
}
$scope.user = window.user

View file

@ -109,7 +109,7 @@ define [
toggleAutoCompile(newValue)
event_tracking.sendMB "autocompile-setting-changed", { value: newValue }
if window.user?.betaProgram and $scope.autocompile_enabled
if (window.user?.betaProgram or window.showAutoCompileOnboarding) and $scope.autocompile_enabled
toggleAutoCompile(true)
# abort compile if syntax checks fail