Merge pull request #7278 from overleaf/jpa-block-track-changes-access

[web] block restricted token users from accessing track-changes details

GitOrigin-RevId: f2e734b48aaa1d1cae6d5db0e0312a78d42165de
This commit is contained in:
Jakob Ackermann 2022-04-05 10:22:18 +01:00 committed by Copybot
parent 2401909919
commit 862ff734c6
3 changed files with 11 additions and 4 deletions

View file

@ -664,12 +664,13 @@ App.directive(
}
const initTrackChanges = function () {
if (!trackChangesManager) return
trackChangesManager.rangesTracker = scope.sharejsDoc.ranges
// Force onChangeSession in order to set up highlights etc.
trackChangesManager.onChangeSession()
if (!trackChangesManager) return
editor.on('changeSelection', trackChangesManager.onChangeSelection)
// Selection also moves with updates elsewhere in the document

View file

@ -247,7 +247,9 @@ export default RangesTracker = class RangesTracker {
this.applyDeleteToChanges(op, metadata)
return this.applyDeleteToComments(op)
} else if (op.c != null) {
if (!window.isRestrictedTokenMember) {
return this.addComment(op, metadata)
}
} else {
throw new Error('unknown op type')
}

View file

@ -475,13 +475,17 @@ export default App.controller(
}
if ($scope.users[change.metadata.user_id] == null) {
if (!window.isRestrictedTokenMember) {
refreshChangeUsers(change.metadata.user_id)
}
}
}
if (rangesTracker.comments.length > 0) {
if (!window.isRestrictedTokenMember) {
ensureThreadsAreLoaded()
}
}
for (const comment of Array.from(rangesTracker.comments)) {
let new_comment