From 2469648f58ab35b4f5ce0aef76edf4d31e4d7890 Mon Sep 17 00:00:00 2001 From: Tibet Sprague Date: Mon, 20 Jun 2022 19:54:10 -0700 Subject: [PATCH] Fix bug that breaks viewing groups w/o a location but location precision set to near --- CHANGELOG.md | 5 +++++ api/graphql/makeModels.js | 17 ++++++++++------- package.json | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62e3c305a..5c187eb5c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## Unreleased +## [4.1.4] - 2022-06-20 + +### Fixed +- Groups not displaying when they don't have a location but location obfuscation is set to something other than Precise + ## [4.1.3] - 2022-06-15 ### Added diff --git a/api/graphql/makeModels.js b/api/graphql/makeModels.js index a2f008811..9d335ce86 100644 --- a/api/graphql/makeModels.js +++ b/api/graphql/makeModels.js @@ -334,15 +334,18 @@ export default async function makeModels (userId, isAdmin, apiClient) { return g.get('location') } else { const locObj = await g.locationObject().fetch() - let display = locObj.get('country') - if (locObj.get('region')) { - display = locObj.get('region') + ", " + display - } - if (locObj.get('city')) { - display = locObj.get('city') + ", " + display + if (locObj) { + let display = locObj.get('country') + if (locObj.get('region')) { + display = locObj.get('region') + ", " + display + } + if (locObj.get('city')) { + display = locObj.get('city') + ", " + display + } + return display } - return display } + return null }, locationObject: async (g) => { // If precision is precise or user is a moderator of the group show the exact location diff --git a/package.json b/package.json index 5d66e77b8..9b50b8234 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "author": "Tibet Sprague ", "license": "GNU AFFERO GENERAL PUBLIC LICENSE v3", "private": true, - "version": "4.1.3", + "version": "4.1.4", "repository": { "type": "git", "url": "git://github.com/Hylozoic/hylo-node.git"