only show community spotlight link on /contacts if it is enabled
closes #7213
This commit is contained in:
parent
43b1632148
commit
6c6f9bb982
4 changed files with 90 additions and 27 deletions
|
|
@ -10,6 +10,7 @@
|
||||||
* Unify desktop and mobile head elements [#7194](https://github.com/diaspora/diaspora/pull/7194)
|
* Unify desktop and mobile head elements [#7194](https://github.com/diaspora/diaspora/pull/7194)
|
||||||
* Refactor flash messages on ajax errors for comments, likes, reshares and aspect memberships [#7202](https://github.com/diaspora/diaspora/pull/7202)
|
* Refactor flash messages on ajax errors for comments, likes, reshares and aspect memberships [#7202](https://github.com/diaspora/diaspora/pull/7202)
|
||||||
* Only require AWS-module for fog [#7201](https://github.com/diaspora/diaspora/pull/7201)
|
* Only require AWS-module for fog [#7201](https://github.com/diaspora/diaspora/pull/7201)
|
||||||
|
* Only show community spotlight links on the contacts page if community spotlight is enabled [#7213](https://github.com/diaspora/diaspora/pull/7213)
|
||||||
|
|
||||||
## Bug fixes
|
## Bug fixes
|
||||||
* Fix fetching comments after fetching likes [#7167](https://github.com/diaspora/diaspora/pull/7167)
|
* Fix fetching comments after fetching likes [#7167](https://github.com/diaspora/diaspora/pull/7167)
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
- content_for :page_title do
|
- content_for :page_title do
|
||||||
= t('.title')
|
= t(".title")
|
||||||
|
|
||||||
.container-fluid#contacts_container
|
.container-fluid#contacts_container
|
||||||
.row
|
.row
|
||||||
|
|
@ -9,25 +9,26 @@
|
||||||
|
|
||||||
.col-md-9
|
.col-md-9
|
||||||
.stream.contacts.framed-content#people_stream
|
.stream.contacts.framed-content#people_stream
|
||||||
= render 'contacts/header'
|
= render "contacts/header"
|
||||||
|
|
||||||
- if @contacts_size > 0
|
- if @contacts_size > 0
|
||||||
- if @aspect && @aspect.contacts.length == 0
|
- if @aspect && @aspect.contacts.length == 0
|
||||||
.well
|
.well
|
||||||
= t('.no_contacts_in_aspect')
|
= t(".no_contacts_in_aspect")
|
||||||
#contact_stream
|
#contact_stream
|
||||||
-# JS
|
-# JS
|
||||||
|
|
||||||
- else
|
- else
|
||||||
.no_contacts
|
.no_contacts
|
||||||
%h3
|
%h3
|
||||||
= t('.no_contacts')
|
= t(".no_contacts")
|
||||||
|
- if AppConfig.settings.community_spotlight.enable?
|
||||||
|
%p
|
||||||
|
!= t(".no_contacts_message",
|
||||||
|
community_spotlight: link_to(t(".community_spotlight"), community_spotlight_path))
|
||||||
%p
|
%p
|
||||||
!= t('.no_contacts_message',
|
.btn.btn-link{"data-toggle" => "modal"}
|
||||||
:community_spotlight => link_to(t('.community_spotlight'), community_spotlight_path))
|
= t("invitations.new.invite_someone_to_join")
|
||||||
%p
|
|
||||||
.btn.btn-link{ 'data-toggle' => 'modal' }
|
|
||||||
= t('invitations.new.invite_someone_to_join')
|
|
||||||
|
|
||||||
#paginate
|
#paginate
|
||||||
.loader.hidden
|
.loader.hidden
|
||||||
|
|
@ -35,7 +36,7 @@
|
||||||
|
|
||||||
-if @aspect
|
-if @aspect
|
||||||
.conversations-form-container#new_conversation_pane
|
.conversations-form-container#new_conversation_pane
|
||||||
= render 'shared/modal',
|
= render "shared/modal",
|
||||||
:path => new_conversation_path(:aspect_id => @aspect.id, :name => @aspect.name, :modal => true),
|
path: new_conversation_path(aspect_id: @aspect.id, name: @aspect.name, modal: true),
|
||||||
:title => t('conversations.index.new_conversation'),
|
title: t("conversations.index.new_conversation"),
|
||||||
:id => 'conversationModal'
|
id: "conversationModal"
|
||||||
|
|
|
||||||
|
|
@ -61,20 +61,6 @@ Feature: User manages contacts
|
||||||
And I press "Update"
|
And I press "Update"
|
||||||
Then I should see "Unicorn People" within "#aspect_name"
|
Then I should see "Unicorn People" within "#aspect_name"
|
||||||
|
|
||||||
Scenario: clicking on the contacts link in the header with zero contacts directs a user to the featured users page
|
|
||||||
Given I am signed in
|
|
||||||
And I have 0 contacts
|
|
||||||
And I click on my name in the header
|
|
||||||
When I follow "Contacts"
|
|
||||||
Then I should see "Community spotlight" within ".col-md-9"
|
|
||||||
|
|
||||||
Scenario: clicking on the contacts link in the header with contacts does not send a user to the featured users page
|
|
||||||
Given I am signed in
|
|
||||||
And I have 2 contacts
|
|
||||||
And I click on my name in the header
|
|
||||||
When I follow "Contacts"
|
|
||||||
Then I should not see "Community spotlight" within ".col-md-9"
|
|
||||||
|
|
||||||
Scenario: sorting the aspects
|
Scenario: sorting the aspects
|
||||||
Given I am signed in
|
Given I am signed in
|
||||||
And I have an aspect called "People"
|
And I have an aspect called "People"
|
||||||
|
|
|
||||||
75
spec/integration/contacts_spec.rb
Normal file
75
spec/integration/contacts_spec.rb
Normal file
|
|
@ -0,0 +1,75 @@
|
||||||
|
require "spec_helper"
|
||||||
|
|
||||||
|
describe ContactsController, type: :request do
|
||||||
|
describe "/contacts" do
|
||||||
|
context "user is signed in" do
|
||||||
|
before do
|
||||||
|
sign_in user
|
||||||
|
end
|
||||||
|
|
||||||
|
shared_examples_for "community spotlight information is not present on the page" do
|
||||||
|
it "does not display a community spotlight link" do
|
||||||
|
get "/contacts"
|
||||||
|
|
||||||
|
expect(response.status).to eq(200)
|
||||||
|
expect(response.body).to_not match(/a href="#{community_spotlight_path}"/)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "user has no contacts" do
|
||||||
|
let!(:user) { FactoryGirl.create(:user) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
expect(user.contacts.size).to eq(0)
|
||||||
|
end
|
||||||
|
|
||||||
|
context "community spotlight is enabled" do
|
||||||
|
before do
|
||||||
|
AppConfig.settings.community_spotlight.enable = true
|
||||||
|
end
|
||||||
|
|
||||||
|
it "displays a community spotlight link" do
|
||||||
|
get "/contacts"
|
||||||
|
|
||||||
|
expect(response.status).to eq(200)
|
||||||
|
expect(response.body).to match(/a href="#{community_spotlight_path}"/)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "community spotlight is disabled" do
|
||||||
|
before do
|
||||||
|
AppConfig.settings.community_spotlight.enable = false
|
||||||
|
end
|
||||||
|
|
||||||
|
it_behaves_like "community spotlight information is not present on the page"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context "user has contacts" do
|
||||||
|
let!(:user) { FactoryGirl.create(:user) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
FactoryGirl.create(:contact, person: alice.person, user: user)
|
||||||
|
FactoryGirl.create(:contact, person: bob.person, user: user)
|
||||||
|
expect(user.reload.contacts.size).to eq(2)
|
||||||
|
end
|
||||||
|
|
||||||
|
context "community spotlight is enabled" do
|
||||||
|
before do
|
||||||
|
AppConfig.settings.community_spotlight.enable = true
|
||||||
|
end
|
||||||
|
|
||||||
|
it_behaves_like "community spotlight information is not present on the page"
|
||||||
|
end
|
||||||
|
|
||||||
|
context "community spotlight is disabled" do
|
||||||
|
before do
|
||||||
|
AppConfig.settings.community_spotlight.enable = false
|
||||||
|
end
|
||||||
|
|
||||||
|
it_behaves_like "community spotlight information is not present on the page"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
Loading…
Reference in a new issue