Remove current user check from dashboard view

This commit is contained in:
Anton Khorev 2025-02-19 03:59:38 +03:00
parent 02d9467939
commit 50bf0a6379
4 changed files with 56 additions and 53 deletions

View file

@ -9,7 +9,6 @@ class DashboardsController < ApplicationController
before_action :check_database_readable
def show
@user = current_user
@followings = current_user.followings
@nearby_users = current_user.nearby - @followings
end

View file

@ -11,8 +11,8 @@
<div class="col">
<p class='text-body-secondary mb-0'>
<%= link_to contact.display_name, contact %>
<% if @user.home_location? and contact.home_location? %>
<% distance = @user.distance(contact) %>
<% if current_user.home_location? and contact.home_location? %>
<% distance = current_user.distance(contact) %>
<% if distance < 1 %>
(<%= t ".m away", :count => (distance * 1000).round %>)
<% else %>

View file

@ -3,9 +3,8 @@
<% end %>
<div class="row">
<% if current_user and @user.id == current_user.id %>
<div class="col-md order-md-last">
<% if !@user.home_location? %>
<% if !current_user.home_location? %>
<div id="map" class="content_map border border-secondary-subtle">
<p class="m-3"><%= t(".no_home_location_html", :edit_profile_link => link_to(t(".edit_your_profile"), edit_profile_path)) %></p>
</div>
@ -58,5 +57,4 @@
</div>
<% end %>
</div>
<% end %>
</div>

View file

@ -9,4 +9,10 @@ class DashboardsControllerTest < ActionDispatch::IntegrationTest
{ :controller => "dashboards", :action => "show" }
)
end
def test_show_unauthorized
get dashboard_path
assert_redirected_to login_path(:referer => dashboard_path)
end
end