parent
e712e4c92f
commit
4b3f36e92a
6 changed files with 38 additions and 14 deletions
|
|
@ -15,9 +15,15 @@ var List = {
|
||||||
});
|
});
|
||||||
|
|
||||||
streamEl.html(string);
|
streamEl.html(string);
|
||||||
$('.aspect_membership_dropdown').each(function(){
|
|
||||||
new app.views.AspectMembership({el: this});
|
if (data.contacts) {
|
||||||
});
|
var contacts = new app.collections.Contacts(data.contacts);
|
||||||
|
$(".aspect_membership_dropdown.placeholder").each(function() {
|
||||||
|
var personId = $(this).data("personId");
|
||||||
|
var view = new app.views.AspectMembership({person: contacts.findWhere({"person_id": personId}).person});
|
||||||
|
$(this).html(view.render().$el);
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
startSearchDelay: function (theSearch) {
|
startSearchDelay: function (theSearch) {
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ class PeopleController < ApplicationController
|
||||||
self.formats = self.formats + [:html]
|
self.formats = self.formats + [:html]
|
||||||
@answer_html = render_to_string :partial => 'people/person', :locals => @hashes.first
|
@answer_html = render_to_string :partial => 'people/person', :locals => @hashes.first
|
||||||
end
|
end
|
||||||
render :json => { :search_count => @people.count, :search_html => @answer_html }.to_json
|
render json: {search_html: @answer_html, contacts: gon.preloads[:contacts]}.to_json
|
||||||
end
|
end
|
||||||
|
|
||||||
# renders the persons user profile page
|
# renders the persons user profile page
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,13 @@ Scenario: search for a inexistent user and go to the search page
|
||||||
|
|
||||||
Then I should see "Users matching Trinity" within "#search_title"
|
Then I should see "Users matching Trinity" within "#search_title"
|
||||||
|
|
||||||
|
Scenario: search for a user in background
|
||||||
|
When I sign in as "bob@bob.bob"
|
||||||
|
And I search for "user@pod.tld"
|
||||||
|
And a person with ID "user@pod.tld" has been discovered
|
||||||
|
Then I should see "user@pod.tld" within ".stream .info.diaspora_handle"
|
||||||
|
And I should see a ".aspect_dropdown" within ".stream"
|
||||||
|
|
||||||
Scenario: search for a not searchable user
|
Scenario: search for a not searchable user
|
||||||
When I sign in as "carol@example.com"
|
When I sign in as "carol@example.com"
|
||||||
And I go to the edit profile page
|
And I go to the edit profile page
|
||||||
|
|
|
||||||
|
|
@ -229,3 +229,7 @@ end
|
||||||
Then /^I should get a zipped file$/ do
|
Then /^I should get a zipped file$/ do
|
||||||
expect(page.response_headers["Content-Type"]).to eq("application/zip")
|
expect(page.response_headers["Content-Type"]).to eq("application/zip")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
And /^a person with ID "([^\"]*)" has been discovered$/ do |diaspora_id|
|
||||||
|
FactoryGirl.create(:person, diaspora_handle: diaspora_id)
|
||||||
|
end
|
||||||
|
|
|
||||||
|
|
@ -26,4 +26,10 @@ module Workers
|
||||||
# don't post to services in cucumber
|
# don't post to services in cucumber
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
class FetchWebfinger < Base
|
||||||
|
def perform(*_args)
|
||||||
|
# don't do real discovery in cucumber
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -472,19 +472,20 @@ describe PeopleController, :type => :controller do
|
||||||
:profile => FactoryGirl.build(:profile, :first_name => "Evan", :last_name => "Korth"))
|
:profile => FactoryGirl.build(:profile, :first_name => "Evan", :last_name => "Korth"))
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'via json' do
|
describe "via json" do
|
||||||
it 'returns a zero count when a search fails' do
|
it "returns no data when a search fails" do
|
||||||
get :refresh_search, :q => "weweweKorth", :format => 'json'
|
get :refresh_search, q: "weweweKorth", format: "json"
|
||||||
expect(response.body).to eq({:search_count=>0, :search_html=>""}.to_json)
|
expect(response.body).to eq({search_html: "", contacts: nil}.to_json)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'returns with a zero count unless a fully composed name is sent' do
|
it "returns no data unless a fully composed name is sent" do
|
||||||
get :refresh_search, :q => "Korth"
|
get :refresh_search, q: "Korth"
|
||||||
expect(response.body).to eq({:search_count=>0, :search_html=>""}.to_json)
|
expect(response.body).to eq({search_html: "", contacts: nil}.to_json)
|
||||||
end
|
end
|
||||||
it 'returns with a found name' do
|
|
||||||
get :refresh_search, :q => @korth.diaspora_handle
|
it "returns with a found name" do
|
||||||
expect(JSON.parse( response.body )["search_count"]).to eq(1)
|
get :refresh_search, q: @korth.diaspora_handle
|
||||||
|
expect(JSON.parse(response.body)["contacts"].size).to eq(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue