diff --git a/services/web/app/src/Features/ThirdPartyDataStore/TpdsUpdateSender.js b/services/web/app/src/Features/ThirdPartyDataStore/TpdsUpdateSender.js index 643f9c07c9..78998e3cee 100644 --- a/services/web/app/src/Features/ThirdPartyDataStore/TpdsUpdateSender.js +++ b/services/web/app/src/Features/ThirdPartyDataStore/TpdsUpdateSender.js @@ -125,7 +125,8 @@ async function getProjectUsersIds(projectId) { // filter list to only return users with dropbox linked const users = await UserGetter.getUsers( { - _id: { $in: projectUserIds } + _id: { $in: projectUserIds }, + 'dropbox.access_token.uid': { $ne: null } }, { _id: 1 diff --git a/services/web/app/src/Features/User/UserGetter.js b/services/web/app/src/Features/User/UserGetter.js index 518b5a198e..9f5e5fe401 100644 --- a/services/web/app/src/Features/User/UserGetter.js +++ b/services/web/app/src/Features/User/UserGetter.js @@ -129,9 +129,6 @@ const UserGetter = { }, getUsers(query, projection, callback) { - if (!query) { - return callback(new Error('no query provided')) - } normalizeQuery(query, (err, query) => { if (err) return callback(err) db.users.find(query, projection, callback) diff --git a/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateSenderTests.js b/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateSenderTests.js index f827feaf3d..e157f29307 100644 --- a/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateSenderTests.js +++ b/services/web/test/unit/src/ThirdPartyDataStore/TpdsUpdateSenderTests.js @@ -141,6 +141,20 @@ describe('TpdsUpdateSender', function() { job2.headers.sl_all_user_ids.should.equal( JSON.stringify(['read_only_ref_1_id_here']) ) + + this.UserGetter.promises.getUsers.should.have.been.calledOnce.and.calledWith( + { + _id: { + $in: [ + 'user_id_here', + 'collaberator_ref_1_here', + 'read_only_ref_1_id_here' + ] + }, + 'dropbox.access_token.uid': { $ne: null } + }, + { _id: 1 } + ) }) it('post doc with stream origin of docstore', async function() { @@ -185,6 +199,20 @@ describe('TpdsUpdateSender', function() { job2.headers.sl_all_user_ids.should.equal( JSON.stringify(['read_only_ref_1_id_here']) ) + + this.UserGetter.promises.getUsers.should.have.been.calledOnce.and.calledWith( + { + _id: { + $in: [ + 'user_id_here', + 'collaberator_ref_1_here', + 'read_only_ref_1_id_here' + ] + }, + 'dropbox.access_token.uid': { $ne: null } + }, + { _id: 1 } + ) }) it('deleting entity', async function() { @@ -222,6 +250,20 @@ describe('TpdsUpdateSender', function() { job2.headers.sl_all_user_ids.should.equal( JSON.stringify(['read_only_ref_1_id_here']) ) + + this.UserGetter.promises.getUsers.should.have.been.calledOnce.and.calledWith( + { + _id: { + $in: [ + 'user_id_here', + 'collaberator_ref_1_here', + 'read_only_ref_1_id_here' + ] + }, + 'dropbox.access_token.uid': { $ne: null } + }, + { _id: 1 } + ) }) it('moving entity', async function() { @@ -262,6 +304,20 @@ describe('TpdsUpdateSender', function() { job2.headers.sl_all_user_ids.should.equal( JSON.stringify(['read_only_ref_1_id_here']) ) + + this.UserGetter.promises.getUsers.should.have.been.calledOnce.and.calledWith( + { + _id: { + $in: [ + 'user_id_here', + 'collaberator_ref_1_here', + 'read_only_ref_1_id_here' + ] + }, + 'dropbox.access_token.uid': { $ne: null } + }, + { _id: 1 } + ) }) it('should be able to rename a project using the move entity func', async function() { @@ -301,6 +357,20 @@ describe('TpdsUpdateSender', function() { job2.headers.sl_all_user_ids.should.equal( JSON.stringify(['read_only_ref_1_id_here']) ) + + this.UserGetter.promises.getUsers.should.have.been.calledOnce.and.calledWith( + { + _id: { + $in: [ + 'user_id_here', + 'collaberator_ref_1_here', + 'read_only_ref_1_id_here' + ] + }, + 'dropbox.access_token.uid': { $ne: null } + }, + { _id: 1 } + ) }) it('pollDropboxForUser', async function() {