Merge branch 'master' of github.com:diaspora/diaspora

This commit is contained in:
maxwell 2010-11-18 15:36:47 -08:00
commit c0d10ef174
6 changed files with 24 additions and 5 deletions

View file

@ -36,7 +36,7 @@ class PeopleController < ApplicationController
if @contact
@aspects_with_person = @contact.aspects
else
@pending_request = current_user.pending_requests.find_by_person_id(@person.id)
@pending_request = current_user.request_for(@person)
end
@posts = current_user.visible_posts(:person_id => @person.id).paginate :page => params[:page], :order => 'created_at DESC'

View file

@ -15,7 +15,7 @@
= t('.thats_you')
- elsif current_user.person_objects.include?(person)
= t('.already_connected')
- elsif current_user.pending_requests.find_by_person_id(person.id)
- elsif current_user.request_for(person)
= link_to =t('.pending_request'), aspects_manage_path
- else
- single_aspect_form ||= nil

View file

@ -44,7 +44,7 @@
= image_tag("social_media_logos/feed-16x16.png")
- if current_user.services
- for service in current_user.services
= image_tag("social_media_logos/#{service.provider}-24x24.png")
= image_tag("social_media_logos/#{service.provider}-16x16.png")
= link_to '(?)', "#question_mark_pane", :class => 'question_mark', :style=>"display:none;"

View file

@ -7,5 +7,6 @@ SOCKET_PORT=8080
# See thin -h for possible values.
DEFAULT_THIN_ARGS="-p $THIN_PORT"
# Uncomment to run in production mode.
#export RAILS_ENV="production rails server"
# Uncomment to run in production/test mode.
# DEFAULT_THIN_ARGs="$DEFAULT_THIN_ARGS -e production"
# DEFAULT_THIN_ARGs="$DEFAULT_THIN_ARGS -e test"

View file

@ -84,6 +84,9 @@ module Diaspora
self.aspects.all.collect{|x| x.id}
end
def request_for(to_person)
Request.first(:from_id => self.person.id, :to_id => to_person.id).first
end
end
end
end

View file

@ -173,4 +173,19 @@ describe User do
end
end
describe "#request_for" do
let!(:user5) {make_user}
it 'should not have a pending request before connecting' do
request = user.request_for(user5.person)
request.should be_nil
end
it 'should have a pending request after sending a request' do
user.send_contact_request_to(user5.person, user.aspects.first)
request = user.reload.request_for(user5.person)
request.should_not be_nil
end
end
end