diff --git a/services/web/app/views/project/editor/review-panel.jade b/services/web/app/views/project/editor/review-panel.jade index f3e9457558..a994a87de2 100644 --- a/services/web/app/views/project/editor/review-panel.jade +++ b/services/web/app/views/project/editor/review-panel.jade @@ -1,7 +1,7 @@ #review-panel .review-panel-toolbar resolved-comments-dropdown( - entries="reviewPanel.entries" + entries="reviewPanel.resolvedComments" threads="reviewPanel.commentThreads" resolved-ids="reviewPanel.resolvedThreadIds" docs="docs" 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 1db13c291e..cdb66c52b9 100644 --- a/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee +++ b/services/web/public/coffee/ide/review-panel/controllers/ReviewPanelController.coffee @@ -13,6 +13,7 @@ define [ $scope.reviewPanel = entries: {} + resolvedComments: {} hasEntries: false subView: $scope.SubViews.CUR_FILE openSubView: $scope.SubViews.CUR_FILE @@ -69,6 +70,10 @@ define [ $scope.reviewPanel.entries[doc_id] ?= {} return $scope.reviewPanel.entries[doc_id] + getDocResolvedComments = (doc_id) -> + $scope.reviewPanel.resolvedComments[doc_id] ?= {} + return $scope.reviewPanel.resolvedComments[doc_id] + getChangeTracker = (doc_id) -> if !rangesTrackers[doc_id]? rangesTrackers[doc_id] = new RangesTracker() @@ -162,6 +167,7 @@ define [ updateEntries = (doc_id) -> rangesTracker = getChangeTracker(doc_id) entries = getDocEntries(doc_id) + resolvedComments = getDocResolvedComments(doc_id) changed = false @@ -170,6 +176,8 @@ define [ for change_id, change of entries if change_id != "add-comment" delete_changes[change_id] = true + for change_id, change of resolvedComments + delete_changes[change_id] = true for change in rangesTracker.changes changed = true @@ -194,7 +202,10 @@ define [ for comment in rangesTracker.comments changed = true delete delete_changes[comment.id] - entries[comment.id] ?= {} + if $scope.reviewPanel.resolvedThreadIds[comment.op.t] + new_comment = resolvedComments[comment.id] ?= {} + else + new_comment = entries[comment.id] ?= {} new_entry = { type: "comment" thread_id: comment.op.t @@ -202,11 +213,12 @@ define [ offset: comment.op.p } for key, value of new_entry - entries[comment.id][key] = value + new_comment[key] = value for change_id, _ of delete_changes changed = true delete entries[change_id] + delete resolvedComments[change_id] if changed $scope.$broadcast "entries:changed"