Fix people socketing

This commit is contained in:
Raphael Sofaer 2011-07-21 13:41:46 -07:00
parent 333e56b4d9
commit 8eea37cbdb
3 changed files with 12 additions and 10 deletions

View file

@ -29,8 +29,8 @@ class PeopleController < ApplicationController
format.all do format.all do
#only do it if it is an email address #only do it if it is an email address
if params[:q].try(:match, Devise.email_regexp) if params[:q].try(:match, Devise.email_regexp)
webfinger(params[:q])
people = Person.where(:diaspora_handle => params[:q]) people = Person.where(:diaspora_handle => params[:q])
webfinger(params[:q]) if people.empty?
else else
people = Person.search(params[:q], current_user) people = Person.search(params[:q], current_user)
end end

View file

@ -20,16 +20,16 @@
= params[:q] = params[:q]
.span-15.append-1 .span-15.append-1
- if @hashes.empty? #people_stream.stream
%p - if @hashes.empty?
=t('.no_one_found') %p
=t('.no_one_found')
- else - else
#people_stream.stream
- for hash in @hashes - for hash in @hashes
= render :partial => 'people/person', :locals => hash = render :partial => 'people/person', :locals => hash
= will_paginate @people = will_paginate @people
.span-8.last .span-8.last
%h4 %h4

View file

@ -54,7 +54,7 @@ var WebSocketReceiver = {
WebSocketReceiver.processLike(obj.post_id, obj.html); WebSocketReceiver.processLike(obj.post_id, obj.html);
} else { } else {
WebSocketReceiver.processPost(obj['class'], obj.post_id, obj.html, obj.aspect_ids); WebSocketReceiver.processPost(obj.html, obj.aspect_ids);
} }
} }
}, },
@ -67,7 +67,9 @@ var WebSocketReceiver = {
result_ul.siblings('.error').show(); result_ul.siblings('.error').show();
result_ul.find('.error').text(response.response).show(); result_ul.find('.error').text(response.response).show();
} else { } else {
$('#people_stream').prepend(response.html).slideDown('slow', function(){}); stream = $('#people_stream');
stream.find('p').remove();
stream.prepend(response.html).slideDown('slow', function(){});
var first_li = result_ul.find('li:first'); var first_li = result_ul.find('li:first');
first_li.hide(); first_li.hide();
first_li.after(response.html); first_li.after(response.html);
@ -131,7 +133,7 @@ var WebSocketReceiver = {
$('.likes', "#" + targetGUID).first().html(html); $('.likes', "#" + targetGUID).first().html(html);
}, },
processPost: function(className, postId, html, aspectIds) { processPost: function(html, aspectIds) {
if(WebSocketReceiver.onPageForAspects(aspectIds)) { if(WebSocketReceiver.onPageForAspects(aspectIds)) {
ContentUpdater.addPostToStream(html); ContentUpdater.addPostToStream(html);
} }