mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Keep track of resolved threads in the dropdown.
This commit is contained in:
parent
3668d7dd1f
commit
010612aacc
3 changed files with 15 additions and 16 deletions
|
@ -3,6 +3,7 @@
|
|||
resolved-comments-dropdown(
|
||||
entries="reviewPanel.entries"
|
||||
threads="reviewPanel.commentThreads"
|
||||
resolved-ids="reviewPanel.resolvedThreadIds"
|
||||
docs="docs"
|
||||
on-open="refreshResolvedCommentsDropdown();"
|
||||
on-unresolve="unresolveComment(threadId);"
|
||||
|
@ -271,7 +272,7 @@ script(type='text/ng-template', id='resolvedCommentsDropdownTemplate')
|
|||
ng-if="!isLoading"
|
||||
)
|
||||
resolved-comment-entry(
|
||||
ng-repeat="thread in resolvedComments"
|
||||
ng-repeat="thread in resolvedComments | orderBy:'-resolved_at'"
|
||||
thread="thread"
|
||||
on-unresolve="handleUnresolve(threadId);"
|
||||
on-delete="handleDelete(entryId, threadId);"
|
||||
|
|
|
@ -21,6 +21,7 @@ define [
|
|||
dropdown:
|
||||
loading: false
|
||||
commentThreads: {}
|
||||
resolvedThreadIds: {}
|
||||
|
||||
$scope.commentState =
|
||||
adding: false
|
||||
|
@ -53,7 +54,6 @@ define [
|
|||
_onCommentReopened(thread_id)
|
||||
|
||||
rangesTrackers = {}
|
||||
resolvedThreadIds = {}
|
||||
|
||||
getDocEntries = (doc_id) ->
|
||||
$scope.reviewPanel.entries[doc_id] ?= {}
|
||||
|
@ -62,7 +62,7 @@ define [
|
|||
getChangeTracker = (doc_id) ->
|
||||
if !rangesTrackers[doc_id]?
|
||||
rangesTrackers[doc_id] = new RangesTracker()
|
||||
rangesTrackers[doc_id].resolvedThreadIds = resolvedThreadIds
|
||||
rangesTrackers[doc_id].resolvedThreadIds = $scope.reviewPanel.resolvedThreadIds
|
||||
return rangesTrackers[doc_id]
|
||||
|
||||
scrollbar = {}
|
||||
|
@ -97,7 +97,7 @@ define [
|
|||
# The open doc range tracker is kept up to date in real-time so
|
||||
# replace any outdated info with this
|
||||
rangesTrackers[doc.doc_id] = doc.ranges
|
||||
rangesTrackers[doc.doc_id].resolvedThreadIds = resolvedThreadIds
|
||||
rangesTrackers[doc.doc_id].resolvedThreadIds = $scope.reviewPanel.resolvedThreadIds
|
||||
$scope.reviewPanel.rangesTracker = rangesTrackers[doc.doc_id]
|
||||
if old_doc?
|
||||
old_doc.off "flipped_pending_to_inflight"
|
||||
|
@ -284,7 +284,7 @@ define [
|
|||
thread.resolved = true
|
||||
thread.resolved_by_user = formatUser(user)
|
||||
thread.resolved_at = new Date()
|
||||
resolvedThreadIds[thread_id] = true
|
||||
$scope.reviewPanel.resolvedThreadIds[thread_id] = true
|
||||
$scope.$broadcast "comment:resolve_thread", thread_id
|
||||
|
||||
_onCommentReopened = (thread_id) ->
|
||||
|
@ -292,14 +292,16 @@ define [
|
|||
delete thread.resolved
|
||||
delete thread.resolved_by_user
|
||||
delete thread.resolved_at
|
||||
delete resolvedThreadIds[thread_id]
|
||||
delete $scope.reviewPanel.resolvedThreadIds[thread_id]
|
||||
$scope.$broadcast "comment:unresolve_thread", thread_id
|
||||
|
||||
_onCommentDeleted = (thread_id) ->
|
||||
if $scope.reviewPanel.resolvedThreadIds[thread_id]?
|
||||
delete $scope.reviewPanel.resolvedThreadIds[thread_id]
|
||||
|
||||
delete $scope.reviewPanel.commentThreads[thread_id]
|
||||
|
||||
$scope.deleteComment = (entry_id, thread_id) ->
|
||||
console.log thread_id
|
||||
_onCommentDeleted(thread_id)
|
||||
$scope.$broadcast "comment:remove", entry_id
|
||||
|
||||
|
@ -344,15 +346,15 @@ define [
|
|||
refreshThreads = () ->
|
||||
$http.get "/project/#{$scope.project_id}/threads"
|
||||
.success (threads) ->
|
||||
for thread_id, _ of resolvedThreadIds
|
||||
delete resolvedThreadIds[thread_id]
|
||||
for thread_id, _ of $scope.reviewPanel.resolvedThreadIds
|
||||
delete $scope.reviewPanel.resolvedThreadIds[thread_id]
|
||||
for thread_id, thread of threads
|
||||
for comment in thread.messages
|
||||
formatComment(comment)
|
||||
if thread.resolved_by_user?
|
||||
$scope.$broadcast "comment:resolve_thread", thread_id
|
||||
thread.resolved_by_user = formatUser(thread.resolved_by_user)
|
||||
resolvedThreadIds[thread_id] = true
|
||||
$scope.reviewPanel.resolvedThreadIds[thread_id] = true
|
||||
$scope.reviewPanel.commentThreads = threads
|
||||
|
||||
refreshThreads()
|
||||
|
|
|
@ -7,6 +7,7 @@ define [
|
|||
scope:
|
||||
entries : "="
|
||||
threads : "="
|
||||
resolvedIds : "="
|
||||
docs : "="
|
||||
onOpen : "&"
|
||||
onUnresolve : "&"
|
||||
|
@ -27,11 +28,9 @@ define [
|
|||
|
||||
scope.handleUnresolve = (threadId) ->
|
||||
scope.onUnresolve({ threadId })
|
||||
filterResolvedComments()
|
||||
|
||||
scope.handleDelete = (entryId, threadId) ->
|
||||
scope.onDelete({ entryId, threadId })
|
||||
filterResolvedComments()
|
||||
|
||||
getDocNameById = (docId) ->
|
||||
doc = _.find(scope.docs, (doc) -> doc.doc.id = docId)
|
||||
|
@ -56,7 +55,4 @@ define [
|
|||
|
||||
scope.resolvedComments.push(resolvedComment)
|
||||
|
||||
scope.$watchCollection "entries", filterResolvedComments
|
||||
scope.$watchCollection "threads", filterResolvedComments
|
||||
|
||||
|
||||
scope.$watchCollection "resolvedIds", filterResolvedComments
|
||||
|
|
Loading…
Reference in a new issue