Skip to content

Commit

Permalink
Fix issue 2802 by removing user name from deleted comment placeholder
Browse files Browse the repository at this point in the history
  • Loading branch information
sarken committed Jan 3, 2012
1 parent 28b101d commit 9942597
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/views/comments/_single_comment.html.erb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<% else %> <% else %>
<% if single_comment.is_deleted %> <% if single_comment.is_deleted %>
<p> <p>
(<%= ts("previous comment by %{name} deleted", :name => get_commenter_pseud_or_name(single_comment)) %>) (<%= ts("Previous comment deleted.") %>)
</p> </p>
<% elsif single_comment.hidden_by_admin? && !logged_in_as_admin? %> <% elsif single_comment.hidden_by_admin? && !logged_in_as_admin? %>
<p class="message">(<%= ts("This comment is under review by an admin and is currently unavailable.") %>)</p> <p class="message">(<%= ts("This comment is under review by an admin and is currently unavailable.") %>)</p>
Expand Down
50 changes: 50 additions & 0 deletions features/comments_delete.feature
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,50 @@
@comments
Feature: Delete a comment
In order to remove a comment from public view
As a user
I want to be able to delete a comment I added
As an author
I want to be able to delete a comment a reader added to my work

Scenario: User deletes a comment they added to a work
When I am logged in as "author"
And I post the work "Awesome story"
When I am logged in as "commenter"
And I post the comment "Fail comment" on the work "Awesome story"
And I delete the comment
Then I should see "Comment deleted."

Scenario: User deletes a comment they added to a work and which is the parent of another comment
When I am logged in as "author"
And I post the work "Awesome story"
When I am logged in as "commenter1"
And I post the comment "Fail comment" on the work "Awesome story"
And I reply to a comment with "I didn't mean that"
And I delete the comment
Then I should see "Comment deleted."
And I should see "(Previous comment deleted.)"
And I should see "I didn't mean that"

Scenario: Author deletes a comment another user added to their work
When I am logged in as "author"
And I post the work "Awesome story"
When I am logged in as "commenter"
And I post the comment "Fail comment" on the work "Awesome story"
When I am logged in as "author"
And I view the work "Awesome story" with comments
And I delete the comment
Then I should see "Comment deleted."

Scenario: Author deletes a parent comment that another user added to their work
When I am logged in as "author"
And I post the work "Awesome story"
When I am logged in as "commenter"
And I post the comment "Fail comment" on the work "Awesome story"
And I reply to a comment with "I didn't mean that"
When I am logged in as "author"
And I view the work "Awesome story" with comments
And I delete the comment
Then I should see "Comment deleted."
And I should see "(Previous comment deleted.)"
And I should see "I didn't mean that"

5 changes: 5 additions & 0 deletions features/step_definitions/comment_steps.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@
end end
end end


When /^I delete the comment$/ do
When %{I follow "Delete" within ".odd"}
And %{I follow "Yes, delete!"}
end

Then /^I should see the reply to comment form$/ do Then /^I should see the reply to comment form$/ do
Then %{I should see "Comment as" within ".odd"} Then %{I should see "Comment as" within ".odd"}
end end
5 changes: 5 additions & 0 deletions features/step_definitions/work_steps.rb
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@
When %{I follow "View chapter by chapter"} if mode == "chapter-by-chapter" When %{I follow "View chapter by chapter"} if mode == "chapter-by-chapter"
end end


When /^I view the work "([^\"]*)" with comments$/ do |work|
work = Work.find_by_title!(work)
visit work_url(work, :anchor => "comments", :show_comments => true)
end

When /^I edit the work "([^\"]*)"$/ do |work| When /^I edit the work "([^\"]*)"$/ do |work|
work = Work.find_by_title!(work) work = Work.find_by_title!(work)
visit edit_work_url(work) visit edit_work_url(work)
Expand Down

0 comments on commit 9942597

Please sign in to comment.