Refactor AB test participation code; add conversion code.

This commit is contained in:
Paulo Reis 2017-03-23 15:00:43 +00:00
parent 254e4953cb
commit c72ee95177
2 changed files with 10 additions and 15 deletions

View file

@ -81,12 +81,6 @@ define [
if $scope.user.signUpDate >= '2016-10-27'
$scope.shouldABTestPlans = true
$scope.shouldABAddCommentBtn = false
if $scope.user.signUpDate >= '2016-03-22'
$scope.shouldABAddCommentBtn = true
sixpack.participate "add-comment-btn", [ "default", "editor-corner" ], (variation) ->
$scope.variationABAddCommentBtn = variation
$scope.settings = window.userSettings
$scope.anonymous = window.anonymous

View file

@ -4,7 +4,7 @@ define [
"ide/colors/ColorManager"
"ide/review-panel/RangesTracker"
], (App, EventEmitter, ColorManager, RangesTracker) ->
App.controller "ReviewPanelController", ($scope, $element, ide, $timeout, $http, $modal, event_tracking, localStorage) ->
App.controller "ReviewPanelController", ($scope, $element, ide, $timeout, $http, $modal, event_tracking, sixpack, localStorage) ->
$reviewPanelEl = $element.find "#review-panel"
$scope.SubViews =
@ -29,13 +29,12 @@ define [
loadingThreads: false
newAddCommentUI: false # Test new UI for adding comments; remove afterwards.
if $scope.shouldABAddCommentBtn and $scope.variationABAddCommentBtn? == "editor-corner"
$scope.reviewPanel.newAddCommentUI = true
console.log "editor corner"
else
console.log "default"
console.log $scope.shouldABAddCommentBtn
$scope.shouldABAddCommentBtn = false
if $scope.user.signUpDate >= '2016-03-22'
sixpack.participate "add-comment-btn", [ "default", "editor-corner" ], (variation) ->
$scope.shouldABAddCommentBtn = true
$scope.variationABAddCommentBtn = variation
$scope.reviewPanel.newAddCommentUI = (variation == "editor-corner")
window.addEventListener "beforeunload", () ->
collapsedStates = {}
@ -344,7 +343,9 @@ define [
$scope.$broadcast "comment:select_line"
$timeout () ->
$scope.$broadcast "review-panel:layout"
if $scope.shouldABAddCommentBtn and !$scope.ui.reviewPanelOpen
sixpack.convert "add-comment-btn"
$scope.submitNewComment = (content) ->
return if !content? or content == ""
doc_id = $scope.editor.open_doc_id