2016-10-12 12:27:20 -04:00
|
|
|
define [
|
|
|
|
"base",
|
|
|
|
"utils/EventEmitter"
|
2016-11-09 11:23:08 -05:00
|
|
|
"ide/colors/ColorManager"
|
2016-12-08 09:10:30 -05:00
|
|
|
"ide/review-panel/RangesTracker"
|
|
|
|
], (App, EventEmitter, ColorManager, RangesTracker) ->
|
2016-12-09 10:43:08 -05:00
|
|
|
App.controller "ReviewPanelController", ($scope, $element, ide, $timeout, $http) ->
|
2016-11-17 07:02:45 -05:00
|
|
|
$reviewPanelEl = $element.find "#review-panel"
|
|
|
|
|
2016-11-16 07:31:47 -05:00
|
|
|
$scope.SubViews =
|
|
|
|
CUR_FILE : "cur_file"
|
|
|
|
OVERVIEW : "overview"
|
|
|
|
|
2016-10-12 12:27:20 -04:00
|
|
|
$scope.reviewPanel =
|
|
|
|
entries: {}
|
2016-11-15 10:04:29 -05:00
|
|
|
hasEntries: false
|
2016-11-16 07:31:47 -05:00
|
|
|
subView: $scope.SubViews.CUR_FILE
|
2016-11-17 09:57:11 -05:00
|
|
|
openSubView: $scope.SubViews.CUR_FILE
|
2016-12-09 10:43:08 -05:00
|
|
|
overview:
|
|
|
|
loading: false
|
2016-11-15 10:04:29 -05:00
|
|
|
|
2016-11-09 09:50:58 -05:00
|
|
|
$scope.commentState =
|
|
|
|
adding: false
|
|
|
|
content: ""
|
2016-11-15 10:48:12 -05:00
|
|
|
|
2016-11-17 05:40:08 -05:00
|
|
|
$scope.reviewPanelEventsBridge = new EventEmitter()
|
|
|
|
|
2016-12-08 09:10:30 -05:00
|
|
|
rangesTrackers = {}
|
2016-11-21 10:18:46 -05:00
|
|
|
|
2016-11-21 11:57:52 -05:00
|
|
|
getDocEntries = (doc_id) ->
|
|
|
|
$scope.reviewPanel.entries[doc_id] ?= {}
|
|
|
|
return $scope.reviewPanel.entries[doc_id]
|
|
|
|
|
|
|
|
getChangeTracker = (doc_id) ->
|
2016-12-08 09:10:30 -05:00
|
|
|
rangesTrackers[doc_id] ?= new RangesTracker()
|
|
|
|
return rangesTrackers[doc_id]
|
2016-11-21 11:57:52 -05:00
|
|
|
|
2016-11-21 10:18:46 -05:00
|
|
|
# TODO Just for prototyping purposes; remove afterwards.
|
|
|
|
mockedUserId = 'mock_user_id_1'
|
|
|
|
mockedUserId2 = 'mock_user_id_2'
|
|
|
|
|
|
|
|
if window.location.search.match /mocktc=true/
|
|
|
|
mock_changes = {
|
|
|
|
"main.tex":
|
|
|
|
changes: [{
|
|
|
|
op: { i: "Habitat loss and conflicts with humans are the greatest causes of concern.", p: 925 - 38 }
|
|
|
|
metadata: { user_id: mockedUserId, ts: new Date(Date.now() - 30 * 60 * 1000) }
|
|
|
|
}, {
|
|
|
|
op: { d: "The lion is now a vulnerable species. ", p: 778 }
|
|
|
|
metadata: { user_id: mockedUserId, ts: new Date(Date.now() - 31 * 60 * 1000) }
|
|
|
|
}]
|
|
|
|
comments: [{
|
|
|
|
offset: 1375 - 38
|
|
|
|
length: 79
|
|
|
|
metadata:
|
|
|
|
thread: [{
|
|
|
|
content: "Do we have a source for this?"
|
|
|
|
user_id: mockedUserId
|
|
|
|
ts: new Date(Date.now() - 45 * 60 * 1000)
|
|
|
|
}]
|
|
|
|
}]
|
|
|
|
"chapter_1.tex":
|
|
|
|
changes: [{
|
|
|
|
"op":{"p":740,"d":", to take down large animals"},
|
|
|
|
"metadata":{"user_id":mockedUserId, ts: new Date(Date.now() - 15 * 60 * 1000)}
|
|
|
|
}, {
|
|
|
|
"op":{"i":", to keep hold of the prey","p":920},
|
|
|
|
"metadata":{"user_id":mockedUserId, ts: new Date(Date.now() - 130 * 60 * 1000)}
|
|
|
|
}, {
|
|
|
|
"op":{"i":" being","p":1057},
|
|
|
|
"metadata":{"user_id":mockedUserId2, ts: new Date(Date.now() - 72 * 60 * 1000)}
|
|
|
|
}]
|
|
|
|
comments:[{
|
|
|
|
"offset":111,"length":5,
|
|
|
|
"metadata":{
|
|
|
|
"thread": [
|
|
|
|
{"content":"Have we used 'pride' too much here?","user_id":mockedUserId, ts: new Date(Date.now() - 12 * 60 * 1000)},
|
|
|
|
{"content":"No, I think this is OK","user_id":mockedUserId2, ts: new Date(Date.now() - 9 * 60 * 1000)}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
},{
|
|
|
|
"offset":452,"length":21,
|
|
|
|
"metadata":{
|
|
|
|
"thread":[
|
|
|
|
{"content":"TODO: Don't use as many parentheses!","user_id":mockedUserId2, ts: new Date(Date.now() - 99 * 60 * 1000)}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
"chapter_2.tex":
|
|
|
|
changes: [{
|
|
|
|
"op":{"p":458,"d":"other"},
|
|
|
|
"metadata":{"user_id":mockedUserId, ts: new Date(Date.now() - 133 * 60 * 1000)}
|
|
|
|
},{
|
|
|
|
"op":{"i":"usually 2-3, ","p":928},
|
|
|
|
"metadata":{"user_id":mockedUserId, ts: new Date(Date.now() - 27 * 60 * 1000)}
|
|
|
|
},{
|
|
|
|
"op":{"i":"If the parents are a male lion and a female tiger, it is called a liger. A tigon comes from a male tiger and a female lion.","p":1126},
|
|
|
|
"metadata":{"user_id":mockedUserId, ts: new Date(Date.now() - 152 * 60 * 1000)}
|
|
|
|
}]
|
|
|
|
comments: [{
|
|
|
|
"offset":299,"length":10,
|
|
|
|
"metadata":{
|
|
|
|
"thread":[{
|
|
|
|
"content":"Should we use a different word here if 'den' needs clarifying?","user_id":mockedUserId,"ts": new Date(Date.now() - 430 * 60 * 1000)
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
},{
|
|
|
|
"offset":843,"length":66,
|
|
|
|
"metadata":{
|
|
|
|
"thread":[{
|
|
|
|
"content":"This sentence is a little ambiguous","user_id":mockedUserId,"ts": new Date(Date.now() - 430 * 60 * 1000)
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
ide.$scope.$on "file-tree:initialized", () ->
|
|
|
|
ide.fileTreeManager.forEachEntity (entity) ->
|
|
|
|
if mock_changes[entity.name]?
|
2016-12-08 09:10:30 -05:00
|
|
|
rangesTracker = getChangeTracker(entity.id)
|
2016-11-21 10:18:46 -05:00
|
|
|
for change in mock_changes[entity.name].changes
|
2016-12-08 09:10:30 -05:00
|
|
|
rangesTracker._addOp change.op, change.metadata
|
2016-11-21 10:18:46 -05:00
|
|
|
for comment in mock_changes[entity.name].comments
|
2016-12-08 09:10:30 -05:00
|
|
|
rangesTracker.addComment comment.offset, comment.length, comment.metadata
|
|
|
|
for doc_id, rangesTracker of rangesTrackers
|
2016-11-21 11:57:52 -05:00
|
|
|
updateEntries(doc_id)
|
2016-11-21 10:18:46 -05:00
|
|
|
|
2016-11-17 09:29:35 -05:00
|
|
|
scrollbar = {}
|
2016-11-17 07:02:45 -05:00
|
|
|
$scope.reviewPanelEventsBridge.on "aceScrollbarVisibilityChanged", (isVisible, scrollbarWidth) ->
|
2016-11-17 09:29:35 -05:00
|
|
|
scrollbar = {isVisible, scrollbarWidth}
|
|
|
|
updateScrollbar()
|
|
|
|
|
|
|
|
updateScrollbar = () ->
|
|
|
|
if scrollbar.isVisible and $scope.reviewPanel.subView == $scope.SubViews.CUR_FILE
|
|
|
|
$reviewPanelEl.css "right", "#{ scrollbar.scrollbarWidth }px"
|
2016-11-17 07:02:45 -05:00
|
|
|
else
|
|
|
|
$reviewPanelEl.css "right", "0"
|
2016-11-17 09:29:35 -05:00
|
|
|
|
|
|
|
$scope.$watch "reviewPanel.subView", (subView) ->
|
|
|
|
return if !subView?
|
|
|
|
updateScrollbar()
|
2016-11-17 09:57:11 -05:00
|
|
|
|
|
|
|
$scope.$watch "ui.reviewPanelOpen", (open) ->
|
|
|
|
return if !open?
|
|
|
|
if !open
|
|
|
|
# Always show current file when not open, but save current state
|
|
|
|
$scope.reviewPanel.openSubView = $scope.reviewPanel.subView
|
|
|
|
$scope.reviewPanel.subView = $scope.SubViews.CUR_FILE
|
|
|
|
else
|
|
|
|
# Reset back to what we had when previously open
|
|
|
|
$scope.reviewPanel.subView = $scope.reviewPanel.openSubView
|
2016-12-09 10:43:08 -05:00
|
|
|
|
|
|
|
$scope.$watch "reviewPanel.subView", (view) ->
|
|
|
|
return if !view?
|
|
|
|
if view == $scope.SubViews.OVERVIEW
|
|
|
|
refreshOverviewPanel()
|
2016-11-15 10:48:12 -05:00
|
|
|
|
2016-12-13 12:34:29 -05:00
|
|
|
$scope.$watch "editor.sharejs_doc", (doc) ->
|
|
|
|
return if !doc?
|
|
|
|
console.log "DOC changed", doc
|
|
|
|
# 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
|
|
|
|
$scope.reviewPanel.rangesTracker = rangesTrackers[doc.doc_id]
|
2016-11-15 10:48:12 -05:00
|
|
|
|
2016-11-16 12:17:50 -05:00
|
|
|
$scope.$watch (() ->
|
|
|
|
entries = $scope.reviewPanel.entries[$scope.editor.open_doc_id] or {}
|
|
|
|
Object.keys(entries).length
|
|
|
|
), (nEntries) ->
|
|
|
|
$scope.reviewPanel.hasEntries = nEntries > 0 and $scope.trackChangesFeatureFlag
|
2016-11-16 11:28:01 -05:00
|
|
|
|
|
|
|
$scope.$watch "ui.reviewPanelOpen", (reviewPanelOpen) ->
|
|
|
|
return if !reviewPanelOpen?
|
|
|
|
$timeout () ->
|
|
|
|
$scope.$broadcast "review-panel:toggle"
|
|
|
|
$scope.$broadcast "review-panel:layout"
|
2016-11-09 09:50:58 -05:00
|
|
|
|
2016-12-09 10:43:08 -05:00
|
|
|
refreshOverviewPanel = () ->
|
|
|
|
$scope.reviewPanel.overview.loading = true
|
|
|
|
$http.get "/project/#{$scope.project_id}/ranges"
|
|
|
|
.success (docs) ->
|
|
|
|
for doc in docs
|
|
|
|
if doc.id != $scope.editor.open_doc_id # this is kept up to date in real-time, don't overwrite
|
|
|
|
rangesTrackers[doc.id] ?= new RangesTracker()
|
|
|
|
rangesTrackers[doc.id].comments = doc.ranges?.comments or []
|
|
|
|
rangesTrackers[doc.id].changes = doc.ranges?.changes or []
|
|
|
|
updateEntries(doc.id)
|
|
|
|
$scope.reviewPanel.overview.loading = false
|
|
|
|
.error (error) ->
|
|
|
|
console.log "loading ranges errored", error
|
|
|
|
$scope.reviewPanel.overview.loading = false
|
|
|
|
|
2016-11-21 11:57:52 -05:00
|
|
|
updateEntries = (doc_id) ->
|
2016-12-08 09:10:30 -05:00
|
|
|
rangesTracker = getChangeTracker(doc_id)
|
2016-11-21 11:57:52 -05:00
|
|
|
entries = getDocEntries(doc_id)
|
|
|
|
|
|
|
|
# Assume we'll delete everything until we see it, then we'll remove it from this object
|
|
|
|
delete_changes = {}
|
|
|
|
delete_changes[change_id] = true for change_id, change of entries
|
|
|
|
|
2016-12-08 09:10:30 -05:00
|
|
|
for change in rangesTracker.changes
|
2016-11-21 11:57:52 -05:00
|
|
|
delete delete_changes[change.id]
|
|
|
|
entries[change.id] ?= {}
|
|
|
|
|
|
|
|
# Update in place to avoid a full DOM redraw via angular
|
|
|
|
metadata = {}
|
|
|
|
metadata[key] = value for key, value of change.metadata
|
|
|
|
new_entry = {
|
|
|
|
type: if change.op.i then "insert" else "delete"
|
|
|
|
content: change.op.i or change.op.d
|
|
|
|
offset: change.op.p
|
|
|
|
metadata: change.metadata
|
|
|
|
}
|
|
|
|
for key, value of new_entry
|
|
|
|
entries[change.id][key] = value
|
|
|
|
|
2016-12-08 09:10:30 -05:00
|
|
|
for comment in rangesTracker.comments
|
2016-11-21 11:57:52 -05:00
|
|
|
delete delete_changes[comment.id]
|
|
|
|
entries[comment.id] ?= {}
|
|
|
|
new_entry = {
|
|
|
|
type: "comment"
|
2016-12-13 12:57:46 -05:00
|
|
|
thread: comment.metadata.thread or []
|
|
|
|
resolved: comment.metadata?.resolved
|
|
|
|
resolved_data: comment.metadata?.resolved_data
|
|
|
|
content: comment.op.c
|
|
|
|
offset: comment.op.p
|
2016-11-21 11:57:52 -05:00
|
|
|
}
|
|
|
|
for key, value of new_entry
|
|
|
|
entries[comment.id][key] = value
|
|
|
|
|
|
|
|
for change_id, _ of delete_changes
|
|
|
|
delete entries[change_id]
|
|
|
|
|
|
|
|
$scope.$on "editor:track-changes:changed", () ->
|
|
|
|
doc_id = $scope.editor.open_doc_id
|
|
|
|
updateEntries(doc_id)
|
|
|
|
$scope.$broadcast "review-panel:recalculate-screen-positions"
|
|
|
|
$scope.$broadcast "review-panel:layout"
|
|
|
|
|
|
|
|
$scope.$on "editor:focus:changed", (e, cursor_offset, selection) ->
|
|
|
|
doc_id = $scope.editor.open_doc_id
|
|
|
|
entries = getDocEntries(doc_id)
|
|
|
|
|
|
|
|
if !selection
|
|
|
|
delete entries["add-comment"]
|
|
|
|
else
|
|
|
|
entries["add-comment"] = {
|
|
|
|
type: "add-comment"
|
|
|
|
offset: cursor_offset
|
|
|
|
}
|
|
|
|
|
|
|
|
for id, entry of entries
|
|
|
|
if entry.type == "comment" and not entry.resolved
|
|
|
|
entry.focused = (entry.offset <= cursor_offset <= entry.offset + entry.length)
|
|
|
|
else if entry.type == "insert"
|
|
|
|
entry.focused = (entry.offset <= cursor_offset <= entry.offset + entry.content.length)
|
|
|
|
else if entry.type == "delete"
|
|
|
|
entry.focused = (entry.offset == cursor_offset)
|
|
|
|
else if entry.type == "add-comment" and selection
|
|
|
|
entry.focused = true
|
|
|
|
|
|
|
|
$scope.$broadcast "review-panel:recalculate-screen-positions"
|
|
|
|
$scope.$broadcast "review-panel:layout"
|
|
|
|
|
2016-11-10 05:52:09 -05:00
|
|
|
$scope.acceptChange = (entry_id) ->
|
|
|
|
$scope.$broadcast "change:accept", entry_id
|
|
|
|
|
|
|
|
$scope.rejectChange = (entry_id) ->
|
|
|
|
$scope.$broadcast "change:reject", entry_id
|
|
|
|
|
2016-11-09 10:25:41 -05:00
|
|
|
$scope.startNewComment = () ->
|
2016-11-16 10:47:05 -05:00
|
|
|
# $scope.commentState.adding = true
|
2016-11-09 09:50:58 -05:00
|
|
|
$scope.$broadcast "comment:select_line"
|
2016-11-16 11:03:06 -05:00
|
|
|
$timeout () ->
|
|
|
|
$scope.$broadcast "review-panel:layout"
|
2016-11-09 09:50:58 -05:00
|
|
|
|
2016-11-16 10:47:05 -05:00
|
|
|
$scope.submitNewComment = (content) ->
|
|
|
|
# $scope.commentState.adding = false
|
|
|
|
$scope.$broadcast "comment:add", content
|
|
|
|
# $scope.commentState.content = ""
|
2016-11-16 11:03:06 -05:00
|
|
|
$timeout () ->
|
|
|
|
$scope.$broadcast "review-panel:layout"
|
2016-11-09 10:25:41 -05:00
|
|
|
|
2016-11-09 10:51:40 -05:00
|
|
|
$scope.cancelNewComment = (entry) ->
|
2016-11-16 10:47:05 -05:00
|
|
|
# $scope.commentState.adding = false
|
|
|
|
# $scope.commentState.content = ""
|
2016-11-16 11:03:06 -05:00
|
|
|
$timeout () ->
|
|
|
|
$scope.$broadcast "review-panel:layout"
|
2016-11-09 10:51:40 -05:00
|
|
|
|
2016-11-09 10:25:41 -05:00
|
|
|
$scope.startReply = (entry) ->
|
|
|
|
entry.replying = true
|
2016-11-16 11:03:06 -05:00
|
|
|
$timeout () ->
|
|
|
|
$scope.$broadcast "review-panel:layout"
|
2016-11-11 05:51:32 -05:00
|
|
|
|
2016-11-16 10:12:58 -05:00
|
|
|
# $scope.handleCommentReplyKeyPress = (ev, entry) ->
|
|
|
|
# if ev.keyCode == 13 and !ev.shiftKey and !ev.ctrlKey and !ev.metaKey
|
|
|
|
# ev.preventDefault()
|
|
|
|
# ev.target.blur()
|
|
|
|
# $scope.submitReply(entry)
|
2016-11-11 05:51:32 -05:00
|
|
|
|
2016-11-17 13:06:08 -05:00
|
|
|
$scope.submitReply = (entry, entry_id) ->
|
|
|
|
$scope.unresolveComment(entry_id)
|
2016-11-09 10:25:41 -05:00
|
|
|
entry.thread.push {
|
|
|
|
content: entry.replyContent
|
|
|
|
ts: new Date()
|
|
|
|
user_id: window.user_id
|
|
|
|
}
|
|
|
|
entry.replyContent = ""
|
2016-11-09 10:46:47 -05:00
|
|
|
entry.replying = false
|
2016-11-14 06:47:36 -05:00
|
|
|
$timeout () ->
|
|
|
|
$scope.$broadcast "review-panel:layout"
|
2016-11-11 11:10:26 -05:00
|
|
|
# TODO Just for prototyping purposes; remove afterwards
|
|
|
|
window.setTimeout((() ->
|
|
|
|
$scope.$applyAsync(() -> submitMockedReply(entry))
|
|
|
|
), 1000 * 2)
|
|
|
|
|
|
|
|
# TODO Just for prototyping purposes; remove afterwards.
|
|
|
|
submitMockedReply = (entry) ->
|
|
|
|
entry.thread.push {
|
2016-11-21 10:18:46 -05:00
|
|
|
content: 'Sounds good!'
|
2016-11-11 11:10:26 -05:00
|
|
|
ts: new Date()
|
|
|
|
user_id: mockedUserId
|
|
|
|
}
|
|
|
|
entry.replyContent = ""
|
|
|
|
entry.replying = false
|
2016-11-14 06:47:36 -05:00
|
|
|
$timeout () ->
|
|
|
|
$scope.$broadcast "review-panel:layout"
|
2016-11-09 10:51:40 -05:00
|
|
|
|
|
|
|
$scope.cancelReply = (entry) ->
|
|
|
|
entry.replying = false
|
|
|
|
entry.replyContent = ""
|
2016-11-09 11:23:08 -05:00
|
|
|
$scope.$broadcast "review-panel:layout"
|
2016-11-17 13:06:08 -05:00
|
|
|
|
|
|
|
$scope.resolveComment = (entry, entry_id) ->
|
|
|
|
entry.showWhenResolved = false
|
2016-11-21 06:16:23 -05:00
|
|
|
entry.focused = false
|
2016-11-21 12:13:17 -05:00
|
|
|
$scope.$broadcast "comment:resolve", entry_id, window.user_id
|
2016-11-17 13:06:08 -05:00
|
|
|
|
|
|
|
$scope.unresolveComment = (entry_id) ->
|
|
|
|
$scope.$broadcast "comment:unresolve", entry_id
|
2016-11-09 11:23:08 -05:00
|
|
|
|
2016-11-17 13:06:08 -05:00
|
|
|
$scope.deleteComment = (entry_id) ->
|
|
|
|
$scope.$broadcast "comment:remove", entry_id
|
|
|
|
|
2016-11-21 06:16:23 -05:00
|
|
|
$scope.showThread = (entry) ->
|
|
|
|
entry.showWhenResolved = true
|
|
|
|
$timeout () ->
|
|
|
|
$scope.$broadcast "review-panel:layout"
|
|
|
|
|
|
|
|
$scope.hideThread = (entry) ->
|
|
|
|
entry.showWhenResolved = false
|
|
|
|
$timeout () ->
|
|
|
|
$scope.$broadcast "review-panel:layout"
|
|
|
|
|
2016-11-16 07:31:47 -05:00
|
|
|
$scope.setSubView = (subView) ->
|
|
|
|
$scope.reviewPanel.subView = subView
|
2016-11-18 10:08:16 -05:00
|
|
|
|
2016-11-17 10:55:18 -05:00
|
|
|
$scope.gotoEntry = (doc_id, entry) ->
|
2016-11-22 11:34:39 -05:00
|
|
|
ide.editorManager.openDocId(doc_id, { gotoOffset: entry.offset })
|
2016-11-17 10:55:18 -05:00
|
|
|
|
2016-11-09 11:34:23 -05:00
|
|
|
# TODO: Eventually we need to get this from the server, and update it
|
|
|
|
# when we get an id we don't know. This'll do for client side testing
|
2016-11-09 11:23:08 -05:00
|
|
|
refreshUsers = () ->
|
|
|
|
$scope.users = {}
|
2016-11-11 11:10:26 -05:00
|
|
|
# TODO Just for prototyping purposes; remove afterwards.
|
|
|
|
$scope.users[mockedUserId] = {
|
2016-11-21 10:18:46 -05:00
|
|
|
email: "paulo@sharelatex.com"
|
|
|
|
name: "Paulo Reis"
|
2016-11-11 11:10:26 -05:00
|
|
|
isSelf: false
|
|
|
|
hue: 70
|
2016-11-21 10:18:46 -05:00
|
|
|
avatar_text: "PR"
|
|
|
|
}
|
|
|
|
$scope.users[mockedUserId2] = {
|
|
|
|
email: "james@sharelatex.com"
|
|
|
|
name: "James Allen"
|
|
|
|
isSelf: false
|
|
|
|
hue: 320
|
|
|
|
avatar_text: "JA"
|
2016-11-11 11:10:26 -05:00
|
|
|
}
|
|
|
|
|
2016-11-09 11:23:08 -05:00
|
|
|
for member in $scope.project.members.concat($scope.project.owner)
|
2016-11-09 11:34:23 -05:00
|
|
|
if member._id == window.user_id
|
|
|
|
name = "You"
|
2016-11-11 11:10:26 -05:00
|
|
|
isSelf = true
|
2016-11-09 11:34:23 -05:00
|
|
|
else
|
|
|
|
name = "#{member.first_name} #{member.last_name}"
|
2016-11-11 11:10:26 -05:00
|
|
|
isSelf = false
|
|
|
|
|
2016-11-09 11:23:08 -05:00
|
|
|
$scope.users[member._id] = {
|
|
|
|
email: member.email
|
2016-11-09 11:34:23 -05:00
|
|
|
name: name
|
2016-11-11 11:10:26 -05:00
|
|
|
isSelf: isSelf
|
2016-11-09 11:23:08 -05:00
|
|
|
hue: ColorManager.getHueForUserId(member._id)
|
|
|
|
avatar_text: [member.first_name, member.last_name].filter((n) -> n?).map((n) -> n[0]).join ""
|
|
|
|
}
|
|
|
|
|
|
|
|
$scope.$watch "project.members", (members) ->
|
|
|
|
return if !members?
|
|
|
|
refreshUsers()
|