summaryrefslogtreecommitdiff
path: root/app/controllers/users_controller.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/controllers/users_controller.rb')
-rw-r--r--app/controllers/users_controller.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index e4354eaa452..02b29d42313 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -191,7 +191,12 @@ class UsersController < ApplicationController
def follow
followee = current_user.follow(user)
- flash[:alert] = followee.errors.full_messages.join(', ') if followee&.errors&.any?
+ if followee
+ flash[:alert] = followee.errors.full_messages.join(', ') if followee&.errors&.any?
+ else
+ flash[:alert] = s_('Action not allowed.')
+ end
+
redirect_path = referer_path(request) || @user
redirect_to redirect_path