Merge pull request #4056 from marpo60/fix-4023

fix reshares in single post-view
This commit is contained in:
Florian Staudacher 2013-03-13 01:28:07 -07:00
commit ecd93bca6f
4 changed files with 21 additions and 1 deletions

View file

@ -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

View file

@ -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;
}

View file

@ -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
@ -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

View file

@ -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)
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