-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3188 from responsible-ai-collaborative/staging
Deploy to Production
- Loading branch information
Showing
6 changed files
with
119 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
site/gatsby-site/migrations/2024.10.25T21.09.57.remove-report-attribution.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const config = require('../config'); | ||
|
||
/** @type {import('umzug').MigrationFn<any>} */ | ||
exports.up = async ({ context: { client } }) => { | ||
const reportsCollection = client.db(config.realm.production_db.db_name).collection('reports'); | ||
|
||
// Change "AIAAIC" to "Anonymous" if it is the only element in the `submitters` array | ||
const result1 = await reportsCollection.updateMany( | ||
{ submitters: ['AIAAIC'] }, | ||
{ $set: { submitters: ['Anonymous'] } } | ||
); | ||
|
||
console.log(`Modified ${result1.modifiedCount} documents where "AIAAIC" was the only submitter`); | ||
|
||
// Remove "AIAAIC" from the `submitters` array if there are multiple elements | ||
const result2 = await reportsCollection.updateMany( | ||
{ submitters: 'AIAAIC' }, | ||
{ $pull: { submitters: 'AIAAIC' } } | ||
); | ||
|
||
console.log( | ||
`Modified ${result2.modifiedCount} documents where "AIAAIC" was one of the submitters` | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -160,7 +160,7 @@ describe(`Notifications`, () => { | |
}; | ||
|
||
jest.spyOn(context, 'verifyToken').mockResolvedValue({ sub: "123" }) | ||
jest.spyOn(common, 'getUserAdminData').mockResolvedValue({ email: '[email protected]' }); | ||
jest.spyOn(common, 'getUsersAdminData').mockResolvedValue([{ userId: '123', email: '[email protected]' }]); | ||
const sendEmailMock = jest.spyOn(common, 'sendEmail').mockResolvedValue(); | ||
|
||
const response = await makeRequest(url, mutationData, { ['PROCESS_NOTIFICATIONS_SECRET']: config.PROCESS_NOTIFICATIONS_SECRET });; | ||
|
@@ -290,7 +290,7 @@ describe(`Notifications`, () => { | |
}; | ||
|
||
jest.spyOn(context, 'verifyToken').mockResolvedValue({ sub: "123" }) | ||
jest.spyOn(common, 'getUserAdminData').mockResolvedValue({ email: '[email protected]' }); | ||
jest.spyOn(common, 'getUsersAdminData').mockResolvedValue([{ userId: '123', email: '[email protected]' }]); | ||
const sendEmailMock = jest.spyOn(common, 'sendEmail').mockResolvedValue(); | ||
|
||
const response = await makeRequest(url, mutationData, { ['PROCESS_NOTIFICATIONS_SECRET']: config.PROCESS_NOTIFICATIONS_SECRET });; | ||
|
@@ -422,7 +422,7 @@ describe(`Notifications`, () => { | |
}; | ||
|
||
jest.spyOn(context, 'verifyToken').mockResolvedValue({ sub: "123" }) | ||
jest.spyOn(common, 'getUserAdminData').mockResolvedValue({ email: '[email protected]' }); | ||
jest.spyOn(common, 'getUsersAdminData').mockResolvedValue([{ userId: '123', email: '[email protected]' }]); | ||
const sendEmailMock = jest.spyOn(common, 'sendEmail').mockResolvedValue(); | ||
|
||
const response = await makeRequest(url, mutationData, { ['PROCESS_NOTIFICATIONS_SECRET']: config.PROCESS_NOTIFICATIONS_SECRET });; | ||
|
@@ -548,7 +548,7 @@ describe(`Notifications`, () => { | |
}; | ||
|
||
jest.spyOn(context, 'verifyToken').mockResolvedValue({ sub: "123" }) | ||
jest.spyOn(common, 'getUserAdminData').mockResolvedValue({ email: '[email protected]' }); | ||
jest.spyOn(common, 'getUsersAdminData').mockResolvedValue([{ userId: '123', email: '[email protected]' }]); | ||
const sendEmailMock = jest.spyOn(common, 'sendEmail').mockResolvedValue(); | ||
|
||
const response = await makeRequest(url, mutationData, { ['PROCESS_NOTIFICATIONS_SECRET']: config.PROCESS_NOTIFICATIONS_SECRET });; | ||
|
@@ -675,7 +675,7 @@ describe(`Notifications`, () => { | |
}; | ||
|
||
jest.spyOn(context, 'verifyToken').mockResolvedValue({ sub: "123" }) | ||
jest.spyOn(common, 'getUserAdminData').mockResolvedValue({ email: '[email protected]' }); | ||
jest.spyOn(common, 'getUsersAdminData').mockResolvedValue([{ userId: '123', email: '[email protected]' }]); | ||
const sendEmailMock = jest.spyOn(common, 'sendEmail').mockResolvedValue(); | ||
|
||
const response = await makeRequest(url, mutationData, { ['PROCESS_NOTIFICATIONS_SECRET']: config.PROCESS_NOTIFICATIONS_SECRET });; | ||
|