parent
4fa92c1823
commit
7d6623d069
13 changed files with 1 additions and 151 deletions
|
|
@ -1,6 +1,7 @@
|
|||
# 0.7.5.0
|
||||
|
||||
## Refactor
|
||||
* Remove the 'make contacts in this aspect visible to each other' option [#7769](https://github.com/diaspora/diaspora/pull/7769)
|
||||
|
||||
## Bug fixes
|
||||
* 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({
|
|||
if (app.hasPreload("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.streamViewClass = _.has(opts, "streamView") ? opts.streamView : null;
|
||||
|
|
@ -70,7 +67,6 @@ app.pages.Profile = app.views.Base.extend({
|
|||
return new app.views.ProfileHeader({
|
||||
model: this.model,
|
||||
photos: this.photos,
|
||||
contacts: this.contacts
|
||||
});
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ app.Router = Backbone.Router.extend({
|
|||
"p/:id(/)": "singlePost",
|
||||
"people(/)": "peopleSearch",
|
||||
"people/:id(/)": "profile",
|
||||
"people/:id/contacts(/)": "profile",
|
||||
"people/:id/photos(/)": "photos",
|
||||
"posts/:id(/)": "singlePost",
|
||||
"profile/edit(/)": "settings",
|
||||
|
|
|
|||
|
|
@ -14,7 +14,6 @@ app.views.ProfileHeader = app.views.Base.extend({
|
|||
|
||||
initialize: function(opts) {
|
||||
this.photos = _.has(opts, 'photos') ? opts.photos : null;
|
||||
this.contacts = _.has(opts, 'contacts') ? opts.contacts : null;
|
||||
this.model.on("change", this.render, this);
|
||||
$("#mentionModal").on("modal:loaded", this.mentionModalLoaded.bind(this));
|
||||
$("#mentionModal").on("hidden.bs.modal", this.mentionModalHidden);
|
||||
|
|
@ -24,13 +23,11 @@ app.views.ProfileHeader = app.views.Base.extend({
|
|||
return _.extend({}, this.defaultPresenter(), {
|
||||
show_profile_btns: this._shouldShowProfileBtns(),
|
||||
show_photos: this._shouldShowPhotos(),
|
||||
show_contacts: this._shouldShowContacts(),
|
||||
is_blocked: this.model.isBlocked(),
|
||||
is_sharing: this.model.isSharing(),
|
||||
is_receiving: this.model.isReceiving(),
|
||||
is_mutual: this.model.isMutual(),
|
||||
has_tags: this._hasTags(),
|
||||
contacts: this.contacts,
|
||||
photos: this.photos
|
||||
});
|
||||
},
|
||||
|
|
@ -51,10 +48,6 @@ app.views.ProfileHeader = app.views.Base.extend({
|
|||
return (this.photos && this.photos > 0);
|
||||
},
|
||||
|
||||
_shouldShowContacts: function() {
|
||||
return (this.contacts && this.contacts > 0);
|
||||
},
|
||||
|
||||
showMentionModal: function() {
|
||||
app.helpers.showModal("#mentionModal");
|
||||
},
|
||||
|
|
|
|||
|
|
@ -82,22 +82,5 @@
|
|||
</a>
|
||||
</li>
|
||||
{{/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>
|
||||
|
|
|
|||
|
|
@ -77,7 +77,6 @@ class PeopleController < ApplicationController
|
|||
end
|
||||
gon.preloads[:person] = @presenter.as_json
|
||||
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"
|
||||
end
|
||||
|
||||
|
|
@ -123,30 +122,6 @@ class PeopleController < ApplicationController
|
|||
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
|
||||
|
||||
def find_person
|
||||
|
|
|
|||
|
|
@ -31,7 +31,6 @@ class PhotosController < ApplicationController
|
|||
format.all do
|
||||
gon.preloads[:person] = @presenter.as_json
|
||||
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"
|
||||
end
|
||||
format.mobile { render "people/show" }
|
||||
|
|
|
|||
|
|
@ -61,17 +61,6 @@ class Contact < ApplicationRecord
|
|||
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
|
||||
def receive(_recipient_user_ids)
|
||||
user.share_with(person, user.auto_follow_back_aspect) if user.auto_follow_back && !receiving
|
||||
|
|
|
|||
|
|
@ -1,32 +0,0 @@
|
|||
- 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:
|
|||
gender: "Gender"
|
||||
born: "Birthday"
|
||||
photos: "Photos"
|
||||
contacts: "Contacts"
|
||||
posts: "Posts"
|
||||
|
||||
conversation:
|
||||
|
|
|
|||
|
|
@ -164,7 +164,6 @@ Rails.application.routes.draw do
|
|||
resources :people, only: %i(show index) do
|
||||
resources :status_messages, only: %i(new create)
|
||||
resources :photos, except: %i(new update)
|
||||
get :contacts
|
||||
get :stream
|
||||
get :hovercard
|
||||
|
||||
|
|
|
|||
|
|
@ -1,17 +0,0 @@
|
|||
@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
|
|||
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
|
||||
it 'returns true for pods on urls' do
|
||||
expect(@controller.send(:diaspora_id?, "ilya_123@pod.geraspora.de")).to be true
|
||||
|
|
|
|||
Loading…
Reference in a new issue