Commit 0a3e242e authored by Fabián Rodríguez's avatar Fabián Rodríguez
Browse files

fix reshares in single post-view

parent 33acc1f7
......@@ -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;
}
......
......@@ -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
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment