Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy to Production – 2024-03-20 #2688

Merged
merged 21 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
5d6f18f
Set current page from URL param page
clari182 Dec 1, 2023
9f93f95
Add test to check filters on discover page
clari182 Dec 1, 2023
1caec14
Merge branch 'staging' into fix/discover-pages
clari182 Jan 22, 2024
ab96c16
Merge branch 'staging' into fix/discover-pages
clari182 Jan 23, 2024
d9ce3e5
Improve return for undefined state and return empty query
clari182 Jan 23, 2024
6a18d51
Fix discover test
clari182 Jan 23, 2024
5139290
Fix discover test
clari182 Jan 24, 2024
a00683e
Merge branch 'staging' into fix/discover-pages
clari182 Jan 24, 2024
26acab5
Merge branch 'staging' into fix/discover-pages
clari182 Feb 21, 2024
4aedd0f
Only create an 'incident' notification if whitelistead field updated
clari182 Mar 7, 2024
e053289
Return at first if no notification
clari182 Mar 7, 2024
d759afb
put subcription comment back
clari182 Mar 7, 2024
455d2ff
Use config to whitelist fields
clari182 Mar 8, 2024
42bc45e
Re-add line break
clari182 Mar 8, 2024
8abf089
Update onIncidentUpdate.js
clari182 Mar 8, 2024
3798303
Remove editor notes from whitelisted field list
clari182 Mar 12, 2024
b9d7d48
Merge branch 'staging' into fix/discover-pages
clari182 Mar 12, 2024
02508b0
Merge pull request #2460 from clari182/fix/discover-pages
kepae Mar 12, 2024
f036554
Merge pull request #2683 from clari182/feature/notifications-whitelis…
kepae Mar 13, 2024
d74bd24
configure TRANSLATE_SUBMISSION_DATE_START
kepae Mar 19, 2024
2954c1e
Merge pull request #2699 from kepae/translate-flag
kepae Mar 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ jobs:
MONGODB_CONNECTION_STRING: ${{ secrets.MONGODB_CONNECTION_STRING }}
MONGODB_REPLICA_SET: ${{ secrets.MONGODB_REPLICA_SET }}
MONGODB_TRANSLATIONS_CONNECTION_STRING: ${{ secrets.MONGODB_TRANSLATIONS_CONNECTION_STRING }}
TRANSLATE_SUBMISSION_DATE_START: ${{ vars.TRANSLATE_SUBMISSION_DATE_START }}
MONGODB_MIGRATIONS_CONNECTION_STRING: ${{ secrets.MONGODB_MIGRATIONS_CONNECTION_STRING }}
GATSBY_REALM_APP_GRAPHQL_URL: ${{ secrets.GATSBY_REALM_APP_GRAPHQL_URL }}
GATSBY_PRISMIC_REPO_NAME: ${{ vars.GATSBY_PRISMIC_REPO_NAME }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ jobs:
MONGODB_CONNECTION_STRING: ${{ secrets.MONGODB_CONNECTION_STRING }}
MONGODB_REPLICA_SET: ${{ secrets.MONGODB_REPLICA_SET }}
MONGODB_TRANSLATIONS_CONNECTION_STRING: ${{ secrets.MONGODB_TRANSLATIONS_CONNECTION_STRING }}
TRANSLATE_SUBMISSION_DATE_START: ${{ vars.TRANSLATE_SUBMISSION_DATE_START }}
MONGODB_MIGRATIONS_CONNECTION_STRING: ${{ secrets.MONGODB_MIGRATIONS_CONNECTION_STRING }}
GATSBY_REALM_APP_GRAPHQL_URL: ${{ secrets.GATSBY_REALM_APP_GRAPHQL_URL }}
GATSBY_ROLLBAR_TOKEN: ${{ secrets.GATSBY_ROLLBAR_TOKEN }}
Expand Down
53 changes: 53 additions & 0 deletions site/gatsby-site/cypress/e2e/integration/discover.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,59 @@ describe('The Discover app', () => {
}
);

conditionalIt(!Cypress.env('isEmptyEnvironment'), 'Loads filters based on URL', () => {
cy.visit(
url +
'?is_incident_report=true&submitters=Anonymous&page=3&classifications=CSETv0%3AIntent%3AAccident'
);

cy.waitForStableDOM();

cy.get('form#searchForm').as('form');

cy.contains('button', 'Submitters', { timeout: 8000 })
.find('span.badge', { timeout: 8000 })
.should('contain.text', '1');

cy.get('[data-cy="Accident"]', { timeout: 8000 })
.should('exist')
.find('b')
.contains('CSETv0')
.parent()
.contains('Intent')
.should('exist')
.parent()
.contains('Accident')
.should('exist')
.parent()
.should('have.class', 'active');

cy.contains('button', 'Anonymous').should('have.class', 'active');

cy.contains('li.ais-Pagination-item--selected .ais-Pagination-link', '3');

cy.visit(
url +
'?authors=Christopher%20Knaus&incident_id=57&is_incident_report=true&language=en&source_domain=theguardian.com'
);

cy.contains('button', 'Authors', { timeout: 8000 })
.find('span.badge', { timeout: 8000 })
.should('contain.text', '1');

cy.contains('button', 'Source', { timeout: 8000 })
.find('span.badge', { timeout: 8000 })
.should('contain.text', '1');

cy.contains('button', 'Incident ID', { timeout: 8000 })
.find('span.badge', { timeout: 8000 })
.should('contain.text', '1');

cy.contains('button', 'Language', { timeout: 8000 })
.find('span.badge', { timeout: 8000 })
.should('contain.text', '1');
});

it('Should update display types', () => {
cy.visit(url + '?display=list');

Expand Down
14 changes: 13 additions & 1 deletion site/gatsby-site/src/components/discover/Discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import algoliasearch from 'algoliasearch/lite';
import config from '../../../config';
import { navigate } from 'gatsby';
import { useLocalization } from 'plugins/gatsby-theme-i18n';
import { InstantSearch } from 'react-instantsearch';
import { Configure, InstantSearch } from 'react-instantsearch';
import SearchBox from 'components/discover/SearchBox';
import Hits from 'components/discover/Hits';
import Controls from './Controls';
Expand Down Expand Up @@ -37,6 +37,8 @@ export default function Discover() {

const [width, setWidth] = useState(0);

const [currentPage, setCurrentPage] = useState(0);

const handleWindowSizeChange = useRef(
debounce(() => {
setWidth(window.innerWidth);
Expand Down Expand Up @@ -66,6 +68,15 @@ export default function Discover() {
};
}, []);

useEffect(() => {
const params = new URLSearchParams(window.location.search);

const page = parseInt(params.get('page'), 10);

// Set the current page from the URL, defaulting to 0 (Algolia's pagination is zero-based)
setCurrentPage(!isNaN(page) ? page - 1 : 0);
}, []);

if (width == 0) {
return null;
}
Expand Down Expand Up @@ -95,6 +106,7 @@ export default function Discover() {
stateMapping: mapping(),
}}
>
<Configure hitsPerPage={28} page={currentPage} />
<Container className="ml-auto mr-auto w-full lg:max-w-6xl xl:max-w-7xl mt-6">
<Row className="px-0 mx-0">
<Col className="px-0 mx-0">
Expand Down
2 changes: 2 additions & 0 deletions site/gatsby-site/src/components/discover/createURL.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ const convertRangeToQueryString = (range) => {
const getQueryFromState = ({ state, locale, taxa }) => {
let query = {};

if (!state) return query;

if (state.query !== '') {
query.s = state.query;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function SelectedRefinement({ attribute }) {
.map((item) => (
<div
key={item.value}
className="cursor-pointer border text-xs p-2 rounded-md bg-green-100 hover:bg-red-200 flex justify-between items-center"
className="active cursor-pointer border text-xs p-2 rounded-md bg-green-100 hover:bg-red-200 flex justify-between items-center"
role="button"
tabIndex={0}
onClick={() => refine(item.value)}
Expand Down
44 changes: 43 additions & 1 deletion site/realm/triggers/onIncidentUpdate.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,48 @@
"$exists": false
}
}
],
"$or": [
{
"updateDescription.updatedFields.title": {
"$exists": true
}
},
{
"updateDescription.updatedFields.description": {
"$exists": true
}
},
{
"updateDescription.updatedFields.date": {
"$exists": true
}
},
{
"updateDescription.updatedFields.\"Alleged deployer of AI system\"": {
"$exists": true
}
},
{
"updateDescription.updatedFields.\"Alleged developer of AI system\"": {
"$exists": true
}
},
{
"updateDescription.updatedFields.\"Alleged harmed or nearly harmed parties\"": {
"$exists": true
}
},
{
"updateDescription.updatedFields.reports": {
"$exists": true
}
},
{
"updateDescription.updatedFields.editors": {
"$exists": true
}
}
]
},
"project": {},
Expand All @@ -37,4 +79,4 @@
}
}
}
}
}
Loading