Skip to content

Commit

Permalink
Merge pull request #4056 from marpo60/fix-4023
Browse files Browse the repository at this point in the history
fix reshares in single post-view
  • Loading branch information
Raven24 committed Mar 13, 2013
2 parents 33acc1f + d63aff8 commit ecd93bc
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
* 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.
* 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

Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/app/models/post/interactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ app.models.Post.Interactions = Backbone.Model.extend({
, publicPost = this.post.get("public")
, 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)
, notReshared = this.reshares.length === 0;
, notReshared = !this.userReshare();

return publicPost && app.currentUser.authenticated() && userIsNotAuthor && userIsNotRootAuthor && notReshared;
}
Expand Down
14 changes: 14 additions & 0 deletions features/reshare.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Feature: public repost
| 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"

Scenario: Resharing a post from a single post page
Expand All @@ -23,6 +24,19 @@ Feature: public repost
Then I should see a flash message indicating success
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
# app.stream in jasmine should be enough coverage
Scenario: When I reshare, it shows up on my profile page
Expand Down
5 changes: 5 additions & 0 deletions features/step_definitions/posts_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
user.post(:status_message, :text => text, :public => false, :to => user.aspects)
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
@me.posts.first.destroy
Expand Down

0 comments on commit ecd93bc

Please sign in to comment.