Remove thread from view collection; some clean-up.

This commit is contained in:
Paulo Reis 2017-01-10 11:23:06 +00:00
parent 32fb317820
commit 072044ee90
3 changed files with 12 additions and 21 deletions

View file

@ -6,7 +6,7 @@
docs="docs"
on-open="refreshResolvedCommentsDropdown();"
on-unresolve="unresolveComment(threadId);"
on-delete="deleteComment(entryId);"
on-delete="deleteComment(entryId, threadId);"
is-loading="reviewPanel.dropdown.loading"
)
span.review-panel-toolbar-label(ng-click="editor.wantTrackChanges = true;", ng-if="editor.wantTrackChanges === false") Track Changes is
@ -210,7 +210,7 @@ script(type='text/ng-template', id='resolvedCommentEntryTemplate')
|  Re-open
a.rp-entry-button(
href
ng-click="onDelete({ 'entryId': entryId });"
ng-click="onDelete({ 'entryId': entryId, 'threadId': threadId });"
)
|  Delete
@ -278,6 +278,6 @@ script(type='text/ng-template', id='resolvedCommentsDropdownTemplate')
thread="thread"
doc="doc"
on-unresolve="handleUnresolve(threadId);"
on-delete="handleDelete(entryId);"
on-delete="handleDelete(entryId, threadId);"
)

View file

@ -66,7 +66,7 @@ define [
$scope.reviewPanelEventsBridge.on "aceScrollbarVisibilityChanged", (isVisible, scrollbarWidth) ->
scrollbar = {isVisible, scrollbarWidth}
updateScrollbar()
updateScrollbar = () ->
if scrollbar.isVisible and $scope.reviewPanel.subView == $scope.SubViews.CUR_FILE
$reviewPanelEl.css "right", "#{ scrollbar.scrollbarWidth }px"
@ -231,9 +231,6 @@ define [
$scope.$broadcast "review-panel:recalculate-screen-positions"
$scope.$broadcast "review-panel:layout"
$scope.$on "comment:removed", (comment) ->
console.log comment
$scope.acceptChange = (entry_id) ->
$http.post "/project/#{$scope.project_id}/doc/#{$scope.editor.open_doc_id}/changes/#{entry_id}/accept", {_csrf: window.csrfToken}
$scope.$broadcast "change:accept", entry_id
@ -283,7 +280,6 @@ define [
$scope.$broadcast "review-panel:layout"
$scope.resolveComment = (entry, entry_id) ->
entry.showWhenResolved = false
entry.focused = false
$http.post "/project/#{$scope.project_id}/thread/#{entry.thread_id}/resolve", {_csrf: window.csrfToken}
_onCommentResolved(entry.thread_id, ide.$scope.user)
@ -305,20 +301,15 @@ define [
delete thread.resolved_by_user
delete thread.resolved_at
$scope.$broadcast "comment:unresolve_thread", thread_id
_onCommentDeleted = (thread_id) ->
delete $scope.reviewPanel.commentThreads[thread_id]
$scope.deleteComment = (entry_id) ->
$scope.deleteComment = (entry_id, thread_id) ->
console.log thread_id
_onCommentDeleted(thread_id)
$scope.$broadcast "comment:remove", entry_id
$scope.showThread = (entry) ->
entry.showWhenResolved = true
$timeout () ->
$scope.$broadcast "review-panel:layout"
$scope.hideThread = (entry) ->
entry.showWhenResolved = false
$timeout () ->
$scope.$broadcast "review-panel:layout"
$scope.setSubView = (subView) ->
$scope.reviewPanel.subView = subView

View file

@ -29,8 +29,8 @@ define [
scope.onUnresolve({ threadId })
filterResolvedComments()
scope.handleDelete = (entryId) ->
scope.onDelete({ entryId })
scope.handleDelete = (entryId, threadId) ->
scope.onDelete({ entryId, threadId })
filterResolvedComments()