mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
Convert 'anonymous-user' from real-time api in 'null' internally
This commit is contained in:
@@ -77,6 +77,17 @@ describe "EditorHttpController", ->
|
||||
@ProjectDeleter.unmarkAsDeletedByExternalSource
|
||||
.calledWith(@project_id)
|
||||
.should.equal true
|
||||
|
||||
describe "with an anonymous user", ->
|
||||
beforeEach ->
|
||||
@req.query =
|
||||
user_id: "anonymous-user"
|
||||
@EditorHttpController.joinProject @req, @res
|
||||
|
||||
it "should pass the user id as null", ->
|
||||
@EditorHttpController._buildJoinProjectView
|
||||
.calledWith(@project_id, null)
|
||||
.should.equal true
|
||||
|
||||
describe "_buildJoinProjectView", ->
|
||||
beforeEach ->
|
||||
|
||||
@@ -56,9 +56,13 @@ try_admin_access = (user, project_id, test, callback) ->
|
||||
try_content_access = (user, project_id, test, callback) ->
|
||||
# The real-time service calls this end point to determine the user's
|
||||
# permissions.
|
||||
if user.id?
|
||||
user_id = user.id
|
||||
else
|
||||
user_id = "anonymous-user"
|
||||
request.post {
|
||||
url: "/project/#{project_id}/join"
|
||||
qs: {user_id: user.id}
|
||||
qs: {user_id}
|
||||
auth:
|
||||
user: settings.apis.web.user
|
||||
pass: settings.apis.web.pass
|
||||
|
||||
Reference in New Issue
Block a user