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