edited subscribers to include all contacts on public posts. added the ability to drop an aspect regardless of contacts contained. wip.
This commit is contained in:
parent
68375fdb02
commit
847f4fd260
7 changed files with 40 additions and 20 deletions
|
|
@ -113,7 +113,7 @@ class UsersController < ApplicationController
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
if @step == 3 && @requests.length == 0 && @friends.length == 0
|
if @step == 3 && @friends.length == 0
|
||||||
@user.update_attributes(:getting_started => false)
|
@user.update_attributes(:getting_started => false)
|
||||||
flash[:notice] = I18n.t('users.getting_started.could_not_find_anyone')
|
flash[:notice] = I18n.t('users.getting_started.could_not_find_anyone')
|
||||||
redirect_to root_path
|
redirect_to root_path
|
||||||
|
|
|
||||||
|
|
@ -9,4 +9,11 @@ class AspectMembership < ActiveRecord::Base
|
||||||
has_one :user, :through => :contact
|
has_one :user, :through => :contact
|
||||||
has_one :person, :through => :contact
|
has_one :person, :through => :contact
|
||||||
|
|
||||||
|
before_destroy do
|
||||||
|
unless self.contact.aspects.size > 1
|
||||||
|
self.user.disconnect(self.contact)
|
||||||
|
end
|
||||||
|
true
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,12 @@ class Post < ActiveRecord::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def subscribers(user)
|
def subscribers(user)
|
||||||
|
if self.public?
|
||||||
|
user.contact_people
|
||||||
|
else
|
||||||
user.people_in_aspects(user.aspects_with_post(self.id))
|
user.people_in_aspects(user.aspects_with_post(self.id))
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def receive(user, person)
|
def receive(user, person)
|
||||||
#exists locally, but you dont know about it
|
#exists locally, but you dont know about it
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
- if person.owner_id == current_user.id
|
- if person.owner_id == current_user.id
|
||||||
= t('people.person.thats_you')
|
= t('people.person.thats_you')
|
||||||
- elsif contact && !contact.pending
|
- elsif contact && contact.mutual
|
||||||
= t('people.person.already_connected')
|
= t('people.person.already_connected')
|
||||||
- else
|
- else
|
||||||
= link_to t('people.show.start_sharing'),
|
= link_to t('people.show.start_sharing'),
|
||||||
|
|
|
||||||
|
|
@ -37,14 +37,5 @@ Feature: invitation acceptance
|
||||||
And I should see "Would you like to find your Facebook friends on Diaspora?"
|
And I should see "Would you like to find your Facebook friends on Diaspora?"
|
||||||
|
|
||||||
When I follow "Skip"
|
When I follow "Skip"
|
||||||
Then I should see "People already on Diaspora"
|
Then I should be on the aspects page
|
||||||
|
|
||||||
And I press the first ".share_with.button"
|
|
||||||
And I press the first ".add.button" within "#facebox #aspects_list ul > li:first-child"
|
|
||||||
And I wait for the ajax to finish
|
|
||||||
|
|
||||||
When I go to the home page
|
|
||||||
Then I go to the manage aspects page
|
|
||||||
Then I should see 1 contact in "Family"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,13 +6,26 @@ require 'spec_helper'
|
||||||
|
|
||||||
describe AspectMembership do
|
describe AspectMembership do
|
||||||
|
|
||||||
describe '#before_delete' do
|
describe '#before_destroy' do
|
||||||
it 'calls disconnect' do
|
before do
|
||||||
pending
|
@aspect = alice.aspects.create(:name => "two")
|
||||||
alice.should_receive(:disconnect).with(alice.contact_for(bob))
|
@contact = alice.contact_for(bob.person)
|
||||||
|
|
||||||
alice.aspects.create(:name => "two")
|
@am = alice.aspects.first.aspect_memberships.first
|
||||||
alice.aspects.first.destroy
|
@am.stub!(:user).and_return(alice)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'calls disconnect if its the last aspect for the contact' do
|
||||||
|
alice.should_receive(:disconnect).with(@contact)
|
||||||
|
|
||||||
|
@am.destroy
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'does not call disconnect if its not the last aspect for the contact' do
|
||||||
|
alice.should_not_receive(:disconnect)
|
||||||
|
|
||||||
|
alice.add_contact_to_aspect(@contact, @aspect)
|
||||||
|
@am.destroy
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,11 +39,16 @@ describe Post do
|
||||||
|
|
||||||
describe '#subscribers' do
|
describe '#subscribers' do
|
||||||
it 'returns the people contained in the aspects the post appears in' do
|
it 'returns the people contained in the aspects the post appears in' do
|
||||||
|
|
||||||
post = @user.post :status_message, :text => "hello", :to => @aspect.id
|
post = @user.post :status_message, :text => "hello", :to => @aspect.id
|
||||||
|
|
||||||
post.subscribers(@user).should == []
|
post.subscribers(@user).should == []
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'returns all a users contacts if the post is public' do
|
||||||
|
post = @user.post :status_message, :text => "hello", :to => @aspect.id, :public => true
|
||||||
|
|
||||||
|
post.subscribers(@user).to_set.should == @user.contact_people.to_set
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#receive' do
|
describe '#receive' do
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue