diff --git a/app/models/status_message.rb b/app/models/status_message.rb index df0b2e34c..9601479ae 100644 --- a/app/models/status_message.rb +++ b/app/models/status_message.rb @@ -19,7 +19,10 @@ class StatusMessage < Post xml_attr :raw_message has_many :photos, :dependent => :destroy, :foreign_key => :status_message_guid, :primary_key => :guid - validate :presence_of_content + + # TODO: disabling presence_of_content() (and its specs in status_message_controller_spec.rb:125) is a quick and dirty fix for federation + # a StatusMessage is federated before its photos are so presence_of_content() fails erroneously if no text is present + #validate :presence_of_content attr_accessible :text, :provider_display_name attr_accessor :oembed_url diff --git a/lib/stream/soup.rb b/lib/stream/soup.rb index 1d74ba365..29438b4c9 100644 --- a/lib/stream/soup.rb +++ b/lib/stream/soup.rb @@ -30,7 +30,7 @@ class Stream::Soup < Stream::Base end def aspect_posts_ids - @aspect_posts_ids ||= user.visible_post_ids(:limit => 15, :order => "#{order} DESC", :max_time => max_time, :all_aspects? => true, :by_members_of => aspect_ids) + @aspect_posts_ids ||= user.visible_shareable_ids(Post, :limit => 15, :order => "#{order} DESC", :max_time => max_time, :all_aspects? => true, :by_members_of => aspect_ids) end def followed_tag_ids diff --git a/spec/controllers/status_messages_controller_spec.rb b/spec/controllers/status_messages_controller_spec.rb index 76ea6feb5..1528768e6 100644 --- a/spec/controllers/status_messages_controller_spec.rb +++ b/spec/controllers/status_messages_controller_spec.rb @@ -122,10 +122,11 @@ describe StatusMessagesController do StatusMessage.first.provider_display_name.should == 'mobile' end - it 'sends the errors in the body on js' do - post :create, status_message_hash.merge!(:format => 'js', :status_message => {:text => ''}) - response.body.should include('Status message requires a message or at least one photo') - end +# disabled to fix federation +# it 'sends the errors in the body on js' do +# post :create, status_message_hash.merge!(:format => 'js', :status_message => {:text => ''}) +# response.body.should include('Status message requires a message or at least one photo') +# end context 'with photos' do before do diff --git a/spec/lib/stream/aspect_spec.rb b/spec/lib/stream/aspect_spec.rb index 967547c09..b7e96e52c 100644 --- a/spec/lib/stream/aspect_spec.rb +++ b/spec/lib/stream/aspect_spec.rb @@ -57,19 +57,19 @@ describe Stream::Aspect do end it 'is called with 3 types' do - stream = AspectStream.new(@alice, [1,2], :order => 'created_at') + stream = Stream::Aspect.new(@alice, [1,2], :order => 'created_at') @alice.should_receive(:visible_shareables).with(Post, hash_including(:type=> ['StatusMessage', 'Reshare', 'ActivityStreams::Photo'])).and_return(stub.as_null_object) stream.posts end it 'respects ordering' do - stream = AspectStream.new(@alice, [1,2], :order => 'created_at') + stream = Stream::Aspect.new(@alice, [1,2], :order => 'created_at') @alice.should_receive(:visible_shareables).with(Post, hash_including(:order => 'created_at DESC')).and_return(stub.as_null_object) stream.posts end it 'respects max_time' do - stream = AspectStream.new(@alice, [1,2], :max_time => 123) + stream = Stream::Aspect.new(@alice, [1,2], :max_time => 123) @alice.should_receive(:visible_shareables).with(Post, hash_including(:max_time => instance_of(Time))).and_return(stub.as_null_object) stream.posts end diff --git a/spec/models/status_message_spec.rb b/spec/models/status_message_spec.rb index 005e0afd0..849fa796b 100644 --- a/spec/models/status_message_spec.rb +++ b/spec/models/status_message_spec.rb @@ -88,10 +88,10 @@ describe StatusMessage do end it "should have either a message or at least one photo" do n = Factory.build(:status_message, :text => nil) - n.valid?.should be_false +# n.valid?.should be_false - n.text = "" - n.valid?.should be_false +# n.text = "" +# n.valid?.should be_false n.text = "wales" n.valid?.should be_true diff --git a/spec/models/user/querying_spec.rb b/spec/models/user/querying_spec.rb index b4168de02..90c94b2fd 100644 --- a/spec/models/user/querying_spec.rb +++ b/spec/models/user/querying_spec.rb @@ -146,7 +146,7 @@ describe User do time = Time.now Time.stub(:now).and_return(time) alice.send(:prep_opts, Post, {}).should == { - :type => BaseStream::TYPES_OF_POST_IN_STREAM, + :type => Stream::Base::TYPES_OF_POST_IN_STREAM, :order => 'created_at DESC', :limit => 15, :hidden => false,