X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/3eccf65d8cf2ceb13050f5c8d1396546631994be..41a1867043fd9441578f8653a375963024a22676:/app/controllers/follows_controller.rb diff --git a/app/controllers/follows_controller.rb b/app/controllers/follows_controller.rb index d267777c1..39d6191cd 100644 --- a/app/controllers/follows_controller.rb +++ b/app/controllers/follows_controller.rb @@ -13,20 +13,20 @@ 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 + elsif current_user.follows.where(:created_at => Time.now.utc - 1.hour..).count >= current_user.max_follows_per_hour flash[:error] = t ".limit_exceeded" elsif follow.save flash[:notice] = t ".success", :name => @friend.display_name - UserMailer.friendship_notification(follow).deliver_later + UserMailer.follow_notification(follow).deliver_later else follow.add_error(t(".failed", :name => @friend.display_name)) end @@ -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