]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/user.rb
Add support for dark banner images that need a white close icon
[rails.git] / app / models / user.rb
index c809b619294732038c97558423b349fe2050212c..41f249d4e484b628ca236e7e01af2be5a4cb386e 100644 (file)
@@ -238,8 +238,12 @@ class User < ApplicationRecord
     @preferred_languages ||= Locale.list(languages)
   end
 
+  def has_home?
+    home_lat && home_lon
+  end
+
   def nearby(radius = Settings.nearby_radius, num = Settings.nearby_users)
-    if home_lon && home_lat
+    if has_home?
       gc = OSM::GreatCircle.new(home_lat, home_lon)
       sql_for_area = QuadTile.sql_for_area(gc.bounds(radius), "home_")
       sql_for_distance = gc.sql_for_distance("home_lat", "home_lon")
@@ -401,6 +405,6 @@ class User < ApplicationRecord
   end
 
   def update_tile
-    self.home_tile = QuadTile.tile_for_point(home_lat, home_lon) if home_lat && home_lon
+    self.home_tile = QuadTile.tile_for_point(home_lat, home_lon) if has_home?
   end
 end