added a pane for people sharing with you on all aspect page
This commit is contained in:
parent
e854bd0a32
commit
0db8541f6e
8 changed files with 42 additions and 21 deletions
|
|
@ -17,6 +17,7 @@ class AspectsController < ApplicationController
|
||||||
@aspects = current_user.aspects.where(:id => params[:a_ids])
|
@aspects = current_user.aspects.where(:id => params[:a_ids])
|
||||||
else
|
else
|
||||||
@aspects = current_user.aspects
|
@aspects = current_user.aspects
|
||||||
|
@contacts_sharing_with = current_user.contacts.sharing
|
||||||
end
|
end
|
||||||
|
|
||||||
#No aspect_listings on infinite scroll
|
#No aspect_listings on infinite scroll
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,10 @@ class Contact < ActiveRecord::Base
|
||||||
|
|
||||||
validates_uniqueness_of :person_id, :scope => :user_id
|
validates_uniqueness_of :person_id, :scope => :user_id
|
||||||
|
|
||||||
|
scope :sharing, lambda {
|
||||||
|
where(:sharing => true)
|
||||||
|
}
|
||||||
|
|
||||||
def dispatch_request
|
def dispatch_request
|
||||||
request = self.generate_request
|
request = self.generate_request
|
||||||
Postzord::Dispatch.new(self.user, request).post
|
Postzord::Dispatch.new(self.user, request).post
|
||||||
|
|
|
||||||
|
|
@ -12,3 +12,16 @@
|
||||||
- for aspect in aspects
|
- for aspect in aspects
|
||||||
= render 'aspects/aspect', :aspect => aspect, :contacts => aspect.contacts
|
= render 'aspects/aspect', :aspect => aspect, :contacts => aspect.contacts
|
||||||
|
|
||||||
|
- if @contacts_sharing_with
|
||||||
|
%li{:class => ("dull" if @contacts_sharing_with.size == 0)}
|
||||||
|
.right
|
||||||
|
%b
|
||||||
|
= link_to t('contacts', :count => @contacts_sharing_with.size), edit_aspect_path(aspect), :rel => 'facebox', :class => 'contact-count'
|
||||||
|
%b
|
||||||
|
People sharing with you
|
||||||
|
%br
|
||||||
|
|
||||||
|
- if @contacts_sharing_with.size > 0
|
||||||
|
.contacts
|
||||||
|
- for contact in @contacts_sharing_with[0..15]
|
||||||
|
= person_image_link(contact.person)
|
||||||
|
|
|
||||||
|
|
@ -35,12 +35,16 @@
|
||||||
%br
|
%br
|
||||||
%hr{:style=>"width:300px;"}
|
%hr{:style=>"width:300px;"}
|
||||||
|
|
||||||
- if user_signed_in? && contact.sharing?
|
- if user_signed_in?
|
||||||
%br
|
%br
|
||||||
|
- if contact.sharing?
|
||||||
%h4
|
%h4
|
||||||
#{person.name} is sharing with you.
|
#{person.name} is sharing with you.
|
||||||
|
- elsif contact.receiving?
|
||||||
|
%h4
|
||||||
|
You are sharing with #{person.name}
|
||||||
|
|
||||||
-if user_signed_in? && ((contact.persisted? && contact.mutual?) || person == current_user.person || @incoming_request)
|
-if user_signed_in? && (contact.sharing? || person == current_user.person)
|
||||||
%ul#profile_information
|
%ul#profile_information
|
||||||
- unless person.profile.bio.blank?
|
- unless person.profile.bio.blank?
|
||||||
%li
|
%li
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@
|
||||||
.span-15.last
|
.span-15.last
|
||||||
#author_info
|
#author_info
|
||||||
- if user_signed_in?
|
- if user_signed_in?
|
||||||
- if !@contact.receiving? #!(current_user.person == @person) && !(@contact.persisted? && !@contact.sharing?)
|
- if !@contact.receiving?
|
||||||
.right
|
.right
|
||||||
= link_to t('.start_sharing'),
|
= link_to t('.start_sharing'),
|
||||||
{:controller => "contacts",
|
{:controller => "contacts",
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ module Diaspora
|
||||||
if !contact.mutual? || opts[:force]
|
if !contact.mutual? || opts[:force]
|
||||||
contact.destroy
|
contact.destroy
|
||||||
else
|
else
|
||||||
contact.update_attributes(:sharing => false)
|
contact.update_attributes(:receiving => false)
|
||||||
end
|
end
|
||||||
|
|
||||||
posts.each do |p|
|
posts.each do |p|
|
||||||
|
|
|
||||||
|
|
@ -44,19 +44,18 @@ describe Contact do
|
||||||
contact.person = person
|
contact.person = person
|
||||||
contact.should_not be_valid
|
contact.should_not be_valid
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
it 'validates that sharing and aspect membership count are consistant' do
|
context 'scope' do
|
||||||
pending
|
describe 'sharing' do
|
||||||
person = Factory(:person)
|
it 'returns contacts with sharing true' do
|
||||||
|
lambda {
|
||||||
contact2 = alice.contacts.create(:person=>person)
|
alice.contacts.create!(:sharing => true, :person => Factory(:person))
|
||||||
contact2.should be_valid
|
alice.contacts.create!(:sharing => false, :person => Factory(:person))
|
||||||
|
}.should change{
|
||||||
contact2.aspect_memberships.create(:aspect => alice.aspects.first)
|
Contact.sharing.count
|
||||||
contact2.should_not be_sharing
|
}.by(1)
|
||||||
contact2.should_not be_valid
|
end
|
||||||
|
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,10 @@ describe Diaspora::UserModules::Connecting do
|
||||||
}.by(-1)
|
}.by(-1)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'removes a contacts mutual flag' do
|
it 'removes a contacts receiving flag' do
|
||||||
bob.contacts.find_by_person_id(alice.person.id).should be_mutual
|
bob.contacts.find_by_person_id(alice.person.id).should be_receiving
|
||||||
bob.remove_contact(bob.contact_for(alice.person))
|
bob.remove_contact(bob.contact_for(alice.person))
|
||||||
bob.contacts(true).find_by_person_id(alice.person.id).should_not be_mutual
|
bob.contacts(true).find_by_person_id(alice.person.id).should_not be_receiving
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue