Add error messages for friending from aspect-manage
This commit is contained in:
parent
2d347ec36d
commit
e2412d2e43
5 changed files with 19 additions and 10 deletions
|
|
@ -109,7 +109,7 @@ class PeopleController < ApplicationController
|
||||||
response.socket_to_uid(current_user.id, opts)
|
response.socket_to_uid(current_user.id, opts)
|
||||||
else
|
else
|
||||||
require File.join(Rails.root,'lib/diaspora/websocket')
|
require File.join(Rails.root,'lib/diaspora/websocket')
|
||||||
Diaspora::WebSocket.queue_to_user(current_user.id, {:class => 'person', :query => account, :response => response})
|
Diaspora::WebSocket.queue_to_user(current_user.id, {:class => 'people', :status => 'fail', :query => account, :response => response}.to_json)
|
||||||
end
|
end
|
||||||
rescue RuntimeError => e
|
rescue RuntimeError => e
|
||||||
puts e.message
|
puts e.message
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,13 @@
|
||||||
processNotification(obj['notice']);
|
processNotification(obj['notice']);
|
||||||
|
|
||||||
}else if (obj['class'] == 'people'){
|
}else if (obj['class'] == 'people'){
|
||||||
|
$('#loader').hide();
|
||||||
debug("got a " + obj['class']);
|
debug("got a " + obj['class']);
|
||||||
processPerson(obj['html']);
|
if(obj['status'] == 'fail'){
|
||||||
|
$('#request_result li:first').text(obj['response']).show();
|
||||||
|
}else{
|
||||||
|
processPerson(obj['html']);
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
debug("got a " + obj['class'] + " for aspects " + obj['aspect_ids']);
|
debug("got a " + obj['class'] + " for aspects " + obj['aspect_ids']);
|
||||||
|
|
||||||
|
|
@ -34,22 +39,20 @@
|
||||||
processPost(obj['class'], obj['html'], obj['aspect_ids'])
|
processPost(obj['class'], obj['html'], obj['aspect_ids'])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
ws.onclose = function() { debug("socket closed"); };
|
ws.onclose = function() { debug("socket closed"); };
|
||||||
ws.onopen = function() {
|
ws.onopen = function() {
|
||||||
ws.send(location.pathname);
|
ws.send(location.pathname);
|
||||||
debug("connected...");
|
debug("connected...");
|
||||||
};
|
};
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function processPerson(html){
|
function processPerson(html){
|
||||||
$('.people#stream').prepend(html).slideDown('slow', function(){});
|
$('.people#stream').prepend(html).slideDown('slow', function(){});
|
||||||
var rr = $('#request_result');
|
var rr = $('#request_result li:first');
|
||||||
rr.prepend(html).hide();
|
rr.after(html);
|
||||||
$("#request_result [name='into']").val(rr.attr('aspect_id'));
|
$("#request_result [name='into']").val(rr.attr('aspect_id'));
|
||||||
rr.slideDown('fast', function(){});
|
$('#request_result :nth-child(2)').slideDown('fast', function(){});
|
||||||
}
|
}
|
||||||
|
|
||||||
function processNotification(html){
|
function processNotification(html){
|
||||||
|
|
@ -82,7 +85,6 @@
|
||||||
if( !opts['mine?'] && opts['my_post?']) {
|
if( !opts['mine?'] && opts['my_post?']) {
|
||||||
processNotification(opts['notification']);
|
processNotification(opts['notification']);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function processPost(className, html, aspectIds){
|
function processPost(className, html, aspectIds){
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
.span-7.last
|
.span-7.last
|
||||||
%h3 Add a new contact
|
%h3 Add a new contact
|
||||||
= form_tag(person_by_handle_path, :id => "new_request_to_#{aspect.id}", :remote => true) do
|
= form_tag(person_by_handle_path, :id => "new_request_to_#{aspect.id}", :class => "webfinger_form", :remote => true) do
|
||||||
=t('.enter_a_diaspora_username')
|
=t('.enter_a_diaspora_username')
|
||||||
%br
|
%br
|
||||||
%i= t '.your_diaspora_username_is', :diaspora_handle => current_user.diaspora_handle
|
%i= t '.your_diaspora_username_is', :diaspora_handle => current_user.diaspora_handle
|
||||||
|
|
@ -30,5 +30,6 @@
|
||||||
|
|
||||||
= submit_tag t('.create_request')
|
= submit_tag t('.create_request')
|
||||||
%br
|
%br
|
||||||
|
#loader.hidden= image_tag 'ajax-loader.gif'
|
||||||
%ul#request_result{:aspect_id => aspect.id}
|
%ul#request_result{:aspect_id => aspect.id}
|
||||||
|
%li.error.hidden
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,10 @@ $(document).ready(function(){
|
||||||
$(".person img", ".dropzone").tipsy({live:true});
|
$(".person img", ".dropzone").tipsy({live:true});
|
||||||
$(".avatar", ".aspects").tipsy({live:true});
|
$(".avatar", ".aspects").tipsy({live:true});
|
||||||
|
|
||||||
|
$('.webfinger_form').submit(function(){
|
||||||
|
$('#loader').show();
|
||||||
|
$('#request_result li:first').hide();
|
||||||
|
});
|
||||||
});//end document ready
|
});//end document ready
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,8 @@ h1, h2, h3, h4
|
||||||
h3
|
h3
|
||||||
:font
|
:font
|
||||||
:size 18px
|
:size 18px
|
||||||
|
.hidden
|
||||||
|
:display none
|
||||||
|
|
||||||
.avatar
|
.avatar
|
||||||
:width 50px
|
:width 50px
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue