From: Nenad Vujicic Date: Thu, 12 Sep 2024 11:36:44 +0000 (+0200) Subject: Show friend options only when user is logged in X-Git-Tag: live~255^2 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/8d77891fd6796f32f665f7524e0ed8f098507f6d Show friend options only when user is logged in Fixes #5199. Displays "Add Friend" and "Unfriend" links (buttons) on user profile page only if user is logged-in. --- diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb index c73581b25..44319b384 100644 --- a/app/views/users/show.html.erb +++ b/app/views/users/show.html.erb @@ -81,15 +81,15 @@ <%= link_to t(".comments"), diary_comments_path(@user) %> <%= number_with_delimiter(@user.diary_comments.size) %> -
  • - <% if current_user and current_user.friends_with?(@user) %> - <%= link_to t(".remove as friend"), remove_friend_path(:display_name => @user.display_name), :method => :post %> - <% elsif current_user %> - <%= link_to t(".add as friend"), make_friend_path(:display_name => @user.display_name), :method => :post %> - <% else %> - <%= link_to t(".add as friend"), make_friend_path(:display_name => @user.display_name) %> - <% end %> -
  • + <% if current_user %> +
  • + <% if current_user.friends_with?(@user) %> + <%= link_to t(".remove as friend"), remove_friend_path(:display_name => @user.display_name), :method => :post %> + <% else %> + <%= link_to t(".add as friend"), make_friend_path(:display_name => @user.display_name), :method => :post %> + <% end %> +
  • + <% end %> <% if @user.blocks.exists? %>