Merge branch 'master' of github.com:diaspora/diaspora
This commit is contained in:
commit
5a2b42e4e5
12 changed files with 26 additions and 61 deletions
|
|
@ -18,7 +18,7 @@ class Album
|
|||
validates_presence_of :name, :person
|
||||
|
||||
before_destroy :destroy_photos
|
||||
after_save :notify_people
|
||||
|
||||
before_destroy :propagate_retraction
|
||||
|
||||
def self.instantiate params
|
||||
|
|
|
|||
|
|
@ -55,15 +55,6 @@ class Person
|
|||
encryption_key.public_key.export
|
||||
end
|
||||
|
||||
##profile
|
||||
def update_profile(params)
|
||||
if self.update_attributes(params)
|
||||
self.profile.notify_people!
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
def owns?(post)
|
||||
self.id == post.person.id
|
||||
|
|
|
|||
|
|
@ -49,19 +49,21 @@ class User
|
|||
post = model_class.instantiate(options)
|
||||
post.creator_signature = post.sign_with_key(encryption_key)
|
||||
post.save
|
||||
post.notify_people
|
||||
|
||||
|
||||
if group_id
|
||||
group = self.groups.find_by_id(group_id)
|
||||
group.posts << post
|
||||
group.save
|
||||
post.push_to( group.people.all )
|
||||
else
|
||||
post.push_to( self.friends.all )
|
||||
end
|
||||
|
||||
post.socket_to_uid(id) if post.respond_to?(:socket_to_uid)
|
||||
|
||||
self.raw_visible_posts << post
|
||||
self.save
|
||||
|
||||
if group_id
|
||||
group = self.groups.find_by_id(group_id)
|
||||
group.posts << post
|
||||
group.save
|
||||
end
|
||||
|
||||
post
|
||||
end
|
||||
|
||||
|
|
@ -104,10 +106,20 @@ class User
|
|||
post.unsocket_from_uid(self.id) if post.respond_to? :unsocket_from_uid
|
||||
retraction = Retraction.for(post)
|
||||
retraction.creator_signature = retraction.sign_with_key( encryption_key )
|
||||
retraction.notify_people
|
||||
retraction.push_to( self.friends.all )
|
||||
retraction
|
||||
end
|
||||
|
||||
########### Profile ######################
|
||||
def update_profile(params)
|
||||
if self.person.update_attributes(params)
|
||||
self.profile.push_to( self.friends.all )
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
######### Friend Requesting ###########
|
||||
def send_friend_request_to(friend_url, group_id)
|
||||
unless self.friends.detect{ |x| x.receive_url == friend_url}
|
||||
|
|
|
|||
|
|
@ -24,8 +24,6 @@
|
|||
= csrf_meta_tag
|
||||
= yield(:head)
|
||||
|
||||
/= javascript_include_tag 'satisfaction' , 'satisfaction-display'
|
||||
|
||||
= javascript_include_tag 'jquery.html5_upload'
|
||||
|
||||
%body
|
||||
|
|
|
|||
|
|
@ -6,16 +6,6 @@ module Diaspora
|
|||
|
||||
@@queue = MessageHandler.new
|
||||
|
||||
def notify_people
|
||||
unless self.person.owner.nil?
|
||||
push_to(people_with_permissions)
|
||||
end
|
||||
end
|
||||
|
||||
def notify_people!
|
||||
push_to(people_with_permissions)
|
||||
end
|
||||
|
||||
def push_to(recipients)
|
||||
unless recipients.empty?
|
||||
recipients.map!{|x| x = x.receive_url }
|
||||
|
|
|
|||
|
|
@ -1074,4 +1074,4 @@
|
|||
fancybox_init();
|
||||
});
|
||||
|
||||
})(jQuery);
|
||||
})(jQuery);
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
var feedback_widget_options = {};
|
||||
|
||||
feedback_widget_options.display = "overlay";
|
||||
feedback_widget_options.company = "diaspora";
|
||||
feedback_widget_options.placement = "right";
|
||||
feedback_widget_options.color = "#222";
|
||||
feedback_widget_options.style = "idea";
|
||||
|
||||
|
||||
var feedback_widget = new GSFN.feedback_widget(feedback_widget_options);
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
var is_ssl = ("https:" == document.location.protocol);
|
||||
var asset_host = is_ssl ? "https://s3.amazonaws.com/getsatisfaction.com/" : "http://s3.amazonaws.com/getsatisfaction.com/";
|
||||
document.write(unescape("%3Cscript src='" + asset_host + "javascripts/feedback-v2.js' type='text/javascript'%3E%3C/script%3E"));
|
||||
|
|
@ -85,7 +85,7 @@ $(document).ready(function(){
|
|||
|
||||
$("#add_album_button").fancybox();
|
||||
$("#add_group_button").fancybox();
|
||||
$("#add_request_button").fancybox();
|
||||
$("#add_request_button").fancybox({ 'titleShow': false });
|
||||
$("#add_photo_button").fancybox();
|
||||
|
||||
//pane_toggler_button("photo");
|
||||
|
|
|
|||
|
|
@ -17,20 +17,7 @@ describe Diaspora do
|
|||
end
|
||||
|
||||
it "should add the following methods to Post on inclusion" do
|
||||
@post.respond_to?(:notify_people).should be true
|
||||
@post.respond_to?(:to_diaspora_xml).should be true
|
||||
@post.respond_to?(:people_with_permissions).should be true
|
||||
end
|
||||
|
||||
it "should retrieve all valid person endpoints" do
|
||||
@user.friends << Factory.create(:person, :url => "http://www.bob.com/")
|
||||
@user.friends << Factory.create(:person, :url => "http://www.alice.com/")
|
||||
@user.friends << Factory.create(:person, :url => "http://www.jane.com/")
|
||||
@user.save
|
||||
|
||||
@post.person.owner.reload
|
||||
|
||||
@post.people_with_permissions.should == @user.friends
|
||||
end
|
||||
|
||||
it "should send an owners post to their people" do
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ describe Comment do
|
|||
end
|
||||
|
||||
it 'should send a user comment on his own post to lots of people' do
|
||||
allowed_urls = @user_status.people_with_permissions.map{|x| x = x.receive_url}
|
||||
allowed_urls = @user.friends.map!{ |x| x = x.receive_url }
|
||||
message_queue.should_receive(:add_post_request).with(allowed_urls, anything)
|
||||
@user.comment "yo", :on => @user_status
|
||||
end
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ describe User do
|
|||
|
||||
message_queue.should_receive(:process)
|
||||
|
||||
@user.person.update_profile(updated_profile).should == true
|
||||
@user.update_profile(updated_profile).should == true
|
||||
@user.profile.image_url.should == "http://clown.com"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue