-
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 #3108 from responsible-ai-collaborative/staging
Deploy to Production
- Loading branch information
Showing
14 changed files
with
116 additions
and
58 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
This file was deleted.
Oops, something went wrong.
26 changes: 26 additions & 0 deletions
26
site/gatsby-site/migrations/2024.09.17T16.03.27.fix-incidents-invalid-values.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,26 @@ | ||
const config = require('../config'); | ||
|
||
/** @type {import('umzug').MigrationFn<any>} */ | ||
exports.up = async ({ context: { client } }) => { | ||
const db = client.db(config.realm.production_db.db_name).collection('incidents'); | ||
|
||
// If the incident has "editor_notes" field and it is null, set it to empty string | ||
const editor_notes_results = await db.updateMany( | ||
{ editor_notes: null }, | ||
{ $set: { editor_notes: '' } } | ||
); | ||
|
||
console.log( | ||
`Updated ${editor_notes_results.modifiedCount} incidents with null editor_notes field` | ||
); | ||
|
||
// If the incident has the "flagged_dissimilar_incidents" field and it is null, set it to empty array | ||
const flagged_dissimilar_incidents_results = await db.updateMany( | ||
{ flagged_dissimilar_incidents: null }, | ||
{ $set: { flagged_dissimilar_incidents: [] } } | ||
); | ||
|
||
console.log( | ||
`Updated ${flagged_dissimilar_incidents_results.modifiedCount} incidents with null flagged_dissimilar_incidents field` | ||
); | ||
}; |
16 changes: 16 additions & 0 deletions
16
site/gatsby-site/migrations/2024.09.19T18.12.21.mark-pending-notifications-as-processed.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,16 @@ | ||
const config = require('../config'); | ||
|
||
/** @type {import('umzug').MigrationFn<any>} */ | ||
exports.up = async ({ context: { client } }) => { | ||
const db = client.db(config.realm.production_db.db_custom_data); | ||
|
||
const notifications = db.collection('notifications'); | ||
|
||
// Mark all pending notifications as processed | ||
const result = await notifications.updateMany( | ||
{ processed: false }, | ||
{ $set: { processed: true } } | ||
); | ||
|
||
console.log(`All pending notifications marked as processed. Total: ${result.modifiedCount}`); | ||
}; |
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
47 changes: 47 additions & 0 deletions
47
site/gatsby-site/playwright/e2e/unit/discover/routing.spec.ts
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,47 @@ | ||
|
||
import parseURL from '../../../../../gatsby-site/src/components/discover/parseURL'; | ||
import createURL from '../../../../../gatsby-site/src/components/discover/createURL'; | ||
import { queryConfig } from '../../../../../gatsby-site/src/components/discover/queryParams'; | ||
import { test } from '../../../utils'; | ||
import { expect } from '@playwright/test'; | ||
|
||
test('Should parse back and forth a discover URL', async () => { | ||
const indexName = 'instant_search-en'; | ||
|
||
const location = { | ||
search: | ||
'?authors=Christopher%20Knaus%7C%7CSam%20Levin&classifications=CSETv0%3AIntent%3AAccident&epoch_date_published_max=1670371200&is_incident_report=true&page=1&s=tesla&sortBy=published-date-asc&source_domain=theguardian.com', | ||
}; | ||
|
||
const result = parseURL({ location, indexName, queryConfig }); | ||
|
||
const state = result[indexName]; | ||
|
||
expect(state.query).toBe('tesla'); | ||
expect(state.page).toBe(1); | ||
expect(state.sortBy).toBe('published-date-asc'); | ||
expect(state.refinementList).toEqual({ | ||
source_domain: ['theguardian.com'], | ||
authors: ['Christopher Knaus', 'Sam Levin'], | ||
'CSETv0.Intent': ['Accident'], | ||
is_incident_report: ['true'], | ||
}); | ||
expect(state.range).toEqual({ | ||
epoch_date_published: `:1670371200`, | ||
}); | ||
|
||
expect(state.configure).toEqual({ | ||
distinct: false, | ||
hitsPerPage: 28, | ||
}); | ||
|
||
const resultURL = createURL({ | ||
routeState: { [indexName]: state }, | ||
indexName, | ||
locale: 'en', | ||
queryConfig, | ||
taxa: ['CSETv0', 'CSETv1'], | ||
}); | ||
|
||
expect('?' + resultURL).toBe(location.search); | ||
}); |
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
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