Fix missing partials on last commit, you can now accept a request from the requestor's profile page
This commit is contained in:
parent
3b727dc887
commit
e881edab96
4 changed files with 65 additions and 0 deletions
|
|
@ -116,6 +116,12 @@ class AspectsController < ApplicationController
|
|||
current_user.add_contact_to_aspect(@contact, @aspect)
|
||||
else
|
||||
current_user.send_contact_request_to(@person, @aspect)
|
||||
contact = current_user.contact_for(@person)
|
||||
|
||||
if request = Request.from(@person).to(current_user).first
|
||||
request.destroy
|
||||
contact.update_attributes(:pending => false)
|
||||
end
|
||||
end
|
||||
flash.now[:notice] = I18n.t 'aspects.add_to_aspect.success'
|
||||
|
||||
|
|
|
|||
20
app/views/people/_share_with_pane.html.haml
Normal file
20
app/views/people/_share_with_pane.html.haml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
-# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
.contact_list#aspects_list
|
||||
%ul
|
||||
- for aspect in aspects_with_person
|
||||
%li{:data=>{:guid=>aspect.id}}
|
||||
%span.name
|
||||
= link_to aspect.name, aspect
|
||||
.right
|
||||
= aspect_membership_button(aspect.id, contact, person)
|
||||
|
||||
- for aspect in aspects_without_person
|
||||
%li{:data=>{:guid=>aspect.id}}
|
||||
%span.name
|
||||
= link_to aspect.name, aspect
|
||||
.right
|
||||
= aspect_membership_button(aspect.id, contact, person)
|
||||
|
||||
18
app/views/people/share_with.html.haml
Normal file
18
app/views/people/share_with.html.haml
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
-# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
-# licensed under the Affero General Public License version 3 or later. See
|
||||
-# the COPYRIGHT file.
|
||||
|
||||
#share_with
|
||||
.share_with_header
|
||||
= person_image_link(@person, :size => :thumb_medium)
|
||||
%h3
|
||||
= "Start sharing with #{@person.name}"
|
||||
%p
|
||||
= "Once #{@person.first_name} accepts, you'll start seeing each other's posts on Diaspora"
|
||||
|
||||
= render :partial => 'share_with_pane',
|
||||
:locals => {:person => @person,
|
||||
:contact => @contact,
|
||||
:aspects_with_person => @aspects_with_person,
|
||||
:aspects_without_person => @aspects_without_person}
|
||||
|
||||
|
|
@ -227,6 +227,27 @@ describe AspectsController do
|
|||
end
|
||||
|
||||
describe "#add_to_aspect" do
|
||||
context 'with an incoming request' do
|
||||
before do
|
||||
@user3 = make_user
|
||||
@user3.send_contact_request_to(@user.person, @user3.aspects.create(:name => "Walruses"))
|
||||
end
|
||||
it 'deletes the request' do
|
||||
post 'add_to_aspect',
|
||||
:format => 'js',
|
||||
:person_id => @user3.person.id,
|
||||
:aspect_id => @aspect1.id
|
||||
Request.from(@user3).to(@user).first.should be_nil
|
||||
end
|
||||
it 'does not leave the contact pending' do
|
||||
post 'add_to_aspect',
|
||||
:format => 'js',
|
||||
:person_id => @user3.person.id,
|
||||
:aspect_id => @aspect1.id
|
||||
@user.contact_for(@user3.person).should_not be_pending
|
||||
|
||||
end
|
||||
end
|
||||
context 'with a non-contact' do
|
||||
before do
|
||||
@person = Factory(:person)
|
||||
|
|
|
|||
Loading…
Reference in a new issue