Remove /dashboard/following_users route (#2191)

This commit is contained in:
Filip Defar 2019-03-25 19:49:09 +01:00 committed by Mac Siri
parent e1968e815b
commit 88fc2a66d3
4 changed files with 9 additions and 9 deletions

View file

@ -10,7 +10,7 @@ class DashboardsController < ApplicationController
current_user
end
authorize (@user || User), :dashboard_show?
if params[:which] == "following" || params[:which] == "following_users"
if params[:which] == "following"
@follows = @user.follows_by_type("User").
order("created_at DESC").includes(:followable).limit(80)
@followed_tags = @user.follows_by_type("ActsAsTaggableOn::Tag").

View file

@ -10,7 +10,7 @@
<span>FOLLOWERS</span>
<span>(<%= @user.followers_count %>)</span>
</a>
<a class="action <%= "active" if params[:which].to_s.include?("following") %>" href="/dashboard/following">
<a class="action <%= "active" if params[:which] == "following" %>" href="/dashboard/following">
<span>FOLLOWING</span>
<span>(<%= @user.following_users_count + @user.following_tags_count %>)</span>
</a>
@ -43,7 +43,7 @@
<% @articles.each do |article| %>
<%= render "dashboard_article", article: article, org_admin: true %>
<% end %>
<% elsif params[:which] == "user_followers" || params[:which] == "following_users" || params[:which] == "following" || params[:which] == "organization_user_followers" %>
<% elsif params[:which] == "user_followers" || params[:which] == "following" || params[:which] == "organization_user_followers" %>
<% if @followed_tags %>
<h2>Followed tags (<%= @user.following_tags_count %>)</h2>
<p><em>Adjust <strong>Follow Weight</strong> to make a tag show up less or more in your feed (default 1.0)</em>

View file

@ -261,7 +261,7 @@ Rails.application.routes.draw do
get "dashboard/pro/org/:org_id" => "dashboards#pro"
get "/dashboard/:which" => "dashboards#show",
constraints: {
which: /organization|organization_user_followers|user_followers|following_users|following|reading/
which: /organization|organization_user_followers|user_followers|following|reading/
}
get "/dashboard/:username" => "dashboards#show"

View file

@ -56,10 +56,10 @@ RSpec.describe "Dashboards", type: :request do
end
end
describe "GET /dashboard/following_users" do
describe "GET /dashboard/following" do
context "when not logged in" do
it "redirects to /enter" do
get "/dashboard/following_users"
get "/dashboard/following"
expect(response).to redirect_to("/enter")
end
end
@ -69,19 +69,19 @@ RSpec.describe "Dashboards", type: :request do
it "renders users that current user follows" do
user.follow second_user
get "/dashboard/following_users"
get "/dashboard/following"
expect(response.body).to include CGI.escapeHTML(second_user.name)
end
it "renders tags that current user follows" do
tag = create(:tag)
user.follow tag
get "/dashboard/following_users"
get "/dashboard/following"
expect(response.body).to include CGI.escapeHTML(tag.name)
end
it "renders organizations that current user follows" do
organization = create(:organization)
user.follow organization
get "/dashboard/following_users"
get "/dashboard/following"
expect(response.body).to include CGI.escapeHTML(organization.name)
end
end