Automatically disable guest-track-changes when project made private

This commit is contained in:
Shane Kilkelly 2017-10-25 14:48:32 +01:00
parent 6e8e4e6453
commit 5f6e191c5f
2 changed files with 10 additions and 4 deletions

View file

@ -83,12 +83,11 @@
li.rp-tc-state-separator
li.rp-tc-state-item.rp-tc-state-item-guests
// span.rp-tc-state-item-name !{translate("tc_guests")}
span.rp-tc-state-item-name Guests
span.rp-tc-state-item-name !{translate("tc_guests")}
review-panel-toggle(
ng-model="reviewPanel.trackChangesOnForGuests"
on-toggle="toggleTrackChangesForGuests(isOn);"
disabled="!project.features.trackChanges || !permissions.write"
disabled="!project.features.trackChanges || !permissions.write || !trackChangesForGuestsAvailable"
)
.rp-entry-list(

View file

@ -22,6 +22,7 @@ define [
trackChangesOnForEveryone: false
trackChangesOnForGuests: false
trackChangesOnForThisGuestClient: false
trackChangesForGuestsAvailable: false
entries: {}
resolvedComments: {}
hasEntries: false
@ -81,6 +82,13 @@ define [
if member.privileges == "readAndWrite"
$scope.reviewPanel.formattedProjectMembers[member._id] = formatUser(member)
$scope.$watch 'project.publicAccesLevel', (level) ->
if level?
available = $scope.trackChangesForGuestsAvailable = level == 'tokenBased'
if !available
$scope.trackChangesOnForThisGuestClient = false
$scope.toggleTrackChangesForGuests false
$scope.commentState =
adding: false
content: ""
@ -650,7 +658,6 @@ define [
$http.post "/project/#{$scope.project_id}/track_changes", data
applyTrackChangesStateToClient = (state) ->
console.log ">> applying tc state to client", state
if typeof state is "boolean"
_setEveryoneTCState state
_setGuestsTCState state