photo show pages display comment streams for their original post. pending spec to do this *correctly* on the model level.
This commit is contained in:
parent
7da5accee8
commit
9a18b7e6f3
3 changed files with 28 additions and 8 deletions
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2010, Diaspora Inc. This file is
|
||||
# Copyright (c) 2009, Diaspora Inc. This file is
|
||||
# licensed under the Affero General Public License version 3 or later. See
|
||||
# the COPYRIGHT file.
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ class Photo < Post
|
|||
1.upto(len) { |i| string << chars[rand(chars.size-1)] }
|
||||
return string
|
||||
end
|
||||
|
||||
|
||||
def as_json(opts={})
|
||||
{
|
||||
:photo => {
|
||||
|
|
|
|||
|
|
@ -78,6 +78,13 @@
|
|||
= link_to (image_tag photo.url(:thumb_small)), object_path(photo)
|
||||
|
||||
%h4 Comments
|
||||
%div{:id => 'photo_stream', :class => 'stream show'}
|
||||
%li.message{:data=>{:guid=>@photo.id}}
|
||||
= render "comments/comments", :post => @photo
|
||||
|
||||
- if @photo.status_message_id
|
||||
%div{:id => 'status_message_stream', :class => 'stream show'}
|
||||
%li.message{:data=>{:guid=>@photo.status_message_id}}
|
||||
= render "comments/comments", :post => @photo.status_message
|
||||
|
||||
- else
|
||||
%div{:id => 'photo_stream', :class => 'stream show'}
|
||||
%li.message{:data=>{:guid=>@photo.id}}
|
||||
= render "comments/comments", :post => @photo
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ describe Photo do
|
|||
@photo2.random_string.should_not be nil
|
||||
end
|
||||
|
||||
describe '.instantiate' do
|
||||
describe '#instantiate' do
|
||||
it 'sets the persons diaspora handle' do
|
||||
@photo2.diaspora_handle.should == @user.person.diaspora_handle
|
||||
end
|
||||
|
|
@ -57,8 +57,6 @@ describe Photo do
|
|||
|
||||
end
|
||||
|
||||
|
||||
|
||||
it 'should save a photo' do
|
||||
@photo.image.store! File.open(@fixture_name)
|
||||
@photo.save.should == true
|
||||
|
|
@ -144,4 +142,19 @@ describe Photo do
|
|||
new_photo.url(:thumb_medium).include?(thumb_url).should be true
|
||||
end
|
||||
end
|
||||
|
||||
context "commenting" do
|
||||
|
||||
it "forwards comments to parent status message" do
|
||||
pending 'IMPORTANT! comments need to get sent to parent status message for a photo if one is present. do this from the photo model, NOT in comment.'
|
||||
status_message = @user.build_post(:status_message, :message => "whattup", :to => @aspect.id)
|
||||
status_message.photos << @photo2
|
||||
status_message.save
|
||||
proc{ @user.comment("big willy style", :on => @photo2) }.should change(status_message.comments, :count).by(1)
|
||||
end
|
||||
|
||||
it "accepts comments if there is no parent status message" do
|
||||
proc{ @user.comment("big willy style", :on => @photo) }.should change(@photo.comments, :count).by(1)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue