mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 06:03:45 +01:00
Merge pull request #24618 from overleaf/rh-null-pending-reviewer
Handle null readOnly_refs in CollaboratorsHandler GitOrigin-RevId: b718c4a1b5216a42920909615a0f3c2fe0a16bdb
This commit is contained in:
@@ -39,6 +39,12 @@ async function removeUserFromProject(projectId, userId) {
|
||||
{ $set: { pendingReviewer_refs: [] } }
|
||||
).exec()
|
||||
|
||||
// Temporary workaround for the case where readOnly_refs is null
|
||||
await Project.updateOne(
|
||||
{ _id: projectId, readOnly_refs: { $type: 'null' } },
|
||||
{ $set: { readOnly_refs: [] } }
|
||||
).exec()
|
||||
|
||||
// Deal with the old type of boolean value for archived
|
||||
// In order to clear it
|
||||
if (typeof project.archived === 'boolean') {
|
||||
|
||||
@@ -112,6 +112,18 @@ describe('CollaboratorsHandler', function () {
|
||||
)
|
||||
.chain('exec')
|
||||
.resolves()
|
||||
this.ProjectMock.expects('updateOne')
|
||||
.withArgs(
|
||||
{
|
||||
_id: this.project._id,
|
||||
readOnly_refs: { $type: 'null' },
|
||||
},
|
||||
{
|
||||
$set: { readOnly_refs: [] },
|
||||
}
|
||||
)
|
||||
.chain('exec')
|
||||
.resolves()
|
||||
this.ProjectMock.expects('updateOne')
|
||||
.withArgs(
|
||||
{
|
||||
@@ -166,6 +178,18 @@ describe('CollaboratorsHandler', function () {
|
||||
)
|
||||
.chain('exec')
|
||||
.resolves()
|
||||
this.ProjectMock.expects('updateOne')
|
||||
.withArgs(
|
||||
{
|
||||
_id: this.oldArchivedProject._id,
|
||||
readOnly_refs: { $type: 'null' },
|
||||
},
|
||||
{
|
||||
$set: { readOnly_refs: [] },
|
||||
}
|
||||
)
|
||||
.chain('exec')
|
||||
.resolves()
|
||||
this.ProjectMock.expects('updateOne')
|
||||
.withArgs(
|
||||
{
|
||||
@@ -218,6 +242,18 @@ describe('CollaboratorsHandler', function () {
|
||||
)
|
||||
.chain('exec')
|
||||
.resolves()
|
||||
this.ProjectMock.expects('updateOne')
|
||||
.withArgs(
|
||||
{
|
||||
_id: this.archivedProject._id,
|
||||
readOnly_refs: { $type: 'null' },
|
||||
},
|
||||
{
|
||||
$set: { readOnly_refs: [] },
|
||||
}
|
||||
)
|
||||
.chain('exec')
|
||||
.resolves()
|
||||
this.ProjectMock.expects('updateOne')
|
||||
.withArgs(
|
||||
{
|
||||
@@ -517,6 +553,18 @@ describe('CollaboratorsHandler', function () {
|
||||
)
|
||||
.chain('exec')
|
||||
.resolves()
|
||||
this.ProjectMock.expects('updateOne')
|
||||
.withArgs(
|
||||
{
|
||||
_id: projectId,
|
||||
readOnly_refs: { $type: 'null' },
|
||||
},
|
||||
{
|
||||
$set: { readOnly_refs: [] },
|
||||
}
|
||||
)
|
||||
.chain('exec')
|
||||
.resolves()
|
||||
this.ProjectMock.expects('updateOne')
|
||||
.withArgs(
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user