mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
List projects where user is added as reviewer (#22347)
* Support for adding reviewer role * added collaboratorsGetter tests * emit toggle-track-changes when reviewer is added * List projects where user is added as reviewer GitOrigin-RevId: 8ec9e59e4c0b65167705b0a56be3e309ef6af3e7
This commit is contained in:
committed by
Copybot
parent
53dc5fbafe
commit
db9dba4b7a
@@ -319,6 +319,11 @@ describe('CollaboratorsGetter', function () {
|
||||
.withArgs({ readOnly_refs: this.userId }, this.fields)
|
||||
.chain('exec')
|
||||
.resolves(['mock-read-only-project-1', 'mock-read-only-project-2'])
|
||||
|
||||
this.ProjectMock.expects('find')
|
||||
.withArgs({ reviewer_refs: this.userId }, this.fields)
|
||||
.chain('exec')
|
||||
.resolves(['mock-review-project-1', 'mock-review-project-2'])
|
||||
this.ProjectMock.expects('find')
|
||||
.withArgs(
|
||||
{
|
||||
@@ -367,6 +372,7 @@ describe('CollaboratorsGetter', function () {
|
||||
'mock-token-read-only-project-1',
|
||||
'mock-token-read-only-project-2',
|
||||
],
|
||||
review: ['mock-review-project-1', 'mock-review-project-2'],
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -275,6 +275,7 @@ describe('ProjectGetter', function () {
|
||||
this.fields = { mock: 'fields' }
|
||||
this.projectOwned = { _id: 'mock-owned-projects' }
|
||||
this.projectRW = { _id: 'mock-rw-projects' }
|
||||
this.projectReview = { _id: 'mock-review-projects' }
|
||||
this.projectRO = { _id: 'mock-ro-projects' }
|
||||
this.projectTokenRW = { _id: 'mock-token-rw-projects' }
|
||||
this.projectTokenRO = { _id: 'mock-token-ro-projects' }
|
||||
@@ -289,6 +290,7 @@ describe('ProjectGetter', function () {
|
||||
readOnly: [this.projectRO],
|
||||
tokenReadAndWrite: [this.projectTokenRW],
|
||||
tokenReadOnly: [this.projectTokenRO],
|
||||
review: [this.projectReview],
|
||||
})
|
||||
const projects = await this.ProjectGetter.promises.findAllUsersProjects(
|
||||
this.userId,
|
||||
@@ -301,6 +303,7 @@ describe('ProjectGetter', function () {
|
||||
readOnly: [this.projectRO],
|
||||
tokenReadAndWrite: [this.projectTokenRW],
|
||||
tokenReadOnly: [this.projectTokenRO],
|
||||
review: [this.projectReview],
|
||||
})
|
||||
})
|
||||
|
||||
@@ -314,6 +317,7 @@ describe('ProjectGetter', function () {
|
||||
this.projectTokenRO,
|
||||
this.projectRO,
|
||||
],
|
||||
review: [this.projectReview],
|
||||
})
|
||||
const projects = await this.ProjectGetter.promises.findAllUsersProjects(
|
||||
this.userId,
|
||||
@@ -326,6 +330,7 @@ describe('ProjectGetter', function () {
|
||||
readOnly: [this.projectRO],
|
||||
tokenReadAndWrite: [this.projectTokenRW],
|
||||
tokenReadOnly: [this.projectTokenRO],
|
||||
review: [this.projectReview],
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -219,12 +219,14 @@ describe('ProjectListController', function () {
|
||||
this.readOnly = [{ _id: 3, lastUpdated: 3, owner_ref: 'user-1' }]
|
||||
this.tokenReadAndWrite = [{ _id: 6, lastUpdated: 5, owner_ref: 'user-4' }]
|
||||
this.tokenReadOnly = [{ _id: 7, lastUpdated: 4, owner_ref: 'user-5' }]
|
||||
this.review = [{ _id: 8, lastUpdated: 4, owner_ref: 'user-6' }]
|
||||
this.allProjects = {
|
||||
owned: this.projects,
|
||||
readAndWrite: this.readAndWrite,
|
||||
readOnly: this.readOnly,
|
||||
tokenReadAndWrite: this.tokenReadAndWrite,
|
||||
tokenReadOnly: this.tokenReadOnly,
|
||||
review: this.review,
|
||||
}
|
||||
|
||||
this.ProjectGetter.promises.findAllUsersProjects.resolves(
|
||||
@@ -279,7 +281,8 @@ describe('ProjectListController', function () {
|
||||
this.readAndWrite.length +
|
||||
this.readOnly.length +
|
||||
this.tokenReadAndWrite.length +
|
||||
this.tokenReadOnly.length
|
||||
this.tokenReadOnly.length +
|
||||
this.review.length
|
||||
)
|
||||
done()
|
||||
}
|
||||
@@ -719,12 +722,14 @@ describe('ProjectListController', function () {
|
||||
{ _id: 6, lastUpdated: 5, owner_ref: 'user-4' }, // Also in tokenReadAndWrite
|
||||
{ _id: 7, lastUpdated: 4, owner_ref: 'user-5' },
|
||||
]
|
||||
this.review = [{ _id: 8, lastUpdated: 5, owner_ref: 'user-6' }]
|
||||
this.allProjects = {
|
||||
owned: this.projects,
|
||||
readAndWrite: this.readAndWrite,
|
||||
readOnly: this.readOnly,
|
||||
tokenReadAndWrite: this.tokenReadAndWrite,
|
||||
tokenReadOnly: this.tokenReadOnly,
|
||||
review: this.review,
|
||||
}
|
||||
|
||||
this.ProjectGetter.promises.findAllUsersProjects.resolves(
|
||||
@@ -747,7 +752,8 @@ describe('ProjectListController', function () {
|
||||
this.readAndWrite.length +
|
||||
this.readOnly.length +
|
||||
this.tokenReadAndWrite.length +
|
||||
this.tokenReadOnly.length -
|
||||
this.tokenReadOnly.length +
|
||||
this.review.length -
|
||||
1
|
||||
)
|
||||
done()
|
||||
|
||||
Reference in New Issue
Block a user