Skip to content

Commit

Permalink
resolve merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
royallsilwallz committed Mar 29, 2024
2 parents 50bf94f + e8f542f commit a2600f9
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 25 deletions.
6 changes: 3 additions & 3 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ updates:
schedule:
interval: daily
time: "13:00"
open-pull-requests-limit: 10
open-pull-requests-limit: 0
ignore:
- dependency-name: python-dotenv
versions:
Expand All @@ -31,7 +31,7 @@ updates:
schedule:
interval: daily
time: "13:00"
open-pull-requests-limit: 10
open-pull-requests-limit: 0
ignore:
- dependency-name: "@testing-library/user-event"
versions:
Expand Down Expand Up @@ -275,7 +275,7 @@ updates:
schedule:
interval: daily
time: "13:00"
open-pull-requests-limit: 10
open-pull-requests-limit: 0
ignore:
- dependency-name: python-dotenv
versions:
Expand Down
9 changes: 8 additions & 1 deletion backend/models/postgis/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,15 @@ def set_country_info(self):
url = "{0}/reverse?format=jsonv2&lat={1}&lon={2}&accept-language=en".format(
current_app.config["OSM_NOMINATIM_SERVER_URL"], lat, lng
)
headers = {
"User-Agent": (
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) "
"AppleWebKit/537.36 (KHTML, like Gecko) "
"Chrome/58.0.3029.110 Safari/537.3"
)
}
try:
response = requests.get(url)
response = requests.get(url, headers=headers)
response.raise_for_status()
country_info = response.json() # returns a dict
if country_info["address"].get("country") is not None:
Expand Down
7 changes: 4 additions & 3 deletions frontend/src/components/comments/commentInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,10 @@ export const CommentInputField = ({
try {
if (!query) return cb(contributors.map((username) => ({ username })));

// do not fetch data if the value comes from suggestions popup click
const isValueFromSuggestion = /^\[.*?\]\s$/.test(query);
if (isValueFromSuggestion) return;
// address trigger js allowSpaces=true issue
// which triggers this function every keystroke
const isUsernameAlreadyFetched = /^\[.*?\]\s/.test(query);
if (isUsernameAlreadyFetched) return;

const res = await fetchLocalJSONAPI(`users/queries/filter/${query}/`, token);
cb(res.usernames.map((username) => ({ username })));
Expand Down
13 changes: 8 additions & 5 deletions frontend/src/components/projectStats/tests/edits.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import '@testing-library/jest-dom';

import { EditsStats } from '../edits';
import { ConnectedIntl } from '../../../utils/internationalization';
import { QueryClientProviders } from '../../../utils/testWithIntl';
import { store } from '../../../store';

describe('EditsStats component', () => {
Expand All @@ -17,11 +18,13 @@ describe('EditsStats component', () => {

it('render contents', () => {
const { getByText } = render(
<Provider store={store}>
<ConnectedIntl>
<EditsStats data={data} />
</ConnectedIntl>
</Provider>,
<QueryClientProviders>
<Provider store={store}>
<ConnectedIntl>
<EditsStats data={data} />
</ConnectedIntl>
</Provider>
</QueryClientProviders>,
);

expect(getByText('Changesets')).toBeInTheDocument();
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/statsCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const DetailedStatsCard = ({
return (
<div
className="cf pa3 br1 flex bg-white red shadow-6 flex-column justify-between"
style={{ height: '10.5rem', cursor: 'default' }}
style={{ cursor: 'default' }}
>
<div className="flex items-center mb-auto">
<div className="w-25 fl ml2">{icon}</div>
Expand Down
10 changes: 6 additions & 4 deletions frontend/src/components/teamsAndOrgs/tests/featureStats.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { render, screen, waitFor } from '@testing-library/react';
import axios from 'axios';
import '@testing-library/jest-dom';

import { ReduxIntlProviders } from '../../../utils/testWithIntl';
import { ReduxIntlProviders, QueryClientProviders } from '../../../utils/testWithIntl';
import { FeatureStats } from '../featureStats';
import { homepageStats } from '../../../network/tests/mockData/homepageStats';

Expand All @@ -13,9 +13,11 @@ test('FeatureStats renders the correct values and labels', async () => {
axios.get.mockResolvedValue({ data: homepageStats });

render(
<ReduxIntlProviders>
<FeatureStats />
</ReduxIntlProviders>,
<QueryClientProviders>
<ReduxIntlProviders>
<FeatureStats />
</ReduxIntlProviders>
</QueryClientProviders>,
);
expect(screen.getByText('Km road mapped')).toBeInTheDocument();
expect(screen.getByText('Buildings mapped')).toBeInTheDocument();
Expand Down
10 changes: 6 additions & 4 deletions frontend/src/components/userDetail/tests/elementsMapped.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { render } from '@testing-library/react';
import '@testing-library/jest-dom';

import { ReduxIntlProviders } from '../../../utils/testWithIntl';
import { ReduxIntlProviders, QueryClientProviders } from '../../../utils/testWithIntl';
import { TaskStats, ElementsMapped } from '../elementsMapped';

describe('ElementsMapped & TaskStats components', () => {
Expand Down Expand Up @@ -45,9 +45,11 @@ describe('ElementsMapped & TaskStats components', () => {
},
};
const { getByText } = render(
<ReduxIntlProviders>
<ElementsMapped userStats={userStats} osmStats={osmStats} />
</ReduxIntlProviders>,
<QueryClientProviders>
<ReduxIntlProviders>
<ElementsMapped userStats={userStats} osmStats={osmStats} />
</ReduxIntlProviders>
</QueryClientProviders>,
);

expect(getByText('Time spent mapping')).toBeInTheDocument();
Expand Down
14 changes: 10 additions & 4 deletions frontend/src/views/tests/stats.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ import { screen, waitFor, act } from '@testing-library/react';
import { QueryParamProvider } from 'use-query-params';
import { ReactRouter6Adapter } from 'use-query-params/adapters/react-router-6';

import { ReduxIntlProviders, renderWithRouter } from '../../utils/testWithIntl';
import {
ReduxIntlProviders,
renderWithRouter,
QueryClientProviders,
} from '../../utils/testWithIntl';
import { store } from '../../store';

import { Stats } from '../stats';
Expand All @@ -15,9 +19,11 @@ describe('Overall styats page', () => {
});
renderWithRouter(
<QueryParamProvider adapter={ReactRouter6Adapter}>
<ReduxIntlProviders>
<Stats />
</ReduxIntlProviders>
<QueryClientProviders>
<ReduxIntlProviders>
<Stats />
</ReduxIntlProviders>
</QueryClientProviders>
</QueryParamProvider>,
);
waitFor(() => expect(screen.getByText('101367027')).toBeInTheDocument());
Expand Down

0 comments on commit a2600f9

Please sign in to comment.