From e186811aed75f28214f707c98bb76c4d8b3b7a59 Mon Sep 17 00:00:00 2001
From: Steffen van Bergerem <svbergerem@omgsrsly.net>
Date: Fri, 25 Nov 2016 01:34:11 +0100
Subject: [PATCH] Remove unused contacts link methods

closes #7221
---
 app/helpers/application_helper.rb       |  8 --------
 lib/stream/aspect.rb                    | 12 ------------
 lib/stream/base.rb                      |  5 -----
 spec/helpers/application_helper_spec.rb | 18 ------------------
 spec/lib/stream/base_spec.rb            |  6 ------
 spec/shared_behaviors/stream.rb         |  4 ----
 6 files changed, 53 deletions(-)

diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 4a20f5909f..6fed2b8b6b 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -33,14 +33,6 @@ module ApplicationHelper
       "bookmarklet('#{bookmarklet_url}', #{width}, #{height});"
   end
 
-  def contacts_link
-    if current_user.contacts.size > 0
-      contacts_path
-    else
-      community_spotlight_path
-    end
-  end
-
   def all_services_connected?
     current_user.services.size == AppConfig.configured_services.size
   end
diff --git a/lib/stream/aspect.rb b/lib/stream/aspect.rb
index bdfe6c0846..0891ebde19 100644
--- a/lib/stream/aspect.rb
+++ b/lib/stream/aspect.rb
@@ -85,18 +85,6 @@ class Stream::Aspect < Stream::Base
     @all_aspects ||= aspect_ids.length == user.aspects.size
   end
 
-  # Provides a link to the user to the contacts page that corresponds with
-  # the stream's active aspects.
-  #
-  # @return [String] Link to contacts
-  def contacts_link
-    if for_all_aspects? || aspect_ids.size > 1
-      Rails.application.routes.url_helpers.contacts_path
-    else
-      Rails.application.routes.url_helpers.contacts_path(:a_id => aspect.id)
-    end
-  end
-
   # This is perfomance optimization, as everyone in your aspect stream you have
   # a contact.
   #
diff --git a/lib/stream/base.rb b/lib/stream/base.rb
index 0d705469ff..72dad18d29 100644
--- a/lib/stream/base.rb
+++ b/lib/stream/base.rb
@@ -49,11 +49,6 @@ class Stream::Base
       includes(:profile)
   end
 
-  # @return [String]
-  def contacts_link
-    Rails.application.routes.url_helpers.contacts_path
-  end
-
   # @return [Boolean]
   def for_all_aspects?
     true
diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb
index 68ef705712..e03b156241 100644
--- a/spec/helpers/application_helper_spec.rb
+++ b/spec/helpers/application_helper_spec.rb
@@ -10,24 +10,6 @@ describe ApplicationHelper, :type => :helper do
     @person = FactoryGirl.create(:person)
   end
 
-  describe "#contacts_link" do
-    before do
-      def current_user
-        @current_user
-      end
-    end
-
-    it 'links to community spotlight' do
-      @current_user = FactoryGirl.create(:user)
-      expect(contacts_link).to eq(community_spotlight_path)
-    end
-
-    it 'links to contacts#index' do
-      @current_user = alice
-      expect(contacts_link).to eq(contacts_path)
-    end
-  end
-
   describe "#all_services_connected?" do
     before do
       AppConfig.configured_services = [1, 2, 3]
diff --git a/spec/lib/stream/base_spec.rb b/spec/lib/stream/base_spec.rb
index 2f5c2435e1..0ae2c734b6 100644
--- a/spec/lib/stream/base_spec.rb
+++ b/spec/lib/stream/base_spec.rb
@@ -6,12 +6,6 @@ describe Stream::Base do
     @stream = Stream::Base.new(alice)
   end
 
-  describe '#contacts_link' do
-    it 'should default to your contacts page' do
-      expect(@stream.contacts_link).to match(/contacts/)
-    end
-  end
-
   describe '#stream_posts' do
     it "should returns the posts.for_a_stream" do
       posts = double
diff --git a/spec/shared_behaviors/stream.rb b/spec/shared_behaviors/stream.rb
index fa1c0d2de5..c322f261bc 100644
--- a/spec/shared_behaviors/stream.rb
+++ b/spec/shared_behaviors/stream.rb
@@ -18,10 +18,6 @@ shared_examples_for 'it is a stream' do
       expect(@stream.send(:publisher_opts)).not_to be_nil
     end
 
-    it 'has a contacts link' do
-      expect(@stream.contacts_link).not_to be_nil
-    end
-
     it 'should make the stream a time object' do
       @stream.max_time = 123
       expect(@stream.max_time).to be_a(Time)
-- 
GitLab