diff --git a/app/helpers/reshares_helper.rb b/app/helpers/reshares_helper.rb index 6ba1a0241..d889ce1d6 100644 --- a/app/helpers/reshares_helper.rb +++ b/app/helpers/reshares_helper.rb @@ -7,7 +7,11 @@ module ResharesHelper end end - def reshare_link post - link_to t("reshares.reshare.reshare", :count => post.reshares.size), reshares_path(:root_guid => post.guid), :method => :post, :remote => true, :confirm => t('reshares.reshare.reshare_confirmation', :author => post.author.name, :text => post.text) + def reshare_link(post) + if reshare?(post) + link_to t("reshares.reshare.reshare_original"), reshares_path(:root_guid => post.root.guid), :method => :post, :remote => true, :confirm => t('reshares.reshare.reshare_confirmation', :author => post.root.author.name) + else + link_to t("reshares.reshare.reshare", :count => post.reshares.size), reshares_path(:root_guid => post.guid), :method => :post, :remote => true, :confirm => t('reshares.reshare.reshare_confirmation', :author => post.author.name) + end end end diff --git a/app/views/reshares/_reshare.haml b/app/views/reshares/_reshare.haml index 38fe531f6..add2e59a8 100644 --- a/app/views/reshares/_reshare.haml +++ b/app/views/reshares/_reshare.haml @@ -8,10 +8,14 @@ = person_image_link(post.author, :size => :thumb_small) .content - .right - = link_to t(".show_original"), post_path(post) %span.from = person_link(post.author, :class => "hovercardable") + %span.details + – + %span.timeago + = link_to(how_long_ago(post), post_path(post)) + – + = t("reshares.reshare.reshare", :count => post.reshares.size) - if post.activity_streams? = link_to image_tag(post.image_url, 'data-small-photo' => post.image_url, 'data-full-photo' => post.image_url, :class => 'stream-photo'), post.object_url, :class => "stream-photo-link" diff --git a/app/views/shared/_stream_element.html.haml b/app/views/shared/_stream_element.html.haml index 70375a2ed..cfcc37c72 100644 --- a/app/views/shared/_stream_element.html.haml +++ b/app/views/shared/_stream_element.html.haml @@ -58,7 +58,7 @@ %span.like_action = like_action(post, current_user) - - if (post.author_id != current_user.person.id) && (post.public?) && !reshare?(post) + - if (post.author_id != current_user.person.id) && (post.public?) · %span.reshare_action = reshare_link(post) diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index 7d85cba13..22cdb588f 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -591,14 +591,15 @@ en: other: "%{count} new requests!" reshares: reshare: + reshare_original: "Reshare orignial" reshare: zero: "Reshare" - one: "1 reshare" - few: "%{count} reshares" - many: "%{count} reshares" - other: "%{count} reshares" + one: "1 Reshare" + few: "%{count} Reshares" + many: "%{count} Reshares" + other: "%{count} Reshares" show_original: "Show original" - reshare_confirmation: "Reshare %{author} - %{text}?" + reshare_confirmation: "Reshare %{author}'s post?" deleted: "Original post deleted by author." create: failure: "There was an error resharing this post." diff --git a/db/seeds.rb b/db/seeds.rb index 2d6a6d399..f60329e62 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -48,10 +48,19 @@ require 'spec/support/user_methods' time_interval = 1000 (1..25).each do |n| [alice, bob, eve].each do |u| - post = u.post :status_message, :text => "#{u.username} - #{n} - #seeded", :to => u.aspects.first.id + if(n%3==1) + post = u.post :status_message, :text => "#{u.username} - #{n} - #seeded", :to => u.aspects.first.id + elsif(n%3==2) + post =u.post(:reshare, :root_guid => Factory(:status_message, :public => true).guid, :to => 'all') + else + post = Factory(:activity_streams_photo, :public => true, :author => u.person) + u.add_to_streams(post, u.aspects) + end + post.created_at = post.created_at - time_interval post.updated_at = post.updated_at - time_interval post.save time_interval += 1000 end + puts "successfully seeded database with bob, alice and eve (password: evankorth)" end diff --git a/public/stylesheets/sass/application.sass b/public/stylesheets/sass/application.sass index 64475b53e..4859b17ec 100644 --- a/public/stylesheets/sass/application.sass +++ b/public/stylesheets/sass/application.sass @@ -492,8 +492,12 @@ ul.as-selections :margin :bottom 5px -.details - :color #aaa +.from + .details, + .details * + :color #aaa + :font + :weight normal .post_scope :cursor default @@ -612,8 +616,12 @@ ul.show_comments, :display inline .stream_element .reshare - :padding 10px - :border 1px solid #eee + :padding + :left 10px + :border-left 2px solid #ddd + :margin + :top 5px + :bottom 10px ul.show_comments :padding diff --git a/spec/controllers/aspects_controller_spec.rb b/spec/controllers/aspects_controller_spec.rb index 5c2185320..f0b5f3d79 100644 --- a/spec/controllers/aspects_controller_spec.rb +++ b/spec/controllers/aspects_controller_spec.rb @@ -368,4 +368,26 @@ describe AspectsController do end end end + + describe "mobile site" do + before do + ap = alice.person + posts = [] + posts << alice.post(:reshare, :root_guid => Factory(:status_message, :public => true).guid, :to => 'all') + posts << alice.post(:status_message, :text => 'foo', :to => alice.aspects) + photo = Factory(:activity_streams_photo, :public => true, :author => ap) + posts << photo + posts.each do |p| + alice.build_like(:positive => true, :target => p).save + end + alice.add_to_streams(photo, alice.aspects) + sign_in alice + end + + it 'should not 500' do + get :index, :format => :mobile + response.should be_success + + end + end end diff --git a/spec/factories.rb b/spec/factories.rb index ab39142e6..abe0a7f85 100644 --- a/spec/factories.rb +++ b/spec/factories.rb @@ -124,9 +124,9 @@ end Factory.define(:activity_streams_photo, :class => ActivityStreams::Photo) do |p| p.association(:author, :factory => :person) - p.image_url "http://example.com/awesome.png" - p.image_height 900 - p.image_width 400 + p.image_url "#{AppConfig[:pod_url]}/images/asterisk.png" + p.image_height 154 + p.image_width 154 p.object_url "http://example.com/awesome_things.gif" p.objectId "http://example.com/awesome_things.gif" p.actor_url "http://notcubbi.es/cubber"