mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Send user data in /threads dat
This commit is contained in:
parent
1a100b77df
commit
4e128b6ab7
3 changed files with 10 additions and 10 deletions
|
@ -28,7 +28,7 @@ module.exports =
|
|||
logger.log project_id:project_id, query:query, "getting messages"
|
||||
ChatApiHandler.getGlobalMessages project_id, query.limit, query.before, (err, messages) ->
|
||||
return next(err) if err?
|
||||
CommentsController._injectUserInfoIntoThreads [{ messages: messages }], (err) ->
|
||||
CommentsController._injectUserInfoIntoThreads {global: { messages: messages }}, (err) ->
|
||||
return next(err) if err?
|
||||
logger.log length: messages?.length, "sending messages to client"
|
||||
res.json messages
|
||||
|
|
|
@ -62,7 +62,7 @@ module.exports = CommentsController =
|
|||
callback null, user
|
||||
|
||||
jobs = []
|
||||
for thread in threads
|
||||
for thread_id, thread of threads
|
||||
do (thread) ->
|
||||
if thread.resolved
|
||||
jobs.push (cb) ->
|
||||
|
|
|
@ -151,8 +151,8 @@ describe "CommentsController", ->
|
|||
return { "formatted": user["mock"] }
|
||||
|
||||
it "should inject a user object into messaged and resolved data", (done) ->
|
||||
@CommentsController._injectUserInfoIntoThreads [
|
||||
{
|
||||
@CommentsController._injectUserInfoIntoThreads {
|
||||
thread1: {
|
||||
resolved: true
|
||||
resolved_by_user_id: "user_id_1"
|
||||
messages: [{
|
||||
|
@ -163,15 +163,15 @@ describe "CommentsController", ->
|
|||
content: "bar"
|
||||
}]
|
||||
},
|
||||
{
|
||||
thread2: {
|
||||
messages: [{
|
||||
user_id: "user_id_1"
|
||||
content: "baz"
|
||||
}]
|
||||
}
|
||||
], (error, threads) ->
|
||||
expect(threads).to.deep.equal [
|
||||
{
|
||||
}, (error, threads) ->
|
||||
expect(threads).to.deep.equal {
|
||||
thread1: {
|
||||
resolved: true
|
||||
resolved_by_user_id: "user_id_1"
|
||||
resolved_by_user: { "formatted": "user_1" }
|
||||
|
@ -185,14 +185,14 @@ describe "CommentsController", ->
|
|||
content: "bar"
|
||||
}]
|
||||
},
|
||||
{
|
||||
thread2: {
|
||||
messages: [{
|
||||
user_id: "user_id_1"
|
||||
user: { "formatted": "user_1" }
|
||||
content: "baz"
|
||||
}]
|
||||
}
|
||||
]
|
||||
}
|
||||
done()
|
||||
|
||||
it "should only need to look up each user once", (done) ->
|
||||
|
|
Loading…
Reference in a new issue