Skip to content

Commit 4145a49

Browse files
authored
Merge pull request #963 from mapswipe/dev
Release - 2024-August [Fix]
2 parents 037a19f + 2841141 commit 4145a49

File tree

5 files changed

+23
-14
lines changed

5 files changed

+23
-14
lines changed

.github/workflows/actions.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ name: MapSwipe Workers
22

33
on: [push]
44

5+
env:
6+
COMPOSE_FILE: docker-compose.yaml:docker-compose-ci.yaml
7+
58
jobs:
69
build:
710

@@ -77,6 +80,7 @@ jobs:
7780
POSTGRES_DB: postgres
7881
OSMCHA_API_KEY: ${{ secrets.OSMCHA_API_KEY }}
7982
DJANGO_SECRET_KEY: test-django-secret-key
83+
COMPOSE_FILE: ../docker-compose.yaml:../docker-compose-ci.yaml
8084
run: |
8185
docker compose run --rm mapswipe_workers_creation python -m unittest discover --verbose --start-directory tests/unittests/
8286
docker compose run --rm mapswipe_workers_creation bash -c 'pip install pytest && pytest -ra -v --durations=10 tests/integration/'

docker-compose-ci.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Quick hack to avoid on GH CI
2+
# Check .github/workflows/actions.yml for usages
3+
# Related error:
4+
# failed to create network python-mapswipe-workers_mapswipe_network:
5+
# Error response from daemon: Pool overlaps with other one on this address space
6+
networks:
7+
mapswipe_network:
8+
ipam: !reset null

firebase/functions/src/index.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -353,14 +353,14 @@ exports.addProjectTopicKey = functions.https.onRequest(async (_, res) => {
353353
const isEmptyProject = Object.keys(data).length === 0;
354354
if (isEmptyProject) {
355355
res.status(404).send('No projects found');
356-
}
357-
358-
if (!isEmptyProject && data) {
356+
} else {
359357
const newProjectData: {[key: string]: string} = {};
360358

361359
Object.keys(data).forEach((id) => {
362-
if (data[id]?.projectTopic) {
363-
const newProjectTopicKey = formatProjectTopic(data[id].projectTopic);
360+
const projectData = data[id];
361+
362+
if (projectData?.name) {
363+
const newProjectTopicKey = formatProjectTopic(projectData.name);
364364
newProjectData[`v2/projects/${id}/projectTopicKey`] = newProjectTopicKey;
365365
}
366366
});
@@ -383,9 +383,7 @@ exports.addUserNameLowercase = functions.https.onRequest(async (_, res) => {
383383
const isEmptyUser = Object.keys(data).length === 0;
384384
if (isEmptyUser) {
385385
res.status(404).send('No user found');
386-
}
387-
388-
if (!isEmptyUser && data) {
386+
} else {
389387
const newUserData: {[key: string]: string} = {};
390388

391389
Object.keys(data).forEach((id) => {

manager-dashboard/app/views/NewProject/BasicProjectInfoForm/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ function BasicProjectInfoForm(props: Props<PartialProjectFormType>) {
126126
hint="We will generate you project name based on your inputs above."
127127
readOnly
128128
placeholder="[Project Topic] - [Project Region] ([Task Number]) [Requesting Organisation]"
129-
// error={error?.name}
129+
error={error?.name}
130130
disabled={disabled}
131131
/>
132132
<div className={styles.inputGroup}>

manager-dashboard/app/views/NewProject/index.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ function NewProject(props: Props) {
275275
visibility,
276276
filter,
277277
filterText,
278-
projectTopic,
278+
name,
279279
...valuesToCopy
280280
} = finalValues;
281281

@@ -331,8 +331,7 @@ function NewProject(props: Props) {
331331
// NOTE: All the user don't have permission to access draft project
332332
// FIXME: The firebase rules need to be changed to perform this on draft project
333333
const database = getDatabase();
334-
const projectTopicKeyLowercase = (projectTopic?.trim())?.toLowerCase() as string;
335-
const projectTopicKey = formatProjectTopic(projectTopicKeyLowercase);
334+
const projectTopicKey = formatProjectTopic(name);
336335
const projectRef = databaseRef(database, 'v2/projects/');
337336

338337
const prevProjectNameQuery = query(
@@ -350,7 +349,7 @@ function NewProject(props: Props) {
350349
setError((prevErr) => ({
351350
...getErrorObject(prevErr),
352351
[nonFieldError]: 'A project with this name already exists, please use a different project name (Please note that the name comparison is not case sensitive)',
353-
projectTopic: 'A project with this name already exists',
352+
name: 'A project with this name already exists',
354353
}));
355354
setProjectSubmissionStatus(undefined);
356355
return;
@@ -369,7 +368,7 @@ function NewProject(props: Props) {
369368

370369
const uploadData = {
371370
...valuesToCopy,
372-
projectTopic,
371+
name,
373372
projectTopicKey,
374373
filter: finalFilter,
375374
image: downloadUrl,

0 commit comments

Comments
 (0)