Skip to content

Commit 951149d

Browse files
svbergeremSuperTux88
authored andcommitted
Properly format JSON for reshares to hide 'reshare' button on already reshared posts
closes #7169 fixes #4816 and #6594
1 parent e3b3da4 commit 951149d

File tree

3 files changed

+21
-6
lines changed

3 files changed

+21
-6
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
## Bug fixes
66
* Fix fetching comments after fetching likes [#7167](https://github.com/diaspora/diaspora/pull/7167)
7+
* Hide 'reshare' button on already reshared posts [#7169](https://github.com/diaspora/diaspora/pull/7169)
78

89
## Features
910

app/presenters/post_presenter.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def user_like
104104
end
105105

106106
def user_reshare
107-
@post.reshare_for(current_user)
107+
@post.reshare_for(current_user).try(:as_api_response, :backbone)
108108
end
109109

110110
def already_participated_in_poll

features/desktop/reshare.feature

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,25 @@ Feature: public repost
4242
And I sign in as "bob@bob.bob"
4343
Then I should see "Original post deleted by author" within ".reshare"
4444

45-
# should be covered in rspec, so testing that the post is added to
46-
# app.stream in jasmine should be enough coverage
47-
Scenario: When I reshare, it shows up on my profile page
48-
Given I sign in as "alice@alice.alice"
49-
And I confirm the alert after I follow "Reshare"
45+
Scenario: Reshare a post from the stream
46+
When I sign in as "alice@alice.alice"
47+
Then I should see a ".reshare" within ".feedback"
48+
When I confirm the alert after I follow "Reshare"
49+
Then I should see a flash message indicating success
50+
And I should see a flash message containing "successfully"
51+
And I should not see a ".reshare" within ".feedback"
52+
53+
Scenario: Reshare a post from another user's profile
54+
When I sign in as "alice@alice.alice"
55+
And I am on "bob@bob.bob"'s page
56+
Then I should see a ".reshare" within ".feedback"
57+
When I confirm the alert after I follow "Reshare"
5058
Then I should see a flash message indicating success
5159
And I should see a flash message containing "successfully"
5260
And I should not see a ".reshare" within ".feedback"
61+
62+
Scenario: Try to reshare an already reshared post from another user's profile
63+
Given the post with text "reshare this!" is reshared by "alice@alice.alice"
64+
When I sign in as "alice@alice.alice"
65+
And I am on "bob@bob.bob"'s page
66+
Then I should not see a ".reshare" within ".feedback"

0 commit comments

Comments
 (0)