From 88fc2a66d3297dfe9a2a92fc3f18bcdfa3a295d5 Mon Sep 17 00:00:00 2001 From: Filip Defar Date: Mon, 25 Mar 2019 19:49:09 +0100 Subject: [PATCH] Remove /dashboard/following_users route (#2191) --- app/controllers/dashboards_controller.rb | 2 +- app/views/dashboards/show.html.erb | 4 ++-- config/routes.rb | 2 +- spec/requests/dashboard_spec.rb | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/app/controllers/dashboards_controller.rb b/app/controllers/dashboards_controller.rb index ff8b4bc19..528b55d65 100644 --- a/app/controllers/dashboards_controller.rb +++ b/app/controllers/dashboards_controller.rb @@ -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"). diff --git a/app/views/dashboards/show.html.erb b/app/views/dashboards/show.html.erb index 93f8c050c..4e7428d6c 100644 --- a/app/views/dashboards/show.html.erb +++ b/app/views/dashboards/show.html.erb @@ -10,7 +10,7 @@ FOLLOWERS (<%= @user.followers_count %>) - " href="/dashboard/following"> + " href="/dashboard/following"> FOLLOWING (<%= @user.following_users_count + @user.following_tags_count %>) @@ -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 %>

Followed tags (<%= @user.following_tags_count %>)

Adjust Follow Weight to make a tag show up less or more in your feed (default 1.0) diff --git a/config/routes.rb b/config/routes.rb index b254570cb..df50b99a6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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" diff --git a/spec/requests/dashboard_spec.rb b/spec/requests/dashboard_spec.rb index 5b3b80b6d..90c116777 100644 --- a/spec/requests/dashboard_spec.rb +++ b/spec/requests/dashboard_spec.rb @@ -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