Reshares delegate nsfw to the root post

fixes #3120
This commit is contained in:
Steven Hancock 2012-05-08 03:02:07 -07:00
parent 00123c0ab2
commit 605b418d42
3 changed files with 33 additions and 0 deletions

View file

@ -61,6 +61,10 @@ class Reshare < Post
Notifications::Reshared if root.author == user.person
end
def nsfw
root.nsfw
end
private
def after_parse

View file

@ -41,3 +41,18 @@ Scenario: Toggling nsfw state
When I toggle nsfw posts
Then I should not see "I love 0bj3ction4bl3 c0nt3nt!"
And I should not see "Sexy Senators Gone Wild!"
Scenario: Resharing an nsfw post
Given a nsfw user with email "tommy@pr0nking.com"
And a user with email "laura@officeworkers.com"
And a user with email "laura@officeworkers.com" is connected with "tommy@pr0nking.com"
And "tommy@pr0nking.com" has a public post with text "Sexy Senators Gone Wild!"
And I sign in as "laura@officeworkers.com"
And I toggle nsfw posts
And I preemptively confirm the alert
And I follow "Reshare"
And I wait for the ajax to finish
And I follow "Stream"
And I wait for the ajax to finish
Then I should have 2 nsfw posts
And I should not see "Sexy Senators Gone Wild!"

View file

@ -53,6 +53,20 @@ describe Reshare do
end
end
describe '#nsfw' do
before do
sfw = Factory(:status_message, :author => alice.person, :public => true)
nsfw = Factory(:status_message, :author => alice.person, :public => true, :text => "This is #nsfw")
@sfw_reshare = Factory(:reshare, :root => sfw)
@nsfw_reshare = Factory(:reshare, :root => nsfw)
end
it 'deletates #nsfw to the root post' do
@sfw_reshare.nsfw.should_not be_true
@nsfw_reshare.nsfw.should be_true
end
end
describe '#notification_type' do
before do
sm = Factory(:status_message, :author => alice.person, :public => true)