|
@@ -136,6 +136,22 @@ module.exports = DocumentManager =
|
|
|
RedisManager.updateDocument doc_id, lines, version, [], new_ranges, (error) ->
|
|
RedisManager.updateDocument doc_id, lines, version, [], new_ranges, (error) ->
|
|
|
return callback(error) if error?
|
|
return callback(error) if error?
|
|
|
callback()
|
|
callback()
|
|
|
|
|
+
|
|
|
|
|
+ deleteComment: (project_id, doc_id, comment_id, _callback = (error) ->) ->
|
|
|
|
|
+ timer = new Metrics.Timer("docManager.deleteComment")
|
|
|
|
|
+ callback = (args...) ->
|
|
|
|
|
+ timer.done()
|
|
|
|
|
+ _callback(args...)
|
|
|
|
|
+
|
|
|
|
|
+ DocumentManager.getDoc project_id, doc_id, (error, lines, version, ranges) ->
|
|
|
|
|
+ return callback(error) if error?
|
|
|
|
|
+ if !lines? or !version?
|
|
|
|
|
+ return callback(new Errors.NotFoundError("document not found: #{doc_id}"))
|
|
|
|
|
+ RangesManager.deleteComment comment_id, ranges, (error, new_ranges) ->
|
|
|
|
|
+ return callback(error) if error?
|
|
|
|
|
+ RedisManager.updateDocument doc_id, lines, version, [], new_ranges, (error) ->
|
|
|
|
|
+ return callback(error) if error?
|
|
|
|
|
+ callback()
|
|
|
|
|
|
|
|
getDocWithLock: (project_id, doc_id, callback = (error, lines, version) ->) ->
|
|
getDocWithLock: (project_id, doc_id, callback = (error, lines, version) ->) ->
|
|
|
UpdateManager = require "./UpdateManager"
|
|
UpdateManager = require "./UpdateManager"
|
|
@@ -160,3 +176,7 @@ module.exports = DocumentManager =
|
|
|
acceptChangeWithLock: (project_id, doc_id, change_id, callback = (error) ->) ->
|
|
acceptChangeWithLock: (project_id, doc_id, change_id, callback = (error) ->) ->
|
|
|
UpdateManager = require "./UpdateManager"
|
|
UpdateManager = require "./UpdateManager"
|
|
|
UpdateManager.lockUpdatesAndDo DocumentManager.acceptChange, project_id, doc_id, change_id, callback
|
|
UpdateManager.lockUpdatesAndDo DocumentManager.acceptChange, project_id, doc_id, change_id, callback
|
|
|
|
|
+
|
|
|
|
|
+ deleteCommentWithLock: (project_id, doc_id, thread_id, callback = (error) ->) ->
|
|
|
|
|
+ UpdateManager = require "./UpdateManager"
|
|
|
|
|
+ UpdateManager.lockUpdatesAndDo DocumentManager.deleteComment, project_id, doc_id, thread_id, callback
|