Add basic comment replying
This commit is contained in:
+9
-6
@@ -89,18 +89,21 @@ define [
|
||||
turn_off_tracking: () ->
|
||||
@changesTracker.track_changes = false
|
||||
|
||||
addComment: (offset, length, comment) ->
|
||||
addComment: (offset, length, content) ->
|
||||
@changesTracker.addComment offset, length, {
|
||||
comment: comment
|
||||
user_id: window.user_id
|
||||
thread: [{
|
||||
content: content
|
||||
user_id: window.user_id
|
||||
ts: new Date()
|
||||
}]
|
||||
}
|
||||
|
||||
addCommentToSelection: (comment) ->
|
||||
addCommentToSelection: (content) ->
|
||||
range = @editor.getSelectionRange()
|
||||
offset = @_aceRangeToShareJs(range.start)
|
||||
end = @_aceRangeToShareJs(range.end)
|
||||
length = end - offset
|
||||
@addComment(offset, length, comment)
|
||||
@addComment(offset, length, content)
|
||||
|
||||
selectLineIfNoSelection: () ->
|
||||
if @editor.selection.isEmpty()
|
||||
@@ -163,7 +166,7 @@ define [
|
||||
for comment in @changesTracker.comments
|
||||
@$scope.reviewPanel.entries[comment.id] = {
|
||||
type: "comment"
|
||||
content: comment.metadata.comment
|
||||
thread: comment.metadata.thread
|
||||
offset: comment.offset
|
||||
}
|
||||
@updateFocus()
|
||||
|
||||
+17
-4
@@ -60,11 +60,24 @@ define [
|
||||
scroller.scrollTop(scroller.scrollTop() + deltaY * 4)
|
||||
e.preventDefault()
|
||||
|
||||
$scope.startAddingComment = () ->
|
||||
$scope.startNewComment = () ->
|
||||
$scope.commentState.adding = true
|
||||
$scope.$broadcast "comment:select_line"
|
||||
|
||||
$scope.submitComment = () ->
|
||||
$scope.submitNewComment = () ->
|
||||
$scope.commentState.adding = false
|
||||
console.log "ADDING COMMENT", $scope.commentState.content
|
||||
$scope.$broadcast "comment:add", $scope.commentState.content
|
||||
$scope.$broadcast "comment:add", $scope.commentState.content
|
||||
$scope.commentState.content = ""
|
||||
|
||||
$scope.startReply = (entry) ->
|
||||
console.log "Start new reply"
|
||||
entry.replying = true
|
||||
|
||||
$scope.submitReply = (entry) ->
|
||||
entry.thread.push {
|
||||
content: entry.replyContent
|
||||
ts: new Date()
|
||||
user_id: window.user_id
|
||||
}
|
||||
entry.replyContent = ""
|
||||
entry.replying = false
|
||||
Reference in New Issue
Block a user