From 70134d44d06839f08f1dc01d353ac59812e6bc5d Mon Sep 17 00:00:00 2001 From: Paulo Reis Date: Mon, 9 Jan 2017 17:22:01 +0000 Subject: [PATCH] Add unresolve action to the dropdown. --- services/web/app/views/project/editor/review-panel.jade | 8 +++++++- .../review-panel/controllers/ReviewPanelController.coffee | 6 +++--- .../review-panel/directives/resolvedCommentEntry.coffee | 4 ++-- .../directives/resolvedCommentsDropdown.coffee | 6 ++++++ 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/services/web/app/views/project/editor/review-panel.jade b/services/web/app/views/project/editor/review-panel.jade index 91f0b762f7..886f99ffe3 100644 --- a/services/web/app/views/project/editor/review-panel.jade +++ b/services/web/app/views/project/editor/review-panel.jade @@ -5,6 +5,7 @@ threads="reviewPanel.commentThreads" docs="docs" on-open="refreshResolvedCommentsDropdown();" + on-unresolve="unresolveComment(threadId);" is-loading="reviewPanel.dropdown.loading" ) span.review-panel-toolbar-label(ng-click="editor.wantTrackChanges = true;", ng-if="editor.wantTrackChanges === false") Track Changes is @@ -201,7 +202,10 @@ script(type='text/ng-template', id='resolvedCommentEntryTemplate') | {{ thread.resolved_at | date : 'MMM d, y h:mm a' }} .rp-entry-actions - a.rp-entry-button(href, ng-click="onUnresolve();") + a.rp-entry-button( + href + ng-click="onUnresolve({ 'threadId': threadId });" + ) |  Re-open a.rp-entry-button(href, ng-click="onDelete();") |  Delete @@ -265,7 +269,9 @@ script(type='text/ng-template', id='resolvedCommentsDropdownTemplate') ) resolved-comment-entry( ng-repeat="thread in resolvedCommentsPerFile[doc.doc.id]" + thread-id="thread.threadId" thread="thread" doc="doc" + on-unresolve="handleUnresolve(threadId);" ) 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 8de7822ecd..d84c0cb354 100644 --- a/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee +++ b/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee @@ -285,9 +285,9 @@ define [ $http.post "/project/#{$scope.project_id}/thread/#{entry.thread_id}/resolve", {_csrf: window.csrfToken} _onCommentResolved(entry.thread_id, ide.$scope.user) - $scope.unresolveComment = (entry, entry_id) -> - _onCommentReopened(entry.thread_id) - $http.post "/project/#{$scope.project_id}/thread/#{entry.thread_id}/reopen", {_csrf: window.csrfToken} + $scope.unresolveComment = (thread_id) -> + _onCommentReopened(thread_id) + $http.post "/project/#{$scope.project_id}/thread/#{thread_id}/reopen", {_csrf: window.csrfToken} _onCommentResolved = (thread_id, user) -> thread = $scope.reviewPanel.commentThreads[thread_id] diff --git a/services/web/public/coffee/ide/review-panel/directives/resolvedCommentEntry.coffee b/services/web/public/coffee/ide/review-panel/directives/resolvedCommentEntry.coffee index e3691c1962..28acad8b99 100644 --- a/services/web/public/coffee/ide/review-panel/directives/resolvedCommentEntry.coffee +++ b/services/web/public/coffee/ide/review-panel/directives/resolvedCommentEntry.coffee @@ -5,7 +5,7 @@ define [ restrict: "E" templateUrl: "resolvedCommentEntryTemplate" scope: + threadId: "=" thread: "=" doc: "=" - onReopen: "&" - onDelete: "&" \ No newline at end of file + onUnresolve: "&" \ No newline at end of file diff --git a/services/web/public/coffee/ide/review-panel/directives/resolvedCommentsDropdown.coffee b/services/web/public/coffee/ide/review-panel/directives/resolvedCommentsDropdown.coffee index df3299de51..e0144f9d94 100644 --- a/services/web/public/coffee/ide/review-panel/directives/resolvedCommentsDropdown.coffee +++ b/services/web/public/coffee/ide/review-panel/directives/resolvedCommentsDropdown.coffee @@ -9,6 +9,7 @@ define [ threads : "=" docs : "=" onOpen : "&" + onUnresolve : "&" isLoading : "=" link: (scope, element, attrs) -> @@ -22,6 +23,10 @@ define [ scope.resolvedCommentsPerFile = {} + scope.handleUnresolve = (threadId) -> + scope.onUnresolve({ threadId }) + filterResolvedComments() + filterResolvedComments = () -> scope.resolvedCommentsPerFile = {} @@ -31,6 +36,7 @@ define [ if entry.type == "comment" and scope.threads[entry.thread_id]?.resolved? scope.resolvedCommentsPerFile[fileId][entryId] = angular.copy scope.threads[entry.thread_id] scope.resolvedCommentsPerFile[fileId][entryId].content = entry.content + scope.resolvedCommentsPerFile[fileId][entryId].threadId = entry.thread_id scope.$watchCollection "entries", filterResolvedComments scope.$watchCollection "threads", filterResolvedComments