you can click on photos in manage aspects to see profiles
This commit is contained in:
parent
f4f864a4fb
commit
aa4a61870c
9 changed files with 82 additions and 25 deletions
|
|
@ -81,6 +81,12 @@ class User
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def has_incoming_request_from(person)
|
||||||
|
self.pending_requests.select do |req|
|
||||||
|
req.to_id == self.person.id
|
||||||
|
end.any? { |req| req.from_id == person.id }
|
||||||
|
end
|
||||||
|
|
||||||
######## Making things work ########
|
######## Making things work ########
|
||||||
key :email, String
|
key :email, String
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
.x
|
.x
|
||||||
X
|
X
|
||||||
.circle
|
.circle
|
||||||
= person_image_tag(request.from)
|
= person_image_link(request.from)
|
||||||
|
|
||||||
= render 'shared/invitations', :invites => @invites
|
= render 'shared/invitations', :invites => @invites
|
||||||
|
|
||||||
|
|
@ -53,7 +53,7 @@
|
||||||
.x
|
.x
|
||||||
X
|
X
|
||||||
.circle
|
.circle
|
||||||
= person_image_tag(contact.person)
|
= person_image_link(contact.person)
|
||||||
.draggable_info
|
.draggable_info
|
||||||
=t('.drag_to_add')
|
=t('.drag_to_add')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,14 @@
|
||||||
%li
|
%li
|
||||||
%h3= t('.no_posts')
|
%h3= t('.no_posts')
|
||||||
|
|
||||||
|
- elsif current_user.has_incoming_request_from(@person)
|
||||||
|
.floating
|
||||||
|
%h3
|
||||||
|
= t('.incoming_request')
|
||||||
|
%h4
|
||||||
|
= link_to t('.return_to_aspects'), aspects_manage_path
|
||||||
|
= t('.to_accept_or_ignore')
|
||||||
|
|
||||||
- else
|
- else
|
||||||
.floating
|
.floating
|
||||||
%h3
|
%h3
|
||||||
|
|
|
||||||
|
|
@ -292,6 +292,9 @@ en:
|
||||||
results_for: "search results for"
|
results_for: "search results for"
|
||||||
show:
|
show:
|
||||||
no_posts: "no posts to display!"
|
no_posts: "no posts to display!"
|
||||||
|
incoming_request: "You have an incoming request from this person."
|
||||||
|
return_to_aspects: "Return to your aspects page"
|
||||||
|
to_accept_or_ignore: "to accept or ignore it."
|
||||||
request_people: "If you'd like, you can request to place him/her in one of your aspects."
|
request_people: "If you'd like, you can request to place him/her in one of your aspects."
|
||||||
already_requested: "You have already sent a request to %{name}."
|
already_requested: "You have already sent a request to %{name}."
|
||||||
does_not_exist: "Person does not exist!"
|
does_not_exist: "Person does not exist!"
|
||||||
|
|
|
||||||
|
|
@ -5,20 +5,28 @@ Feature: managing contact requests
|
||||||
And I have an aspect called "Family"
|
And I have an aspect called "Family"
|
||||||
And I have one contact request
|
And I have one contact request
|
||||||
|
|
||||||
Scenario: seeing contact requests
|
Scenario: seeing contact request notifications
|
||||||
When I am on the home page
|
When I am on the home page
|
||||||
Then I should see "Home (1)" in the header
|
Then I should see "Home (1)" in the header
|
||||||
|
When I follow "Home (1)"
|
||||||
|
Then I should see "1 new request!"
|
||||||
|
|
||||||
|
@javascript
|
||||||
|
Scenario: viewing a request's profile
|
||||||
|
When I am on the aspects manage page
|
||||||
|
Then I should see 1 contact request
|
||||||
|
When I click on the contact request
|
||||||
|
And I wait for the request's profile page to load
|
||||||
|
Then I should be on the requestor's profile page
|
||||||
|
And I should see "You have an incoming request from this person"
|
||||||
|
|
||||||
@javascript
|
@javascript
|
||||||
Scenario: accepting a contact request
|
Scenario: accepting a contact request
|
||||||
When I am on the home page
|
When I am on the home page
|
||||||
And I follow "Home (1)"
|
And I follow "1 new request!"
|
||||||
Then I should see "1 new request!"
|
Then I should see 0 contacts in "Family"
|
||||||
And I should see 0 contacts in "Family"
|
|
||||||
|
|
||||||
When I am on the home page
|
When I drag the contact request to the "Family" aspect
|
||||||
Then I follow "1 new request!"
|
|
||||||
And I drag the contact request to the "Family" aspect
|
|
||||||
And I wait for the ajax to finish
|
And I wait for the ajax to finish
|
||||||
Then I should see 1 contact in "Family"
|
Then I should see 1 contact in "Family"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,10 @@ When /^I wait for the aspects page to load$/ do
|
||||||
wait_until { current_path == aspects_path }
|
wait_until { current_path == aspects_path }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
When /^I wait for the request's profile page to load$/ do
|
||||||
|
wait_until { current_path == person_path(@me.reload.pending_requests.first.from) }
|
||||||
|
end
|
||||||
|
|
||||||
When /^I wait for the ajax to finish$/ do
|
When /^I wait for the ajax to finish$/ do
|
||||||
wait_until { evaluate_script("$.active") == 0 }
|
wait_until { evaluate_script("$.active") == 0 }
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -48,3 +48,7 @@ When /^I click "X" on the contact request$/ do
|
||||||
$(".person.request.ui-draggable .delete").hover().click();
|
$(".person.request.ui-draggable .delete").hover().click();
|
||||||
JS
|
JS
|
||||||
end
|
end
|
||||||
|
|
||||||
|
When /^I click on the contact request$/ do
|
||||||
|
find(".person.request.ui-draggable a").click
|
||||||
|
end
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,8 @@ module NavigationHelpers
|
||||||
send("#{$1.gsub(/\W+/, '_')}_path")
|
send("#{$1.gsub(/\W+/, '_')}_path")
|
||||||
when /^my edit profile page$/
|
when /^my edit profile page$/
|
||||||
edit_person_path(@me.person)
|
edit_person_path(@me.person)
|
||||||
|
when /^the requestor's profile page$/
|
||||||
|
person_path(@me.reload.pending_requests.first.from)
|
||||||
when /^"(\/.*)"/
|
when /^"(\/.*)"/
|
||||||
$1
|
$1
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,28 @@ describe User do
|
||||||
user.encryption_key.should_not be nil
|
user.encryption_key.should_not be nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "#has_incoming_request_from" do
|
||||||
|
it "returns true if the user has an incoming request from the person" do
|
||||||
|
user2.send_contact_request_to(user.person, aspect2)
|
||||||
|
|
||||||
|
user.reload
|
||||||
|
user2.reload
|
||||||
|
|
||||||
|
user.has_incoming_request_from(user2.person).should be_true
|
||||||
|
end
|
||||||
|
it "returns false if the user does not have an incoming request from the person" do
|
||||||
|
user.has_incoming_request_from(user2.person).should be_false
|
||||||
|
end
|
||||||
|
it "returns false if the user has requested to be contacts with the person" do
|
||||||
|
user.send_contact_request_to(user2.person, aspect)
|
||||||
|
|
||||||
|
user.reload
|
||||||
|
user2.reload
|
||||||
|
|
||||||
|
user.has_incoming_request_from(user2.person).should be_false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe 'overwriting people' do
|
describe 'overwriting people' do
|
||||||
it 'does not overwrite old users with factory' do
|
it 'does not overwrite old users with factory' do
|
||||||
pending "Why do you want to set ids directly? MONGOMAPPERRRRR!!!"
|
pending "Why do you want to set ids directly? MONGOMAPPERRRRR!!!"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue