Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Overleaf Ruhr
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
newton Lars
Overleaf Ruhr
Commits
48bd75fd
Commit
48bd75fd
authored
Jan 5, 2024
by
libnewton
Browse files
Options
Downloads
Patches
Plain Diff
re add track changes
parent
6a035b6e
Branches
Branches containing commit
No related tags found
1 merge request
!1
chore: sync upstream
Pipeline
#210533
passed
Jan 5, 2024
Stage: docker
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
server-ce/runit/track-changes-sharelatex/run
+0
-0
0 additions, 0 deletions
server-ce/runit/track-changes-sharelatex/run
services/web/app/src/router.js
+120
-1
120 additions, 1 deletion
services/web/app/src/router.js
with
120 additions
and
1 deletion
server-ce/runit/track-changes-sharelatex/run
100644 → 100755
+
0
−
0
View file @
48bd75fd
File mode changed from 100644 to 100755
This diff is collapsed.
Click to expand it.
services/web/app/src/router.js
+
120
−
1
View file @
48bd75fd
...
...
@@ -25,6 +25,9 @@ const TutorialController = require('./Features/Tutorial/TutorialController')
const
DocumentController
=
require
(
'
./Features/Documents/DocumentController
'
)
const
CompileManager
=
require
(
'
./Features/Compile/CompileManager
'
)
const
CompileController
=
require
(
'
./Features/Compile/CompileController
'
)
const
EditorRealTimeController
=
require
(
'
./Features/Editor/EditorRealTimeController
'
)
const
UserInfoManager
=
require
(
'
./Features/User/UserInfoManager
'
)
const
ClsiCookieManager
=
require
(
'
./Features/Compile/ClsiCookieManager
'
)(
Settings
.
apis
.
clsi
!=
null
?
Settings
.
apis
.
clsi
.
backendGroupName
:
undefined
)
...
...
@@ -58,17 +61,19 @@ const UserMembershipRouter = require('./Features/UserMembership/UserMembershipRo
const
SystemMessageController
=
require
(
'
./Features/SystemMessages/SystemMessageController
'
)
const
AnalyticsRegistrationSourceMiddleware
=
require
(
'
./Features/Analytics/AnalyticsRegistrationSourceMiddleware
'
)
const
AnalyticsUTMTrackingMiddleware
=
require
(
'
./Features/Analytics/AnalyticsUTMTrackingMiddleware
'
)
const
DocumentUpdaterHandler
=
require
(
'
./Features/DocumentUpdater/DocumentUpdaterHandler
'
)
const
CaptchaMiddleware
=
require
(
'
./Features/Captcha/CaptchaMiddleware
'
)
const
{
Joi
,
validate
}
=
require
(
'
./infrastructure/Validation
'
)
const
{
renderUnsupportedBrowserPage
,
unsupportedBrowserMiddleware
,
}
=
require
(
'
./infrastructure/UnsupportedBrowserMiddleware
'
)
const
{
Project
}
=
require
(
'
./models/Project
'
)
const
logger
=
require
(
'
@overleaf/logger
'
)
const
_
=
require
(
'
underscore
'
)
const
{
plainTextResponse
}
=
require
(
'
./infrastructure/Response
'
)
const
PublicAccessLevels
=
require
(
'
./Features/Authorization/PublicAccessLevels
'
)
const
DocstoreManager
=
require
(
'
./Features/Docstore/DocstoreManager
'
)
const
rateLimiters
=
{
addEmail
:
new
RateLimiter
(
'
add-email
'
,
{
...
...
@@ -1102,6 +1107,120 @@ function initialize(webRouter, privateApiRouter, publicApiRouter) {
RateLimiterMiddleware
.
rateLimit
(
rateLimiters
.
sendChatMessage
),
ChatController
.
sendMessage
)
webRouter
.
get
(
'
/project/:project_id/changes/users
'
,
AuthorizationMiddleware
.
ensureUserCanReadProject
,
function
(
req
,
res
,
next
)
{
const
{
project_id
}
=
req
.
params
logger
.
log
({
project_id
},
'
CG:GET:project/changes/users
'
)
return
DocumentUpdaterHandler
.
flushProjectToMongo
(
project_id
,
function
(
err
)
{
if
(
err
!=
null
)
return
next
(
err
)
return
DocstoreManager
.
getAllRanges
(
project_id
,
function
(
err
,
docs
)
{
if
(
err
!=
null
)
return
next
(
err
)
const
user_ids
=
{}
for
(
let
doc
of
Array
.
from
(
docs
))
{
for
(
let
change
of
Array
.
from
(
(
doc
.
ranges
!=
null
?
doc
.
ranges
.
changes
:
undefined
)
||
[]
))
{
user_ids
[
change
.
metadata
.
user_id
]
=
true
}
}
return
async
.
mapSeries
(
Object
.
keys
(
user_ids
),
UserInfoManager
.
getPersonalInfo
,
function
(
err
,
users
)
{
if
(
err
)
return
next
(
err
)
return
res
.
json
(
users
.
filter
(
u
=>
u
!=
null
)
.
map
(
UserInfoController
.
formatPersonalInfo
)
)
}
)
})
})
}
)
webRouter
.
post
(
'
/project/:project_id/track_changes
'
,
AuthorizationMiddleware
.
ensureUserCanWriteProjectSettings
,
function
(
req
,
res
,
next
)
{
const
{
project_id
}
=
req
.
params
const
{
on
,
on_for
,
on_for_guests
}
=
req
.
body
logger
.
log
(
{
project_id
,
on
,
on_for
,
on_for_guests
},
'
CG:POST:project/track_changes
'
)
var
s
if
(
on
===
true
)
{
s
=
true
}
else
{
s
=
{}
if
(
on_for_guests
===
true
)
s
[
'
__guests__
'
]
=
true
for
(
user_id
in
on_for
)
if
(
typeof
user_id
===
'
string
'
&&
typeof
on_for
[
user_id
]
===
'
boolean
'
)
s
[
user_id
]
=
on_for
[
user_id
]
}
return
Project
.
update
(
{
_id
:
project_id
},
{
track_changes
:
s
},
{},
function
(
err
)
{
if
(
err
!=
null
)
return
next
(
err
)
EditorRealTimeController
.
emitToRoom
(
project_id
,
'
toggle-track-changes
'
,
s
)
return
res
.
sendStatus
(
204
)
}
)
}
)
webRouter
.
post
(
'
/project/:project_id/doc/:doc_id/changes/accept
'
,
AuthorizationMiddleware
.
ensureUserCanWriteProjectContent
,
function
(
req
,
res
,
next
)
{
const
{
project_id
,
doc_id
}
=
req
.
params
const
{
change_ids
}
=
req
.
body
logger
.
log
({
project_id
,
doc_id
},
'
CG:POST:project/doc/changes/accept
'
)
return
DocumentUpdaterHandler
.
acceptChanges
(
project_id
,
doc_id
,
change_ids
,
function
(
err
)
{
if
(
err
!=
null
)
return
next
(
err
)
return
res
.
sendStatus
(
204
)
}
)
}
)
webRouter
.
get
(
'
/project/:project_id/ranges
'
,
AuthorizationMiddleware
.
ensureUserCanReadProject
,
function
(
req
,
res
,
next
)
{
const
{
project_id
}
=
req
.
params
logger
.
log
({
project_id
},
'
CG:GET:project/ranges
'
)
return
DocumentUpdaterHandler
.
flushProjectToMongo
(
project_id
,
function
(
err
)
{
if
(
err
)
return
next
(
err
)
return
DocstoreManager
.
getAllRanges
(
project_id
,
function
(
err
,
data
)
{
if
(
err
!=
null
)
return
next
(
err
)
return
res
.
json
(
data
)
})
})
}
)
// review apis
webRouter
.
get
(
'
/project/:project_id/threads
'
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment