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

1.8.2 #494

Merged
merged 7 commits into from
Dec 27, 2023
Merged

1.8.2 #494

Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 11 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
# Changelog

## [1.8.1a1](https://github.com/NeonGeckoCom/neon-utils/tree/1.8.1a1) (2023-12-15)
## [1.8.2a2](https://github.com/NeonGeckoCom/neon-utils/tree/1.8.2a2) (2023-12-27)

[Full Changelog](https://github.com/NeonGeckoCom/neon-utils/compare/1.8.0...1.8.1a1)
[Full Changelog](https://github.com/NeonGeckoCom/neon-utils/compare/1.8.2a1...1.8.2a2)

**Merged pull requests:**

- Update `add_event` patching to work around FakeBus compat. [\#490](https://github.com/NeonGeckoCom/neon-utils/pull/490) ([NeonDaniel](https://github.com/NeonDaniel))
- Use OpenStreetMap geocoder to work around maps.co API changes [\#493](https://github.com/NeonGeckoCom/neon-utils/pull/493) ([NeonDaniel](https://github.com/NeonDaniel))

## [1.8.2a1](https://github.com/NeonGeckoCom/neon-utils/tree/1.8.2a1) (2023-12-20)

[Full Changelog](https://github.com/NeonGeckoCom/neon-utils/compare/1.8.1...1.8.2a1)

**Merged pull requests:**

- Better default profile handling [\#492](https://github.com/NeonGeckoCom/neon-utils/pull/492) ([NeonDaniel](https://github.com/NeonDaniel))



Expand Down
2 changes: 1 addition & 1 deletion neon_utils/location_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@


# geocode.maps.co nominatim.openstreetmap.org
_NOMINATIM_DOMAIN = "geocode.maps.co"
_NOMINATIM_DOMAIN = "nominatim.openstreetmap.org"


def set_nominatim_domain(domain: str):
Expand Down
8 changes: 6 additions & 2 deletions neon_utils/user_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,13 @@ def get_user_prefs(message: Message = None) -> dict:
return default_user_config

for profile in message.context.get(profile_key):
if profile["user"]["username"] == username:
return dict(dict_update_keys(profile, default_user_config))
try:
if profile["user"]["username"] == username:
return dict(dict_update_keys(profile, default_user_config))
except KeyError:
LOG.error(f"Malformed profile in message context: {profile}")
LOG.warning(f"No preferences found for {username} in {message.context}")
default_user_config['user']['username'] = username
return default_user_config


Expand Down
9 changes: 9 additions & 0 deletions tests/user_util_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ def test_get_user_prefs(self):
self.assertIn("address", user_2["user"])
self.assertEqual(test_message_2.context['user_profiles'][1], user_2)

missing_profile = get_user_prefs(Message("", {},
{"username": "test",
"user_profiles": [{}]}))
self.assertEqual(missing_profile["user"]["username"], "test")
missing_profile_2 = get_user_prefs(Message("", {},
{"username": "test2",
"user_profiles": [{}]}))
self.assertEqual(missing_profile_2["user"]["username"], "test2")

def wrapper(message, valid_dict):
self.assertEqual(get_user_prefs(), valid_dict)

Expand Down
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

__version__ = "1.8.1"
__version__ = "1.8.2"
Loading