Toggle track changes in a project based on the owner's feature switch

This commit is contained in:
James Allen 2017-01-17 15:59:18 +01:00
parent e15d01874d
commit 5a34d17947
6 changed files with 11 additions and 8 deletions

View file

@ -19,6 +19,11 @@ module.exports = ProjectEditorHandler =
if !result.invites?
result.invites = []
hasTrackChanges = false
for member in members
if member.privilegeLevel == "owner" and member.user?.featureSwitches?.track_changes
hasTrackChanges = true
{owner, ownerFeatures, members} = @buildOwnerAndMembersViews(members)
result.owner = owner
@ -32,6 +37,7 @@ module.exports = ProjectEditorHandler =
compileGroup:"standard"
templates: false
references: false
trackChanges: hasTrackChanges
})
return result

View file

@ -39,7 +39,7 @@ UserSchema = new Schema
references: { type:Boolean, default: Settings.defaultFeatures.references }
}
featureSwitches : {
pdfng: { type: Boolean }
track_changes: { type: Boolean }
}
referal_id : {type:String, default:() -> uuid.v4().split("-")[0]}
refered_users: [ type:ObjectId, ref:'User' ]

View file

@ -52,7 +52,7 @@ div.full-size(
syntax-validation="settings.syntaxValidation",
review-panel="reviewPanel",
events-bridge="reviewPanelEventsBridge"
track-changes-enabled="trackChangesFeatureFlag",
track-changes-enabled="project.features.trackChanges",
track-changes= "editor.trackChanges",
doc-id="editor.open_doc_id"
renderer-data="reviewPanel.rendererData"

View file

@ -87,7 +87,7 @@ header.toolbar.toolbar-header.toolbar-with-labels(
a.btn.btn-full-height(
href,
ng-if="trackChangesFeatureFlag",
ng-if="project.features.trackChanges",
ng-class="{ active: ui.reviewPanelOpen }"
ng-click="toggleReviewPanel()"
)

View file

@ -57,9 +57,6 @@ define [
else
this.$originalApply(fn);
if window.location.search.match /tcon=true/ # track changes on
$scope.trackChangesFeatureFlag = true
$scope.state = {
loading: true
load_progress: 40
@ -70,7 +67,7 @@ define [
view: "editor"
chatOpen: false
pdfLayout: 'sideBySide'
reviewPanelOpen: localStorage("ui.reviewPanelOpen.#{window.project_id}") and $scope.trackChangesFeatureFlag
reviewPanelOpen: localStorage("ui.reviewPanelOpen.#{window.project_id}") and $scope.project.features.trackChanges
showCodeCheckerOnboarding: !window.userSettings.syntaxValidation?
}
$scope.user = window.user

View file

@ -129,7 +129,7 @@ define [
entries = $scope.reviewPanel.entries[$scope.editor.open_doc_id] or {}
Object.keys(entries).length
), (nEntries) ->
$scope.reviewPanel.hasEntries = nEntries > 0 and $scope.trackChangesFeatureFlag
$scope.reviewPanel.hasEntries = nEntries > 0 and $scope.project.features.trackChanges
$scope.$watch "ui.reviewPanelOpen", (reviewPanelOpen) ->
return if !reviewPanelOpen?