Skip to content
Extraits de code Groupes Projets
Valider ecd93bca rédigé par Florian Staudacher's avatar Florian Staudacher
Parcourir les fichiers

Merge pull request #4056 from marpo60/fix-4023

fix reshares in single post-view
parents 33acc1f7 d63aff8e
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
* Do not fail on receiving a SignedRetraction via the public route * Do not fail on receiving a SignedRetraction via the public route
* Pass the real values to stderr_path and stdout_path in unicorn.rb since it runs a case statement on them. * 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) * 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)
## Refactor ## Refactor
......
...@@ -125,7 +125,7 @@ app.models.Post.Interactions = Backbone.Model.extend({ ...@@ -125,7 +125,7 @@ app.models.Post.Interactions = Backbone.Model.extend({
, publicPost = this.post.get("public") , publicPost = this.post.get("public")
, userIsNotAuthor = this.post.get("author").diaspora_id != app.currentUser.get("diaspora_id") , userIsNotAuthor = this.post.get("author").diaspora_id != app.currentUser.get("diaspora_id")
, userIsNotRootAuthor = rootExists && (isReshare ? this.post.get("root").author.diaspora_id != app.currentUser.get("diaspora_id") : true) , userIsNotRootAuthor = rootExists && (isReshare ? this.post.get("root").author.diaspora_id != app.currentUser.get("diaspora_id") : true)
, notReshared = this.reshares.length === 0; , notReshared = !this.userReshare();
return publicPost && app.currentUser.authenticated() && userIsNotAuthor && userIsNotRootAuthor && notReshared; return publicPost && app.currentUser.authenticated() && userIsNotAuthor && userIsNotRootAuthor && notReshared;
} }
......
...@@ -9,6 +9,7 @@ Feature: public repost ...@@ -9,6 +9,7 @@ Feature: public repost
| username | email | | username | email |
| Bob Jones | bob@bob.bob | | Bob Jones | bob@bob.bob |
| Alice Smith | alice@alice.alice | | 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 "bob@bob.bob" is connected with "alice@alice.alice"
Scenario: Resharing a post from a single post page Scenario: Resharing a post from a single post page
...@@ -23,6 +24,19 @@ Feature: public repost ...@@ -23,6 +24,19 @@ Feature: public repost
Then I should see a flash message indicating success Then I should see a flash message indicating success
And I should see a flash message containing "successfully" And I should see a flash message containing "successfully"
Scenario: Resharing a post from a single post page that is reshared
Given "bob@bob.bob" has a public post with text "reshare this!"
And the post with text "reshare this!" is reshared by "eve@eve.eve"
And I sign in as "alice@alice.alice"
And I am on "bob@bob.bob"'s page
And I follow "Last Post"
And I preemptively confirm the alert
And I click on selector "a.reshare"
And I wait for the ajax to finish
Then I should see a flash message indicating success
And I should see a flash message containing "successfully"
# should be covered in rspec, so testing that the post is added to # should be covered in rspec, so testing that the post is added to
# app.stream in jasmine should be enough coverage # app.stream in jasmine should be enough coverage
Scenario: When I reshare, it shows up on my profile page Scenario: When I reshare, it shows up on my profile page
......
...@@ -32,6 +32,11 @@ Given /^"([^"]*)" has a non public post with text "([^"]*)"$/ do |email, text| ...@@ -32,6 +32,11 @@ Given /^"([^"]*)" has a non public post with text "([^"]*)"$/ do |email, text|
user.post(:status_message, :text => text, :public => false, :to => user.aspects) user.post(:status_message, :text => text, :public => false, :to => user.aspects)
end end
And /^the post with text "([^"]*)" is reshared by "([^"]*)"$/ do |text, email|
user = User.find_by_email(email)
root = Post.find_by_text(text)
user.post(:reshare, :root_guid => root.guid, :public => true, :to => user.aspects)
end
When /^The user deletes their first post$/ do When /^The user deletes their first post$/ do
@me.posts.first.destroy @me.posts.first.destroy
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter