mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Rename /ranges/users end point to /changes/users
This commit is contained in:
parent
7ae33041b5
commit
d03aa7056e
5 changed files with 14 additions and 13 deletions
|
@ -9,7 +9,7 @@ module.exports = RangesManager =
|
|||
return callback(error) if error?
|
||||
DocstoreManager.getAllRanges project_id, callback
|
||||
|
||||
getAllRangesUsers: (project_id, callback = (error, users) ->) ->
|
||||
getAllChangesUsers: (project_id, callback = (error, users) ->) ->
|
||||
user_ids = {}
|
||||
RangesManager.getAllRanges project_id, (error, docs) ->
|
||||
return callback(error) if error?
|
|
@ -4,7 +4,7 @@ UserInfoController = require "../User/UserInfoController"
|
|||
DocumentUpdaterHandler = require "../DocumentUpdater/DocumentUpdaterHandler"
|
||||
EditorRealTimeController = require("../Editor/EditorRealTimeController")
|
||||
|
||||
module.exports = RangesController =
|
||||
module.exports = TrackChangesController =
|
||||
getAllRanges: (req, res, next) ->
|
||||
project_id = req.params.project_id
|
||||
logger.log {project_id}, "request for project ranges"
|
||||
|
@ -13,10 +13,10 @@ module.exports = RangesController =
|
|||
docs = ({id: d._id, ranges: d.ranges} for d in docs)
|
||||
res.json docs
|
||||
|
||||
getAllRangesUsers: (req, res, next) ->
|
||||
getAllChangesUsers: (req, res, next) ->
|
||||
project_id = req.params.project_id
|
||||
logger.log {project_id}, "request for project range users"
|
||||
RangesManager.getAllRangesUsers project_id, (error, users) ->
|
||||
RangesManager.getAllChangesUsers project_id, (error, users) ->
|
||||
return next(error) if error?
|
||||
users = (UserInfoController.formatPersonalInfo(user) for user in users)
|
||||
res.json users
|
||||
|
@ -28,3 +28,4 @@ module.exports = RangesController =
|
|||
return next(error) if error?
|
||||
EditorRealTimeController.emitToRoom project_id, "accept-change", doc_id, change_id, (err)->
|
||||
res.send 204
|
||||
|
|
@ -40,7 +40,7 @@ AuthorizationMiddlewear = require('./Features/Authorization/AuthorizationMiddlew
|
|||
BetaProgramController = require('./Features/BetaProgram/BetaProgramController')
|
||||
AnalyticsRouter = require('./Features/Analytics/AnalyticsRouter')
|
||||
AnnouncementsController = require("./Features/Announcements/AnnouncementsController")
|
||||
RangesController = require("./Features/Ranges/RangesController")
|
||||
TrackChangesController = require("./Features/TrackChanges/TrackChangesController")
|
||||
CommentsController = require "./Features/Comments/CommentsController"
|
||||
|
||||
logger = require("logger-sharelatex")
|
||||
|
@ -177,9 +177,9 @@ module.exports = class Router
|
|||
webRouter.get "/project/:Project_id/doc/:doc_id/diff", AuthorizationMiddlewear.ensureUserCanReadProject, HistoryController.proxyToHistoryApi
|
||||
webRouter.post "/project/:Project_id/doc/:doc_id/version/:version_id/restore", AuthorizationMiddlewear.ensureUserCanReadProject, HistoryController.proxyToHistoryApi
|
||||
|
||||
webRouter.get "/project/:project_id/ranges", AuthorizationMiddlewear.ensureUserCanReadProject, RangesController.getAllRanges
|
||||
webRouter.get "/project/:project_id/ranges/users", AuthorizationMiddlewear.ensureUserCanReadProject, RangesController.getAllRangesUsers
|
||||
webRouter.post "/project/:project_id/doc/:doc_id/changes/:change_id/accept", AuthorizationMiddlewear.ensureUserCanWriteProjectContent, RangesController.acceptChange
|
||||
webRouter.get "/project/:project_id/ranges", AuthorizationMiddlewear.ensureUserCanReadProject, TrackChangesController.getAllRanges
|
||||
webRouter.get "/project/:project_id/changes/users", AuthorizationMiddlewear.ensureUserCanReadProject, TrackChangesController.getAllChangesUsers
|
||||
webRouter.post "/project/:project_id/doc/:doc_id/changes/:change_id/accept", AuthorizationMiddlewear.ensureUserCanWriteProjectContent, TrackChangesController.acceptChange
|
||||
|
||||
webRouter.get '/Project/:Project_id/download/zip', AuthorizationMiddlewear.ensureUserCanReadProject, ProjectDownloadsController.downloadProject
|
||||
webRouter.get '/project/download/zip', AuthorizationMiddlewear.ensureUserCanReadMultipleProjects, ProjectDownloadsController.downloadMultipleProjects
|
||||
|
|
|
@ -332,7 +332,7 @@ define [
|
|||
return
|
||||
_refreshingRangeUsers = true
|
||||
|
||||
$http.get "/project/#{$scope.project_id}/ranges/users"
|
||||
$http.get "/project/#{$scope.project_id}/changes/users"
|
||||
.success (users) ->
|
||||
_refreshingRangeUsers = false
|
||||
$scope.users = {}
|
||||
|
|
|
@ -3,7 +3,7 @@ SandboxedModule = require('sandboxed-module')
|
|||
assert = require('assert')
|
||||
sinon = require('sinon')
|
||||
path = require "path"
|
||||
modulePath = path.join __dirname, "../../../../app/js/Features/Ranges/RangesManager"
|
||||
modulePath = path.join __dirname, "../../../../app/js/Features/TrackChanges/RangesManager"
|
||||
expect = require("chai").expect
|
||||
|
||||
describe "RangesManager", ->
|
||||
|
@ -13,7 +13,7 @@ describe "RangesManager", ->
|
|||
"../Docstore/DocstoreManager": @DocstoreManager = {}
|
||||
"../User/UserInfoManager": @UserInfoManager = {}
|
||||
|
||||
describe "getAllRangesUsers", ->
|
||||
describe "getAllChangesUsers", ->
|
||||
beforeEach ->
|
||||
@project_id = "mock-project-id"
|
||||
@user_id1 = "mock-user-id-1"
|
||||
|
@ -45,11 +45,11 @@ describe "RangesManager", ->
|
|||
@RangesManager.getAllRanges = sinon.stub().yields(null, @docs)
|
||||
|
||||
it "should return an array of unique users", (done) ->
|
||||
@RangesManager.getAllRangesUsers @project_id, (error, users) =>
|
||||
@RangesManager.getAllChangesUsers @project_id, (error, users) =>
|
||||
users.should.deep.equal [{"mock": "user-1"}, {"mock": "user-2"}]
|
||||
done()
|
||||
|
||||
it "should only call getPersonalInfo once for each user", (done) ->
|
||||
@RangesManager.getAllRangesUsers @project_id, (error, users) =>
|
||||
@RangesManager.getAllChangesUsers @project_id, (error, users) =>
|
||||
@UserInfoManager.getPersonalInfo.calledTwice.should.equal true
|
||||
done()
|
Loading…
Reference in a new issue