diff --git a/app/views/posts/show.html.haml b/app/views/posts/show.html.haml index 52fab9ea3..d06204d3a 100644 --- a/app/views/posts/show.html.haml +++ b/app/views/posts/show.html.haml @@ -4,7 +4,7 @@ .span-20.append-2.prepend-2.last #main_stream.stream.status_message_show - = render 'shared/stream_element', :post => @post, :all_aspects => @post.aspects -%br -%br -%br + = render 'shared/stream_element_shim', :post => @post, :commenting_disabled => defined?(@commenting_disabled) + %br + %br + %br diff --git a/app/views/shared/_stream_element.html.haml b/app/views/shared/_stream_element.html.haml index 6f83771c8..2e619e288 100644 --- a/app/views/shared/_stream_element.html.haml +++ b/app/views/shared/_stream_element.html.haml @@ -11,11 +11,8 @@ = link_to image_tag('deletelabel.png'), post_path(post), :confirm => t('are_you_sure'), :method => :delete, :remote => true, :class => "delete stream_element_delete", :title => t('delete') - else - .right - - if reshare - .reshare_attribution= "reshared by #{reshare.author.name}" - .controls - = link_to image_tag('deletelabel.png'), post_visibility_path(:id => "42", :post_id => post.id), :method => :put, :remote => true, :class => "delete stream_element_delete", :title => t('hide') + .right.controls + = link_to image_tag('deletelabel.png'), post_visibility_path(:id => "42", :post_id => post.id), :method => :put, :remote => true, :class => "delete stream_element_delete", :title => t('hide') .undo_text.hidden = t('post_visibilites.update.post_hidden', :name => post.author.name) = link_to t('undo'), post_visibility_path(:id => "42", :post_id => post.id), :method => :put, :remote => true, :class => "delete stream_element_delete" @@ -27,6 +24,10 @@ %span.from = person_link(post.author, :class => 'hovercardable') %time.time.timeago{:datetime => post.created_at, :integer => time_for_sort(post).to_i} + - if reshare + %span.reshared + = "reshared by" + = person_link(reshare.author, :class => "hovercardable") %span.details – %span.timeago diff --git a/app/views/shared/_stream_element_shim.haml b/app/views/shared/_stream_element_shim.haml index a5dd321c4..7a2512880 100644 --- a/app/views/shared/_stream_element_shim.haml +++ b/app/views/shared/_stream_element_shim.haml @@ -1,5 +1,4 @@ - --if post.model.is_a?(Reshare) - = render 'shared/stream_element', :post => post.root, :all_aspects => all_aspects, :commenting_disabled => commenting_disabled, :reshare => post +-if (defined?(post.model) && post.model.is_a?(Reshare)) || post.instance_of?(Reshare) + = render 'shared/stream_element', :post => post.root, :commenting_disabled => commenting_disabled, :reshare => post - else - = render 'shared/stream_element', :post => post, :all_aspects => all_aspects, :commenting_disabled => commenting_disabled, :reshare => nil + = render 'shared/stream_element', :post => post, :commenting_disabled => commenting_disabled, :reshare => nil diff --git a/db/schema.rb b/db/schema.rb index a8ddf606d..da4789c6a 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -268,6 +268,7 @@ ActiveRecord::Schema.define(:version => 20110707234802) do t.string "provider_display_name" t.string "actor_url" t.integer "objectId" + t.integer "root_id" t.string "status_message_guid" t.integer "likes_count", :default => 0 end diff --git a/features/repost.feature b/features/repost.feature index a54e1e798..775557730 100644 --- a/features/repost.feature +++ b/features/repost.feature @@ -28,11 +28,14 @@ Feature: public repost Scenario: shows up on the profile page And "bob@bob.bob" has a public post with text "reshare this!" And I sign in as "alice@alice.alice" + And I preemptively confirm the alert And I follow "Reshare" And I wait for the ajax to finish + And I wait for 2 seconds + + - Then I should see a ".reshared" And I am on "alice@alice.alice"'s page Then I should see "reshare this!" Then I should see a ".reshared" @@ -45,8 +48,9 @@ Feature: public repost And I follow "Reshare" And I wait for the ajax to finish + And I go to the home page Then I should see a ".reshared" - And I follow "All Aspects" + And I follow "Your Aspects" Then I should see "reshare this!" Then I should see a ".reshared" And I should see "Bob" diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index d3d462a10..b02d1881e 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -376,10 +376,6 @@ ul.as-selections &:hover :text :decoration none -.reshare_attribution - :font-size smaller -.reshared - :background-color #eee .stream_element :position relative diff --git a/spec/controllers/reshares_controller_spec.rb b/spec/controllers/reshares_controller_spec.rb index 9a780a905..23508cf86 100644 --- a/spec/controllers/reshares_controller_spec.rb +++ b/spec/controllers/reshares_controller_spec.rb @@ -2,16 +2,13 @@ require 'spec_helper' describe ResharesController do describe '#create' do - it 'requires authentication' do post :create, :format => :js response.should_not be_success end context 'with an authenticated user' do - before do - sign_in :user, bob @post_id = Factory(:status_message, :public => true).id @controller.stub(:current_user).and_return(bob) @@ -19,7 +16,6 @@ describe ResharesController do it 'succeeds' do post :create, :format => :js, :root_id => @post_id - puts response.code response.should be_success end