From 60df916a6250ecd59acded9a8e2c20a325e01ea7 Mon Sep 17 00:00:00 2001
From: echarp <manu@echarp.org>
Date: Sun, 6 May 2018 21:20:48 +0200
Subject: [PATCH] The geocoding address does not use anymore the country if
 this country is "top level".

This should better handle the "other" country, which OSM has troubles with...
---
 app/models/event.rb | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/app/models/event.rb b/app/models/event.rb
index f59f1a409..0243e23c9 100644
--- a/app/models/event.rb
+++ b/app/models/event.rb
@@ -86,7 +86,9 @@ class Event < ApplicationRecord
   end
 
   def full_address
-    [address, city, region, region.try(:region)].compact.join ', '
+    # Only uses the region if it is a sub-region and not a country
+    [address, city, region, region.try(:region) ? region.try(:region) : nil]
+      .compact.join ', '
   end
 
   def hashtags
-- 
GitLab