mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Only call /project/.../threads if we need the threads
This commit is contained in:
parent
4a47d135c7
commit
960d1e8b2f
2 changed files with 10 additions and 4 deletions
|
@ -185,7 +185,7 @@ script(type='text/ng-template', id='commentEntryTemplate')
|
|||
| {{ comment.content }}
|
||||
.rp-entry-metadata
|
||||
| {{ comment.timestamp | date : 'MMM d, y h:mm a' }}
|
||||
.rp-loading(ng-if="threads[entry.thread_id].submitting")
|
||||
.rp-loading(ng-if="!threads[entry.thread_id] || threads[entry.thread_id].submitting")
|
||||
i.fa.fa-spinner.fa-spin
|
||||
.rp-comment-reply(ng-if="permissions.comment")
|
||||
textarea.rp-comment-input(
|
||||
|
|
|
@ -205,6 +205,9 @@ define [
|
|||
if !$scope.users[change.metadata.user_id]?
|
||||
refreshChangeUsers(change.metadata.user_id)
|
||||
|
||||
if rangesTracker.comments.length > 0
|
||||
ensureThreadsAreLoaded()
|
||||
|
||||
for comment in rangesTracker.comments
|
||||
changed = true
|
||||
delete delete_changes[comment.id]
|
||||
|
@ -394,7 +397,12 @@ define [
|
|||
.error () ->
|
||||
_refreshingRangeUsers = false
|
||||
|
||||
refreshThreads = () ->
|
||||
_threadsLoaded = false
|
||||
ensureThreadsAreLoaded = () ->
|
||||
if _threadsLoaded
|
||||
# We get any updates in real time so only need to load them once.
|
||||
return
|
||||
_threadsLoaded = true
|
||||
$http.get "/project/#{$scope.project_id}/threads"
|
||||
.success (threads) ->
|
||||
for thread_id, _ of $scope.reviewPanel.resolvedThreadIds
|
||||
|
@ -408,8 +416,6 @@ define [
|
|||
$scope.reviewPanel.resolvedThreadIds[thread_id] = true
|
||||
$scope.reviewPanel.commentThreads = threads
|
||||
|
||||
refreshThreads()
|
||||
|
||||
formatComment = (comment) ->
|
||||
comment.user = formatUser(comment.user)
|
||||
comment.timestamp = new Date(comment.timestamp)
|
||||
|
|
Loading…
Reference in a new issue