Merge pull request #4063 from movilla/reshare_mobile_delete
Mobile error 500 if a reshared (original) post will be deleted. Close #3409
This commit is contained in:
commit
6bb3967d33
4 changed files with 54 additions and 4 deletions
|
|
@ -10,6 +10,7 @@
|
|||
* Pass the real values to stderr_path and stdout_path in unicorn.rb since it runs a case statement on them.
|
||||
* Decode tag name before passing it into a TagFollowingAction [#4027](https://github.com/diaspora/diaspora/issues/4027)
|
||||
* Fix reshares in single post-view [#4056](https://github.com/diaspora/diaspora/issues/4056)
|
||||
* Fix mobile view of deleted reshares. [#4063](https://github.com/diaspora/diaspora/issues/4063)
|
||||
|
||||
## Refactor
|
||||
|
||||
|
|
|
|||
|
|
@ -6,13 +6,13 @@ module MobileHelper
|
|||
|
||||
def mobile_reshare_icon(post)
|
||||
if (post.public? || reshare?(post)) && (user_signed_in? && post.author != current_user.person)
|
||||
root = reshare?(post) ? post.root : post
|
||||
absolute_root = reshare?(post) ? post.absolute_root : post
|
||||
|
||||
if root.author != current_user.person_id
|
||||
if absolute_root.author != current_user.person
|
||||
reshare = Reshare.where(:author_id => current_user.person_id,
|
||||
:root_guid => root.guid).first
|
||||
:root_guid => absolute_root.guid).first
|
||||
klass = reshare.present? ? "active" : "inactive"
|
||||
link_to '', reshares_path(:root_guid => root.guid), :title => t('reshares.reshare.reshare_confirmation', :author => root.author_name), :class => "image_link reshare_action #{klass}"
|
||||
link_to '', reshares_path(:root_guid => absolute_root.guid), :title => t('reshares.reshare.reshare_confirmation', :author => absolute_root.author_name), :class => "image_link reshare_action #{klass}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
45
features/reshare_mobile.feature
Normal file
45
features/reshare_mobile.feature
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
@javascript
|
||||
Feature: resharing from the mobile
|
||||
In order to make Diaspora more viral
|
||||
As a mobile user
|
||||
I want to reshare my friend's post
|
||||
|
||||
Background:
|
||||
Given following users exist:
|
||||
| username | email |
|
||||
| Bob Jones | bob@bob.bob |
|
||||
| Alice Smith | alice@alice.alice |
|
||||
| Eve Doe | eve@eve.eve |
|
||||
And a user with email "bob@bob.bob" is connected with "alice@alice.alice"
|
||||
Given "bob@bob.bob" has a public post with text "reshare this!"
|
||||
And I sign in as "alice@alice.alice"
|
||||
|
||||
Scenario: Resharing a post from a single post page
|
||||
When I toggle the mobile view
|
||||
And I preemptively confirm the alert
|
||||
And I click on selector "a.image_link.reshare_action.inactive"
|
||||
And I wait for the ajax to finish
|
||||
Then I go to the stream page
|
||||
And I should see "reshared via" within ".reshare_via"
|
||||
|
||||
Scenario: Resharing a post from a single post page that is reshared
|
||||
Given the post with text "reshare this!" is reshared by "eve@eve.eve"
|
||||
And a user with email "alice@alice.alice" is connected with "eve@eve.eve"
|
||||
When I toggle the mobile view
|
||||
And I preemptively confirm the alert
|
||||
And I click on the first selector "a.image_link.reshare_action.inactive"
|
||||
And I wait for the ajax to finish
|
||||
Then I go to the stream page
|
||||
And I should see "reshared via" within ".reshare_via"
|
||||
|
||||
Scenario: Delete original reshared post
|
||||
Given "alice@alice.alice" has a public post with text "Don't reshare this!"
|
||||
And the post with text "Don't reshare this!" is reshared by "bob@bob.bob"
|
||||
And I am on "alice@alice.alice"'s page
|
||||
And I preemptively confirm the alert
|
||||
When I click to delete the first post
|
||||
And I wait for the ajax to finish
|
||||
And I log out
|
||||
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"
|
||||
|
|
@ -150,6 +150,10 @@ And /^I click on selector "([^"]*)"$/ do |selector|
|
|||
page.execute_script("$('#{selector}').click();")
|
||||
end
|
||||
|
||||
And /^I click on the first selector "([^"]*)"$/ do |selector|
|
||||
page.execute_script("$('#{selector}').first().click();")
|
||||
end
|
||||
|
||||
And /^I preemptively confirm the alert$/ do
|
||||
page.evaluate_script("window.confirm = function() { return true; }")
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue