From 795a7a575180dc214b636d097936bdb8ea6ef1e5 Mon Sep 17 00:00:00 2001 From: movilla Date: Fri, 16 Aug 2013 12:07:14 +0200 Subject: [PATCH] mobile error 500 if a reshared (original) post will be deleted. --- Changelog.md | 1 + app/helpers/mobile_helper.rb | 2 +- features/reshare_mobile.feature | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 7f0b5bbed..42102ecd1 100644 --- a/Changelog.md +++ b/Changelog.md @@ -37,6 +37,7 @@ * Fix mobile search tags [#4392](https://github.com/diaspora/diaspora/issues/4392) * Remove placeholders for name fields in settings (no more Sofaer) [#4385](https://github.com/diaspora/diaspora/pull/4385) * Problems with layout the registration page for mobile. [#4396](https://github.com/diaspora/diaspora/issues/4396) +* Fix mobile view of deleted reshares [#4397](https://github.com/diaspora/diaspora/issues/4397) ## Features * Admin: add option to find users under 13 (COPPA) [#4252](https://github.com/diaspora/diaspora/pull/4252) diff --git a/app/helpers/mobile_helper.rb b/app/helpers/mobile_helper.rb index 41bae57c2..fb9364c63 100644 --- a/app/helpers/mobile_helper.rb +++ b/app/helpers/mobile_helper.rb @@ -8,7 +8,7 @@ module MobileHelper if (post.public? || reshare?(post)) && (user_signed_in? && post.author != current_user.person) absolute_root = reshare?(post) ? post.absolute_root : post - if absolute_root.author != current_user.person + if absolute_root && absolute_root.author != current_user.person reshare = Reshare.where(:author_id => current_user.person_id, :root_guid => absolute_root.guid).first klass = reshare.present? ? "active" : "inactive" diff --git a/features/reshare_mobile.feature b/features/reshare_mobile.feature index 0580c54bc..1ea29c28a 100644 --- a/features/reshare_mobile.feature +++ b/features/reshare_mobile.feature @@ -11,6 +11,7 @@ Feature: resharing from the mobile | Alice Smith | alice@alice.alice | | Eve Doe | eve@eve.eve | And a user with email "bob@bob.bob" is connected with "alice@alice.alice" + And a user with email "eve@eve.eve" is connected with "bob@bob.bob" Given "bob@bob.bob" has a public post with text "reshare this!" And I sign in as "alice@alice.alice" @@ -41,3 +42,7 @@ Feature: resharing from the mobile And I sign in as "bob@bob.bob" And I toggle the mobile view Then I should see "Original post deleted by author." within ".reshare" + And I log out + And I sign in as "eve@eve.eve" + And I toggle the mobile view + Then I should see "Original post deleted by author." within ".reshare"