Remove current user check from dashboard view
This commit is contained in:
parent
02d9467939
commit
50bf0a6379
4 changed files with 56 additions and 53 deletions
|
@ -9,7 +9,6 @@ class DashboardsController < ApplicationController
|
||||||
before_action :check_database_readable
|
before_action :check_database_readable
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@user = current_user
|
|
||||||
@followings = current_user.followings
|
@followings = current_user.followings
|
||||||
@nearby_users = current_user.nearby - @followings
|
@nearby_users = current_user.nearby - @followings
|
||||||
end
|
end
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
<div class="col">
|
<div class="col">
|
||||||
<p class='text-body-secondary mb-0'>
|
<p class='text-body-secondary mb-0'>
|
||||||
<%= link_to contact.display_name, contact %>
|
<%= link_to contact.display_name, contact %>
|
||||||
<% if @user.home_location? and contact.home_location? %>
|
<% if current_user.home_location? and contact.home_location? %>
|
||||||
<% distance = @user.distance(contact) %>
|
<% distance = current_user.distance(contact) %>
|
||||||
<% if distance < 1 %>
|
<% if distance < 1 %>
|
||||||
(<%= t ".m away", :count => (distance * 1000).round %>)
|
(<%= t ".m away", :count => (distance * 1000).round %>)
|
||||||
<% else %>
|
<% else %>
|
||||||
|
|
|
@ -3,9 +3,8 @@
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<% if current_user and @user.id == current_user.id %>
|
|
||||||
<div class="col-md order-md-last">
|
<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">
|
<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>
|
<p class="m-3"><%= t(".no_home_location_html", :edit_profile_link => link_to(t(".edit_your_profile"), edit_profile_path)) %></p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -58,5 +57,4 @@
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -9,4 +9,10 @@ class DashboardsControllerTest < ActionDispatch::IntegrationTest
|
||||||
{ :controller => "dashboards", :action => "show" }
|
{ :controller => "dashboards", :action => "show" }
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_show_unauthorized
|
||||||
|
get dashboard_path
|
||||||
|
|
||||||
|
assert_redirected_to login_path(:referer => dashboard_path)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue