mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Use user feature flags to determine track changes state
This commit is contained in:
parent
9d1d2df977
commit
343abfde23
6 changed files with 9 additions and 11 deletions
|
@ -20,10 +20,10 @@ module.exports = ProjectEditorHandler =
|
|||
if !result.invites?
|
||||
result.invites = []
|
||||
|
||||
hasTrackChanges = false
|
||||
trackChangesVisible = false
|
||||
for member in members
|
||||
if member.privilegeLevel == "owner" and member.user?.featureSwitches?.track_changes
|
||||
hasTrackChanges = true
|
||||
trackChangesVisible = true
|
||||
|
||||
{owner, ownerFeatures, members} = @buildOwnerAndMembersViews(members)
|
||||
result.owner = owner
|
||||
|
@ -37,7 +37,8 @@ module.exports = ProjectEditorHandler =
|
|||
compileGroup:"standard"
|
||||
templates: false
|
||||
references: false
|
||||
trackChanges: hasTrackChanges
|
||||
trackChanges: true # TODO: Set this to false to make track changes a paid feature
|
||||
trackChangesVisible: trackChangesVisible # TODO: Get this from the beta flag when going to public beta
|
||||
})
|
||||
|
||||
return result
|
||||
|
|
|
@ -53,7 +53,7 @@ div.full-size(
|
|||
syntax-validation="settings.syntaxValidation",
|
||||
review-panel="reviewPanel",
|
||||
events-bridge="reviewPanelEventsBridge"
|
||||
track-changes-enabled="project.features.trackChanges",
|
||||
track-changes-enabled="project.features.trackChangesVisible",
|
||||
track-changes= "editor.trackChanges",
|
||||
doc-id="editor.open_doc_id"
|
||||
renderer-data="reviewPanel.rendererData"
|
||||
|
|
|
@ -87,7 +87,7 @@ header.toolbar.toolbar-header.toolbar-with-labels(
|
|||
|
||||
a.btn.btn-full-height(
|
||||
href,
|
||||
ng-if="project.features.trackChanges",
|
||||
ng-if="project.features.trackChangesVisible",
|
||||
ng-class="{ active: ui.reviewPanelOpen }"
|
||||
ng-click="toggleReviewPanel()"
|
||||
)
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
ng-if="editor.wantTrackChanges == editor.trackChanges"
|
||||
ng-model="editor.wantTrackChanges"
|
||||
on-toggle="toggleTrackChanges"
|
||||
disabled="!project.features.hasTrackChanges"
|
||||
disabled="!project.features.trackChanges"
|
||||
on-disabled-click="openTrackChangesUpgradeModal"
|
||||
)
|
||||
span.review-panel-toolbar-label.review-panel-toolbar-label-disabled(ng-if="!permissions.write")
|
||||
|
|
|
@ -179,6 +179,7 @@ module.exports = settings =
|
|||
compileGroup: "standard"
|
||||
references: true
|
||||
templates: true
|
||||
trackChanges: true
|
||||
|
||||
plans: plans = [{
|
||||
planCode: "personal"
|
||||
|
|
|
@ -7,10 +7,6 @@ define [
|
|||
App.controller "ReviewPanelController", ($scope, $element, ide, $timeout, $http, $modal, event_tracking) ->
|
||||
$reviewPanelEl = $element.find "#review-panel"
|
||||
|
||||
# TODO Mocked feature flag, remove.
|
||||
$scope.$on "project:joined", () ->
|
||||
$scope.project.features.hasTrackChanges = true
|
||||
|
||||
$scope.SubViews =
|
||||
CUR_FILE : "cur_file"
|
||||
OVERVIEW : "overview"
|
||||
|
@ -435,7 +431,7 @@ define [
|
|||
ide.editorManager.openDocId(doc_id, { gotoOffset: entry.offset })
|
||||
|
||||
$scope.toggleTrackChanges = (value) ->
|
||||
if $scope.project.features.hasTrackChanges
|
||||
if $scope.project.features.trackChanges
|
||||
$scope.editor.wantTrackChanges = value
|
||||
$http.post "/project/#{$scope.project_id}/track_changes", {_csrf: window.csrfToken, on: value}
|
||||
event_tracking.sendMB "rp-trackchanges-toggle", { value }
|
||||
|
|
Loading…
Reference in a new issue