From: Tom Hughes Date: Fri, 17 Jan 2025 22:42:35 +0000 (+0000) Subject: Rename friends_with to follows X-Git-Tag: live~293^2~5 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/bc630bca87e81150b71fe02c5af838365db5130e Rename friends_with to follows --- diff --git a/app/controllers/follows_controller.rb b/app/controllers/follows_controller.rb index d267777c1..09a98f98f 100644 --- a/app/controllers/follows_controller.rb +++ b/app/controllers/follows_controller.rb @@ -13,14 +13,14 @@ class FollowsController < ApplicationController before_action :lookup_friend def show - @already_follows = current_user.friends_with?(@friend) + @already_follows = current_user.follows?(@friend) end def create follow = Follow.new follow.follower = current_user follow.following = @friend - if current_user.friends_with?(@friend) + if current_user.follows?(@friend) flash[:warning] = t ".already_followed", :name => @friend.display_name elsif current_user.follows.where(:created_at => Time.now.utc - 1.hour..).count >= current_user.max_friends_per_hour flash[:error] = t ".limit_exceeded" @@ -37,7 +37,7 @@ class FollowsController < ApplicationController end def destroy - if current_user.friends_with?(@friend) + if current_user.follows?(@friend) Follow.where(:follower => current_user, :following => @friend).delete_all flash[:notice] = t ".success", :name => @friend.display_name else diff --git a/app/models/user.rb b/app/models/user.rb index ec3883bc6..92664a763 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -282,8 +282,8 @@ class User < ApplicationRecord OSM::GreatCircle.new(home_lat, home_lon).distance(nearby_user.home_lat, nearby_user.home_lon) end - def friends_with?(new_friend) - follows.exists?(:following => new_friend) + def follows?(user) + follows.exists?(:following => user) end ## diff --git a/app/views/dashboards/_contact.html.erb b/app/views/dashboards/_contact.html.erb index 4547a2d75..8e78524de 100644 --- a/app/views/dashboards/_contact.html.erb +++ b/app/views/dashboards/_contact.html.erb @@ -35,7 +35,7 @@