Remove contacts page on profiles

closes #7769
parent 4fa92c18
# 0.7.5.0 # 0.7.5.0
## Refactor ## Refactor
* Remove the 'make contacts in this aspect visible to each other' option [#7769](https://github.com/diaspora/diaspora/pull/7769)
## Bug fixes ## Bug fixes
* Prefill conversation form on contacts page only with mutual contacts [#7744](https://github.com/diaspora/diaspora/pull/7744) * Prefill conversation form on contacts page only with mutual contacts [#7744](https://github.com/diaspora/diaspora/pull/7744)
......
...@@ -24,9 +24,6 @@ app.pages.Profile = app.views.Base.extend({ ...@@ -24,9 +24,6 @@ app.pages.Profile = app.views.Base.extend({
if (app.hasPreload("photos_count")) { if (app.hasPreload("photos_count")) {
this.photos = app.parsePreload("photos_count"); this.photos = app.parsePreload("photos_count");
} }
if (app.hasPreload("contacts_count")) {
this.contacts = app.parsePreload("contacts_count");
}
this.streamCollection = _.has(opts, "streamCollection") ? opts.streamCollection : null; this.streamCollection = _.has(opts, "streamCollection") ? opts.streamCollection : null;
this.streamViewClass = _.has(opts, "streamView") ? opts.streamView : null; this.streamViewClass = _.has(opts, "streamView") ? opts.streamView : null;
...@@ -70,7 +67,6 @@ app.pages.Profile = app.views.Base.extend({ ...@@ -70,7 +67,6 @@ app.pages.Profile = app.views.Base.extend({
return new app.views.ProfileHeader({ return new app.views.ProfileHeader({
model: this.model, model: this.model,
photos: this.photos, photos: this.photos,
contacts: this.contacts
}); });
}, },
......
...@@ -20,7 +20,6 @@ app.Router = Backbone.Router.extend({ ...@@ -20,7 +20,6 @@ app.Router = Backbone.Router.extend({
"p/:id(/)": "singlePost", "p/:id(/)": "singlePost",
"people(/)": "peopleSearch", "people(/)": "peopleSearch",
"people/:id(/)": "profile", "people/:id(/)": "profile",
"people/:id/contacts(/)": "profile",
"people/:id/photos(/)": "photos", "people/:id/photos(/)": "photos",
"posts/:id(/)": "singlePost", "posts/:id(/)": "singlePost",
"profile/edit(/)": "settings", "profile/edit(/)": "settings",
......
...@@ -14,7 +14,6 @@ app.views.ProfileHeader = app.views.Base.extend({ ...@@ -14,7 +14,6 @@ app.views.ProfileHeader = app.views.Base.extend({
initialize: function(opts) { initialize: function(opts) {
this.photos = _.has(opts, 'photos') ? opts.photos : null; this.photos = _.has(opts, 'photos') ? opts.photos : null;
this.contacts = _.has(opts, 'contacts') ? opts.contacts : null;
this.model.on("change", this.render, this); this.model.on("change", this.render, this);
$("#mentionModal").on("modal:loaded", this.mentionModalLoaded.bind(this)); $("#mentionModal").on("modal:loaded", this.mentionModalLoaded.bind(this));
$("#mentionModal").on("hidden.bs.modal", this.mentionModalHidden); $("#mentionModal").on("hidden.bs.modal", this.mentionModalHidden);
...@@ -24,13 +23,11 @@ app.views.ProfileHeader = app.views.Base.extend({ ...@@ -24,13 +23,11 @@ app.views.ProfileHeader = app.views.Base.extend({
return _.extend({}, this.defaultPresenter(), { return _.extend({}, this.defaultPresenter(), {
show_profile_btns: this._shouldShowProfileBtns(), show_profile_btns: this._shouldShowProfileBtns(),
show_photos: this._shouldShowPhotos(), show_photos: this._shouldShowPhotos(),
show_contacts: this._shouldShowContacts(),
is_blocked: this.model.isBlocked(), is_blocked: this.model.isBlocked(),
is_sharing: this.model.isSharing(), is_sharing: this.model.isSharing(),
is_receiving: this.model.isReceiving(), is_receiving: this.model.isReceiving(),
is_mutual: this.model.isMutual(), is_mutual: this.model.isMutual(),
has_tags: this._hasTags(), has_tags: this._hasTags(),
contacts: this.contacts,
photos: this.photos photos: this.photos
}); });
}, },
...@@ -51,10 +48,6 @@ app.views.ProfileHeader = app.views.Base.extend({ ...@@ -51,10 +48,6 @@ app.views.ProfileHeader = app.views.Base.extend({
return (this.photos && this.photos > 0); return (this.photos && this.photos > 0);
}, },
_shouldShowContacts: function() {
return (this.contacts && this.contacts > 0);
},
showMentionModal: function() { showMentionModal: function() {
app.helpers.showModal("#mentionModal"); app.helpers.showModal("#mentionModal");
}, },
......
...@@ -82,22 +82,5 @@ ...@@ -82,22 +82,5 @@
</a> </a>
</li> </li>
{{/if}} {{/if}}
{{#if show_contacts}}
<li {{#isCurrentPage 'personContacts' guid}} class="active" {{/isCurrentPage}}>
{{#if is_own_profile}}
<a href="{{urlTo 'contacts'}}" id="contacts_link">
<i class="entypo-users"></i>
{{t 'profile.contacts'}}
<div class="badge badge-default">{{contacts}}</div>
</a>
{{else}}
<a href="{{urlTo 'personContacts' guid}}" id="contacts_link">
<i class="entypo-users"></i>
{{t 'profile.contacts'}}
<div class="badge badge-default">{{contacts}}</div>
</a>
{{/if}}
</li>
{{/if}}
</div> </div>
</div> </div>
...@@ -77,7 +77,6 @@ class PeopleController < ApplicationController ...@@ -77,7 +77,6 @@ class PeopleController < ApplicationController
end end
gon.preloads[:person] = @presenter.as_json gon.preloads[:person] = @presenter.as_json
gon.preloads[:photos_count] = Photo.visible(current_user, @person).count(:all) gon.preloads[:photos_count] = Photo.visible(current_user, @person).count(:all)
gon.preloads[:contacts_count] = Contact.contact_contacts_for(current_user, @person).count(:all)
respond_with @presenter, layout: "with_header" respond_with @presenter, layout: "with_header"
end end
...@@ -123,30 +122,6 @@ class PeopleController < ApplicationController ...@@ -123,30 +122,6 @@ class PeopleController < ApplicationController
end end
end end
def contacts
respond_to do |format|
format.json { head :not_acceptable }
format.any do
@person = Person.find_by_guid(params[:person_id])
if @person
@contact = current_user.contact_for(@person)
@contacts_of_contact = Contact.contact_contacts_for(current_user, @person)
gon.preloads[:person] = PersonPresenter.new(@person, current_user).as_json
gon.preloads[:photos_count] = Photo.visible(current_user, @person).count(:all)
gon.preloads[:contacts_count] = @contacts_of_contact.count(:all)
@contacts_of_contact = @contacts_of_contact.paginate(page: params[:page], per_page: (params[:limit] || 15))
@hashes = hashes_for_people @contacts_of_contact, @aspects
respond_with @person, layout: "with_header"
else
flash[:error] = I18n.t "people.show.does_not_exist"
redirect_to people_path
end
end
end
end
private private
def find_person def find_person
......
...@@ -31,7 +31,6 @@ class PhotosController < ApplicationController ...@@ -31,7 +31,6 @@ class PhotosController < ApplicationController
format.all do format.all do
gon.preloads[:person] = @presenter.as_json gon.preloads[:person] = @presenter.as_json
gon.preloads[:photos_count] = Photo.visible(current_user, @person).count(:all) gon.preloads[:photos_count] = Photo.visible(current_user, @person).count(:all)
gon.preloads[:contacts_count] = Contact.contact_contacts_for(current_user, @person).count(:all)
render "people/show", layout: "with_header" render "people/show", layout: "with_header"
end end
format.mobile { render "people/show" } format.mobile { render "people/show" }
......
...@@ -61,17 +61,6 @@ class Contact < ApplicationRecord ...@@ -61,17 +61,6 @@ class Contact < ApplicationRecord
end end
end end
def self.contact_contacts_for(user, person)
return none unless user
if person == user.person
user.contact_people
else
contact = user.contact_for(person)
contact.try(:contacts) || none
end
end
# Follows back if user setting is set so # Follows back if user setting is set so
def receive(_recipient_user_ids) def receive(_recipient_user_ids)
user.share_with(person, user.auto_follow_back_aspect) if user.auto_follow_back && !receiving user.share_with(person, user.auto_follow_back_aspect) if user.auto_follow_back && !receiving
......
- content_for :page_title do
= @person.name
.container-fluid#profile_container
.row
.col-md-3
.sidebar.profile-sidebar#profile
-# here be JS
.col-md-9
.profile_header
-# more JS
.stream-container
#people-stream.stream
- @hashes.each do |hash|
= render partial: 'people/person', locals: hash
= will_paginate @contacts_of_contact, renderer: WillPaginate::ActionView::BootstrapLinkRenderer
-if user_signed_in? && @person
#new_status_message_pane
= render 'shared/modal',
path: new_status_message_path(:person_id => @person.id),
title: t('status_messages.new.mentioning', person: @person.name),
id: 'mentionModal'
-if @contact
.conversations-form-container#new_conversation_pane
= render 'shared/modal',
path: new_conversation_path(:contact_id => @contact.id, name: @contact.person.name, modal: true),
title: t('conversations.index.new_conversation'),
id: 'conversationModal'
...@@ -233,7 +233,6 @@ en: ...@@ -233,7 +233,6 @@ en:
gender: "Gender" gender: "Gender"
born: "Birthday" born: "Birthday"
photos: "Photos" photos: "Photos"
contacts: "Contacts"
posts: "Posts" posts: "Posts"
conversation: conversation:
......
...@@ -164,7 +164,6 @@ Rails.application.routes.draw do ...@@ -164,7 +164,6 @@ Rails.application.routes.draw do
resources :people, only: %i(show index) do resources :people, only: %i(show index) do
resources :status_messages, only: %i(new create) resources :status_messages, only: %i(new create)
resources :photos, except: %i(new update) resources :photos, except: %i(new update)
get :contacts
get :stream get :stream
get :hovercard get :hovercard
......
@javascript
Feature: show contacts
Background:
Given following users exist:
| username | email |
| Bob Jones | bob@bob.bob |
| Alice Smith | alice@alice.alice |
| Robert Grimm | robert@grimm.grimm |
And I sign in as "robert@grimm.grimm"
And I am on "alice@alice.alice"'s page
And I add the person to my "Unicorns" aspect
Scenario: see own contacts on profile
When I am on "robert@grimm.grimm"'s page
And I press the first "#contacts_link"
Then I should be on the contacts page
...@@ -580,40 +580,6 @@ describe PeopleController, :type => :controller do ...@@ -580,40 +580,6 @@ describe PeopleController, :type => :controller do
end end
end end
describe '#contacts' do
it 'assigns the contacts of a person' do
contact = alice.contact_for(bob.person)
contacts = contact.contacts
get :contacts, params: {person_id: bob.person.to_param}
expect(assigns(:contacts_of_contact).to_a).to eq(contacts.to_a)
expect(response).to be_success
end
it 'shows an error when invalid person id' do
get :contacts, params: {person_id: "foo"}
expect(flash[:error]).to be_present
expect(response).to redirect_to people_path
end
it "displays the correct number of photos" do
16.times do |i|
eve.post(:photo, :user_file => uploaded_photo, :to => eve.aspects.first.id, :public => true)
end
get :contacts, params: {person_id: eve.person.to_param}
expect(response.body).to include ',"photos_count":16'
eve.post(:photo, :user_file => uploaded_photo, :to => eve.aspects.first.id, :public => false)
get :contacts, params: {person_id: eve.person.to_param}
expect(response.body).to include ',"photos_count":16' # eve is not sharing with alice
end
it "returns a 406 for json format" do
get :contacts, params: {person_id: "foo"}, format: :json
expect(response.code).to eq("406")
end
end
describe '#diaspora_id?' do describe '#diaspora_id?' do
it 'returns true for pods on urls' do it 'returns true for pods on urls' do
expect(@controller.send(:diaspora_id?, "ilya_123@pod.geraspora.de")).to be true expect(@controller.send(:diaspora_id?, "ilya_123@pod.geraspora.de")).to be true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment