Skip to content

Commit

Permalink
Remove /dashboard/following_users route (forem#2191)
Browse files Browse the repository at this point in the history
  • Loading branch information
dabrorius authored and maestromac committed Mar 25, 2019
1 parent e1968e8 commit 88fc2a6
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/controllers/dashboards_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def show
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").
Expand Down
4 changes: 2 additions & 2 deletions app/views/dashboards/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@
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"

Expand Down
10 changes: 5 additions & 5 deletions spec/requests/dashboard_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@
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
Expand All @@ -69,19 +69,19 @@

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
Expand Down

0 comments on commit 88fc2a6

Please sign in to comment.