diff --git a/services/web/app/views/project/editor/review-panel.pug b/services/web/app/views/project/editor/review-panel.pug index b6ddf3ce96..23857b4e4b 100644 --- a/services/web/app/views/project/editor/review-panel.pug +++ b/services/web/app/views/project/editor/review-panel.pug @@ -20,12 +20,18 @@ is-loading="reviewPanel.dropdown.loading" permissions="permissions" ) - span.review-panel-toolbar-label(ng-if="permissions.write", ng-click="fooBarBaz($event);") + span.review-panel-toolbar-label(ng-if="permissions.write") span(ng-click="toggleTrackChanges(true)", ng-if="editor.wantTrackChanges === false") Track Changes is strong off span(ng-click="toggleTrackChanges(false)", ng-if="editor.wantTrackChanges === true") Track Changes is strong on - review-panel-toggle(ng-if="editor.wantTrackChanges == editor.trackChanges", ng-model="editor.wantTrackChanges", on-toggle="toggleTrackChanges") + review-panel-toggle( + ng-if="editor.wantTrackChanges == editor.trackChanges" + ng-model="editor.wantTrackChanges" + on-toggle="toggleTrackChanges" + disabled="!project.features.hasTrackChanges" + on-disabled-click="openTrackChangesUpgradeModal" + ) span.review-panel-toolbar-label.review-panel-toolbar-label-disabled(ng-if="!permissions.write") span(ng-if="editor.wantTrackChanges === false") Track Changes is strong off diff --git a/services/web/public/coffee/ide/connection/ConnectionManager.coffee b/services/web/public/coffee/ide/connection/ConnectionManager.coffee index afbc656a02..a8696fc999 100644 --- a/services/web/public/coffee/ide/connection/ConnectionManager.coffee +++ b/services/web/public/coffee/ide/connection/ConnectionManager.coffee @@ -1,3 +1,4 @@ + define [], () -> ONEHOUR = 1000 * 60 * 60 class ConnectionManager 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 4808d1ce84..de52d0188a 100644 --- a/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee +++ b/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee @@ -7,6 +7,10 @@ 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 = false + $scope.SubViews = CUR_FILE : "cur_file" OVERVIEW : "overview" @@ -431,13 +435,12 @@ define [ ide.editorManager.openDocId(doc_id, { gotoOffset: entry.offset }) $scope.toggleTrackChanges = (value) -> - if true # TODO check feature/permission + if $scope.project.features.hasTrackChanges + $scope.editor.wantTrackChanges = value + $http.post "/project/#{$scope.project_id}/track_changes", {_csrf: window.csrfToken, on: value} + event_tracking.sendMB "rp-trackchanges-toggle", { value } + else $scope.openTrackChangesUpgradeModal() - return - - $scope.editor.wantTrackChanges = value - $http.post "/project/#{$scope.project_id}/track_changes", {_csrf: window.csrfToken, on: value} - event_tracking.sendMB "rp-trackchanges-toggle", { value } ide.socket.on "toggle-track-changes", (value) -> $scope.$apply () ->