diff --git a/services/web/app/views/project/editor/review-panel.pug b/services/web/app/views/project/editor/review-panel.pug index 844e7946e4..c0ac5dd75b 100644 --- a/services/web/app/views/project/editor/review-panel.pug +++ b/services/web/app/views/project/editor/review-panel.pug @@ -51,14 +51,22 @@ ng-if="editor.wantTrackChanges === true" ) i.fa.fa-circle - span(ng-click="toggleFullTCStateCollapse();", ng-if="editor.wantTrackChanges === false") !{translate("track_changes_is_off")} - span(ng-click="toggleFullTCStateCollapse();", ng-if="editor.wantTrackChanges === true") !{translate("track_changes_is_on")} + span(ng-click="handleTrackChangesStateClick();", ng-if="editor.wantTrackChanges === false") !{translate("track_changes_is_off")} + span(ng-click="handleTrackChangesStateClick();", ng-if="editor.wantTrackChanges === true") !{translate("track_changes_is_on")} span.rp-tc-state-collapse( + ng-if="reviewPanel.isMultiUser" ng-class="{ 'rp-tc-state-collapse-on': reviewPanel.fullTCStateCollapsed }" ) i.fa.fa-angle-down + review-panel-toggle( + ng-if="!reviewPanel.isMultiUser" + ng-model="reviewPanel.trackChangesOnForEveryone" + on-toggle="toggleTrackChangesForEveryone(isOn);" + disabled="!project.features.trackChanges || !permissions.write" + ) ul.rp-tc-state( review-panel-collapse-height="reviewPanel.fullTCStateCollapsed" + ng-if="reviewPanel.isMultiUser" ) li.rp-tc-state-item.rp-tc-state-item-everyone span.rp-tc-state-item-name Everyone diff --git a/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee b/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee index 44e8df53d7..4c1a4676c6 100644 --- a/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee +++ b/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee @@ -34,6 +34,7 @@ define [ resolvedThreadIds: {} rendererData: {} formattedProjectMembers: {} + isMultiUser: false fullTCStateCollapsed: true loadingThreads: false # All selected changes. If a aggregated change (insertion + deletion) is selection, the two ids @@ -71,11 +72,13 @@ define [ $scope.$watch "project.members", (members) -> $scope.reviewPanel.formattedProjectMembers = {} + $scope.reviewPanel.isMultiUser = false if $scope.project?.owner? $scope.reviewPanel.formattedProjectMembers[$scope.project.owner._id] = formatUser($scope.project.owner) if $scope.project?.members? for member in members if member.privileges == "readAndWrite" + $scope.reviewPanel.isMultiUser = true $scope.reviewPanel.formattedProjectMembers[member._id] = formatUser(member) $scope.commentState = @@ -585,6 +588,12 @@ define [ $scope.gotoEntry = (doc_id, entry) -> ide.editorManager.openDocId(doc_id, { gotoOffset: entry.offset }) + $scope.handleTrackChangesStateClick = () -> + if $scope.reviewPanel.isMultiUser + $scope.toggleFullTCStateCollapse() + else + $scope.toggleTrackChangesForEveryone() + $scope.toggleFullTCStateCollapse = () -> if $scope.project.features.trackChanges reviewPanel.fullTCStateCollapsed = !reviewPanel.fullTCStateCollapsed @@ -633,7 +642,7 @@ define [ _setUserTCState(member._id, state[member._id] ? false) _setUserTCState($scope.project.owner._id, state[$scope.project.owner._id] ? false) - $scope.toggleTrackChangesForEveryone = (onForEveryone) -> + $scope.toggleTrackChangesForEveryone = (onForEveryone = !reviewPanel.trackChangesOnForEveryone) -> _setEveryoneTCState onForEveryone, true applyClientTrackChangesStateToServer()