Merge remote branch 'upstream/master'
This commit is contained in:
commit
570d0cf104
9 changed files with 83 additions and 40 deletions
|
|
@ -62,5 +62,5 @@
|
||||||
.span-24.last
|
.span-24.last
|
||||||
= yield
|
= yield
|
||||||
|
|
||||||
.span-19.prepend-5.last
|
.span-24.last
|
||||||
= render "posts/debug"
|
= render "posts/debug"
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,7 @@
|
||||||
|
|
||||||
%br
|
%br
|
||||||
%br
|
%br
|
||||||
= render "albums/album", :post => post.album, :current_user => current_user
|
= link_to (image_tag post.url(:thumb_large)), object_path(post)
|
||||||
= link_to (image_tag post.url(:thumb_medium)), object_path(post)
|
|
||||||
|
|
||||||
.info
|
.info
|
||||||
%span.time= link_to(how_long_ago(post), photo_path(post))
|
%span.time= link_to(how_long_ago(post), photo_path(post))
|
||||||
|
|
|
||||||
|
|
@ -2,14 +2,22 @@
|
||||||
-# licensed under the Affero General Public License version 3 or later. See
|
-# licensed under the Affero General Public License version 3 or later. See
|
||||||
-# the COPYRIGHT file.
|
-# the COPYRIGHT file.
|
||||||
|
|
||||||
%h1
|
.span-14.append-1.last
|
||||||
= link_to @status_message.person.real_name, @status_message.person
|
#stream
|
||||||
= @status_message.message
|
%h1.show_text
|
||||||
|
= person_image_link(@status_message.person)
|
||||||
|
= link_to @status_message.person.real_name, @status_message.person
|
||||||
|
= make_links(@status_message.message)
|
||||||
|
|
||||||
%h4= "#{t('.comments')} (#{@status_message.comments.count})"
|
= "Posted #{how_long_ago(@status_message)} to"
|
||||||
|
- for aspect in current_user.aspects_with_post( @status_message.id )
|
||||||
|
= link_to aspect.name, aspect
|
||||||
|
|
||||||
= render "comments/comments", :post => @status_message
|
|
||||||
|
|
||||||
%p
|
|
||||||
- if current_user.owns? @status_message
|
- if current_user.owns? @status_message
|
||||||
= link_to t('.destroy'), @status_message, :confirm => t('are_you_sure?'), :method => :delete
|
%p
|
||||||
|
= link_to t('.destroy'), @status_message, :confirm => t('.are_you_sure'), :method => :delete
|
||||||
|
|
||||||
|
.span-9.last
|
||||||
|
#stream.show
|
||||||
|
%li.message{:id => @status_message.id}
|
||||||
|
= render "comments/comments", :post => @status_message
|
||||||
|
|
|
||||||
|
|
@ -17,17 +17,23 @@ module Diaspora
|
||||||
sender_in_xml = sender(object, xml)
|
sender_in_xml = sender(object, xml)
|
||||||
|
|
||||||
if (salmon_author == sender_in_xml)
|
if (salmon_author == sender_in_xml)
|
||||||
if object.is_a? Retraction
|
|
||||||
receive_retraction object, xml
|
if object.is_a? Request
|
||||||
elsif object.is_a? Request
|
|
||||||
receive_request object, sender_in_xml
|
receive_request object, sender_in_xml
|
||||||
elsif object.is_a? Profile
|
elsif self.friend_ids.include? salmon_author.id
|
||||||
receive_profile object, xml
|
if object.is_a? Retraction
|
||||||
elsif object.is_a?(Comment)
|
receive_retraction object, xml
|
||||||
receive_comment object, xml
|
elsif object.is_a? Profile
|
||||||
|
receive_profile object, xml
|
||||||
|
elsif object.is_a?(Comment)
|
||||||
|
receive_comment object, xml
|
||||||
|
else
|
||||||
|
receive_post object, xml
|
||||||
|
end
|
||||||
else
|
else
|
||||||
receive_post object, xml
|
raise "Not friends with that person"
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
raise "Malicious Post, #{salmon_author.real_name} with id #{salmon_author.id} is sending a #{object.class} as #{sender_in_xml.real_name} with id #{sender_in_xml.id} "
|
raise "Malicious Post, #{salmon_author.real_name} with id #{salmon_author.id} is sending a #{object.class} as #{sender_in_xml.real_name} with id #{sender_in_xml.id} "
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -179,14 +179,13 @@ header
|
||||||
:margin
|
:margin
|
||||||
:left 425px
|
:left 425px
|
||||||
|
|
||||||
ul#stream
|
#stream
|
||||||
:margin 0
|
:margin 0
|
||||||
:padding 0
|
:padding 0
|
||||||
> li
|
> li
|
||||||
:min-height 50px
|
:min-height 50px
|
||||||
:list-style none
|
:list-style none
|
||||||
:padding 12px 0
|
:padding 12px 0
|
||||||
:right 12px
|
|
||||||
:border
|
:border
|
||||||
:bottom 1px solid #eee
|
:bottom 1px solid #eee
|
||||||
|
|
||||||
|
|
@ -404,6 +403,20 @@ form
|
||||||
:margin
|
:margin
|
||||||
:right 1em
|
:right 1em
|
||||||
|
|
||||||
|
#stream.show
|
||||||
|
div.comments
|
||||||
|
:display block
|
||||||
|
ul.comment_set
|
||||||
|
:margin
|
||||||
|
:top 0
|
||||||
|
> li
|
||||||
|
:border none
|
||||||
|
:padding 0
|
||||||
|
&:hover
|
||||||
|
> li
|
||||||
|
:background none
|
||||||
|
:border none
|
||||||
|
|
||||||
|
|
||||||
#stream div.comments
|
#stream div.comments
|
||||||
:display none
|
:display none
|
||||||
|
|
@ -1066,3 +1079,7 @@ header
|
||||||
:font
|
:font
|
||||||
:size small
|
:size small
|
||||||
|
|
||||||
|
.show_text
|
||||||
|
img
|
||||||
|
:height 27px
|
||||||
|
:width 27px
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,8 @@ describe PublicsController do
|
||||||
render_views
|
render_views
|
||||||
let(:user) {Factory.create :user}
|
let(:user) {Factory.create :user}
|
||||||
let(:user2){Factory.create :user}
|
let(:user2){Factory.create :user}
|
||||||
|
let(:aspect1){user.aspect(:name => "foo")}
|
||||||
|
let(:aspect2){user2.aspect(:name => "far")}
|
||||||
before do
|
before do
|
||||||
sign_in :user, user
|
sign_in :user, user
|
||||||
end
|
end
|
||||||
|
|
@ -21,7 +22,8 @@ describe PublicsController do
|
||||||
|
|
||||||
it 'should accept a post from another node and save the information' do
|
it 'should accept a post from another node and save the information' do
|
||||||
message = user2.build_post(:status_message, :message => "hi")
|
message = user2.build_post(:status_message, :message => "hi")
|
||||||
|
friend_users(user, aspect1, user2, aspect2)
|
||||||
|
|
||||||
user.reload
|
user.reload
|
||||||
user.visible_post_ids.include?(message.id).should be false
|
user.visible_post_ids.include?(message.id).should be false
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,8 @@ describe Diaspora::Parser do
|
||||||
@user3 = Factory.create :user
|
@user3 = Factory.create :user
|
||||||
@person = @user3.person
|
@person = @user3.person
|
||||||
@user2 = Factory.create(:user)
|
@user2 = Factory.create(:user)
|
||||||
|
@aspect2 = @user2.aspect(:name => "pandas")
|
||||||
|
friend_users(@user, @aspect, @user2, @aspect2)
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "parsing compliant XML object" do
|
describe "parsing compliant XML object" do
|
||||||
|
|
@ -49,7 +51,7 @@ describe Diaspora::Parser do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should marshal retractions' do
|
it 'should marshal retractions' do
|
||||||
person = Factory.create(:person)
|
person = @user2.person
|
||||||
message = Factory.create(:status_message, :person => person)
|
message = Factory.create(:status_message, :person => person)
|
||||||
retraction = Retraction.for(message)
|
retraction = Retraction.for(message)
|
||||||
xml = retraction.to_diaspora_xml
|
xml = retraction.to_diaspora_xml
|
||||||
|
|
@ -95,17 +97,17 @@ describe Diaspora::Parser do
|
||||||
end
|
end
|
||||||
|
|
||||||
it "should activate the Person if I initiated a request to that url" do
|
it "should activate the Person if I initiated a request to that url" do
|
||||||
request = @user.send_friend_request_to( @user2.person, @aspect)
|
request = @user.send_friend_request_to( @user3.person, @aspect)
|
||||||
@user.reload
|
@user.reload
|
||||||
request.reverse_for @user2
|
request.reverse_for @user3
|
||||||
|
|
||||||
xml = request.to_diaspora_xml
|
xml = request.to_diaspora_xml
|
||||||
|
|
||||||
@user2.person.destroy
|
@user3.person.destroy
|
||||||
@user2.destroy
|
@user3.destroy
|
||||||
|
|
||||||
@user.receive xml, @user2.person
|
@user.receive xml, @user3.person
|
||||||
new_person = Person.first(:url => @user2.person.url)
|
new_person = Person.first(:url => @user3.person.url)
|
||||||
new_person.nil?.should be false
|
new_person.nil?.should be false
|
||||||
|
|
||||||
@user.reload
|
@user.reload
|
||||||
|
|
@ -115,18 +117,20 @@ describe Diaspora::Parser do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should process retraction for a person' do
|
it 'should process retraction for a person' do
|
||||||
|
user4 = Factory(:user)
|
||||||
|
|
||||||
person_count = Person.all.count
|
person_count = Person.all.count
|
||||||
request = @user.send_friend_request_to( @user2.person, @aspect)
|
request = @user.send_friend_request_to( user4.person, @aspect)
|
||||||
@user.reload
|
@user.reload
|
||||||
request.reverse_for @user2
|
request.reverse_for user4
|
||||||
xml = request.to_diaspora_xml
|
xml = request.to_diaspora_xml
|
||||||
|
|
||||||
retraction = Retraction.for(@user2)
|
retraction = Retraction.for(user4)
|
||||||
retraction_xml = retraction.to_diaspora_xml
|
retraction_xml = retraction.to_diaspora_xml
|
||||||
|
|
||||||
@user2.person.destroy
|
user4.person.destroy
|
||||||
@user2.destroy
|
user4.destroy
|
||||||
@user.receive xml, @user2.person
|
@user.receive xml, user4.person
|
||||||
|
|
||||||
|
|
||||||
@aspect.reload
|
@aspect.reload
|
||||||
|
|
@ -134,7 +138,7 @@ describe Diaspora::Parser do
|
||||||
#They are now friends
|
#They are now friends
|
||||||
|
|
||||||
Person.count.should == person_count
|
Person.count.should == person_count
|
||||||
@user.receive retraction_xml, @user2.person
|
@user.receive retraction_xml, user4.person
|
||||||
|
|
||||||
|
|
||||||
@aspect.reload
|
@aspect.reload
|
||||||
|
|
@ -143,7 +147,7 @@ describe Diaspora::Parser do
|
||||||
|
|
||||||
it 'should marshal a profile for a person' do
|
it 'should marshal a profile for a person' do
|
||||||
#Create person
|
#Create person
|
||||||
person = Factory.create(:person)
|
person = @user2.person
|
||||||
id = person.id
|
id = person.id
|
||||||
person.profile = Profile.new(:first_name => 'bob', :last_name => 'billytown', :image_url => "http://clown.com")
|
person.profile = Profile.new(:first_name => 'bob', :last_name => 'billytown', :image_url => "http://clown.com")
|
||||||
person.save
|
person.save
|
||||||
|
|
|
||||||
|
|
@ -102,10 +102,18 @@ describe Photo do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should set the remote_photo on marshalling' do
|
it 'should set the remote_photo on marshalling' do
|
||||||
|
pending "did the socket get unstubbed?"
|
||||||
@photo.image.store! File.open(@fixture_name)
|
@photo.image.store! File.open(@fixture_name)
|
||||||
|
|
||||||
|
|
||||||
|
#security hax
|
||||||
|
user2 = Factory.create(:user)
|
||||||
|
aspect2 = user2.aspect(:name => "foobars")
|
||||||
|
friend_users(@user, @aspect, user2, aspect2)
|
||||||
|
@photo.person = user2.person
|
||||||
|
|
||||||
@photo.save
|
@photo.save
|
||||||
@photo.reload
|
#@photo.reload
|
||||||
|
|
||||||
url = @photo.url
|
url = @photo.url
|
||||||
thumb_url = @photo.url :thumb_medium
|
thumb_url = @photo.url :thumb_medium
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ describe User do
|
||||||
context 'non-friend valid user' do
|
context 'non-friend valid user' do
|
||||||
|
|
||||||
it 'raises if receives post by non-friend' do
|
it 'raises if receives post by non-friend' do
|
||||||
pending "need to that posts come from friends.... requests need special treatment(because the person may not be in the db)"
|
|
||||||
post_from_non_friend = bad_user.build_post( :status_message, :message => 'hi')
|
post_from_non_friend = bad_user.build_post( :status_message, :message => 'hi')
|
||||||
xml = bad_user.salmon(post_from_non_friend).xml_for(user.person)
|
xml = bad_user.salmon(post_from_non_friend).xml_for(user.person)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue