Skip to content
Extraits de code Groupes Projets
Valider 0db8541f rédigé par danielgrippi's avatar danielgrippi
Parcourir les fichiers

added a pane for people sharing with you on all aspect page

parent e854bd0a
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -17,6 +17,7 @@ class AspectsController < ApplicationController
@aspects = current_user.aspects.where(:id => params[:a_ids])
else
@aspects = current_user.aspects
@contacts_sharing_with = current_user.contacts.sharing
end
#No aspect_listings on infinite scroll
......
......@@ -19,6 +19,10 @@ class Contact < ActiveRecord::Base
validates_uniqueness_of :person_id, :scope => :user_id
scope :sharing, lambda {
where(:sharing => true)
}
def dispatch_request
request = self.generate_request
Postzord::Dispatch.new(self.user, request).post
......
......@@ -12,3 +12,16 @@
- for aspect in aspects
= 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
%hr{:style=>"width:300px;"}
- if user_signed_in? && contact.sharing?
- if user_signed_in?
%br
%h4
#{person.name} is sharing with you.
- if contact.sharing?
%h4
#{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
- unless person.profile.bio.blank?
%li
......
......@@ -26,7 +26,7 @@
.span-15.last
#author_info
- if user_signed_in?
- if !@contact.receiving? #!(current_user.person == @person) && !(@contact.persisted? && !@contact.sharing?)
- if !@contact.receiving?
.right
= link_to t('.start_sharing'),
{:controller => "contacts",
......
......@@ -28,7 +28,7 @@ module Diaspora
if !contact.mutual? || opts[:force]
contact.destroy
else
contact.update_attributes(:sharing => false)
contact.update_attributes(:receiving => false)
end
posts.each do |p|
......
......@@ -44,19 +44,18 @@ describe Contact do
contact.person = person
contact.should_not be_valid
end
end
it 'validates that sharing and aspect membership count are consistant' do
pending
person = Factory(:person)
contact2 = alice.contacts.create(:person=>person)
contact2.should be_valid
contact2.aspect_memberships.create(:aspect => alice.aspects.first)
contact2.should_not be_sharing
contact2.should_not be_valid
context 'scope' do
describe 'sharing' do
it 'returns contacts with sharing true' do
lambda {
alice.contacts.create!(:sharing => true, :person => Factory(:person))
alice.contacts.create!(:sharing => false, :person => Factory(:person))
}.should change{
Contact.sharing.count
}.by(1)
end
end
end
......
......@@ -27,10 +27,10 @@ describe Diaspora::UserModules::Connecting do
}.by(-1)
end
it 'removes a contacts mutual flag' do
bob.contacts.find_by_person_id(alice.person.id).should be_mutual
it 'removes a contacts receiving flag' do
bob.contacts.find_by_person_id(alice.person.id).should be_receiving
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
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter