Skip to content

Commit 38c9d2a

Browse files
authored
Merge pull request #963 from mapswipe/dev
Release - 2024-August [Fix]
2 parents 1d1b7eb + 36176be commit 38c9d2a

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

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) => {

0 commit comments

Comments
 (0)