Skip to content

Commit

Permalink
Merge pull request #1626 from sarken/Issue-3066-Unescape-unsubscribed
Browse files Browse the repository at this point in the history
Issue 3066 unescape unsubscribed
  • Loading branch information
CristinaRO committed Apr 24, 2014
2 parents 468ecc4 + d6a7766 commit 5b34fe0
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 5 deletions.
2 changes: 1 addition & 1 deletion app/controllers/subscriptions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def destroy

respond_to do |format|
format.html {
flash[:notice] = ts("You have successfully unsubscribed from %{name}.", :name => @subscription.name)
flash[:notice] = ts("You have successfully unsubscribed from %{name}.", :name => @subscription.name).html_safe
redirect_back_or_default(@subscribable)
}
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/collection_items/_collection_item_form.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<% @collection_item ||= CollectionItem.new %>
<% in_page ||= false %>
<div id="collection-form">
<h3 class="heading"><%= ts("Add %{title} to collections", :title => item.respond_to?(:title) ? item.title : item.class.name) %></h3>
<h3 class="heading"><%= ts("Add %{title} to collections", :title => item.respond_to?(:title) ? item.title : item.class.name).html_safe %></h3>
<%
# when in the works controller, such as for a non-multi-chapter work, form_for does not set work_id
# so the create action of the collection_items controller fails to find the targetted work
Expand Down
2 changes: 1 addition & 1 deletion app/views/subscriptions/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
</dt>
<dd>
<%= form_for [current_user, subscription], :html => {:method => :delete} do |f| %>
<%= f.submit ts("Unsubscribe from %{name}", :name => subscription.name) %>
<%= f.submit ts("Unsubscribe from %{name}", :name => subscription.name).html_safe %>
<% end %>
</dd>
<% end %>
Expand Down
6 changes: 6 additions & 0 deletions features/fixtures/chapters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,9 @@ chapter6:
work_id: 5
content: something something something
published_at: 2011-06-30
chapter7:
id: 7
posted: true
work_id: 6
content: This is some content for a work with a fandom, rating, and warning tag and character entities.
published_at: 2013-04-30
4 changes: 4 additions & 0 deletions features/fixtures/creatorships.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,8 @@ work4:
work5:
pseud_id: 6
creation_id: 5
creation_type: Work
work6:
pseud_id: 6
creation_id: 6
creation_type: Work
3 changes: 3 additions & 0 deletions features/fixtures/stat_counters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@ fourth:
fifth:
work_id: 5
hit_count: 2
sixth:
work_id: 6
hit_count: 37
15 changes: 15 additions & 0 deletions features/fixtures/taggings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,18 @@ tagging13:
tagger_type: Tag
taggable_id: 1
taggable_type: Work
tagging14:
tagger_id: 10
tagger_type: Tag
taggable_id: 6
taggable_type: Work
tagging15:
tagger_id: 1
tagger_type: Tag
taggable_id: 6
taggable_type: Work
tagging16:
tagger_id: 2
tagger_type: Tag
taggable_id: 6
taggable_type: Work
11 changes: 11 additions & 0 deletions features/fixtures/works.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,14 @@ fifth:
authors_to_sort_on: testuser2
revised_at: 2012-04-30
expected_number_of_chapters: 5
sixth:
id: 6
posted: true
title: I am &lt;strong&gt;er Than Yesterday &amp; Other Lies
word_count: 500
title_to_sort_on: I am &lt;strong&gt;er Than Yesterday &amp; Other Lies
language: english
authors_to_sort_on: testuser2
revised_at: 2013-04-30
expected_number_of_chapters: 2
complete: false
23 changes: 23 additions & 0 deletions features/other/subscriptions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,29 @@
And the email should contain "wip_author"
And the email should contain "posted"
And the email should contain "Chapter 2"

Scenario: subscribe to an individual work with an the & and < and > entitites in the title

Given I have loaded the fixtures
And the following activated users exist
| login | password | email |
| subscriber | password | subscriber@foo.com |
When I am logged in as "subscriber" with password "password"
And I view the work "I am &lt;strong&gt;er Than Yesterday &amp; Other Lies"
When I press "Subscribe"
Then I should see "You are now following I am <strong>er Than Yesterday & Other Lies. If you'd like to stop receiving email updates, you can unsubscribe from your Subscriptions page."
When I am logged in as "testuser2" with password "testuser2"
And a chapter is added to "I am &lt;strong&gt;er Than Yesterday &amp; Other Lies"
When I view the work "I am &lt;strong&gt;er Than Yesterday &amp; Other Lies"
When subscription notifications are sent
Then 1 email should be delivered to "subscriber@foo.com"
When "The problem with ampersands and angle brackets in email bodies and subjects" is fixed
#And the email should have "I am <strong>er Than Yesterday & Other Lies" in the subject
#And the email should contain "I am <strong>er Than Yesterday & Other Lies"
When I am logged in as "subscriber" with password "password"
And I go to my subscriptions page
And I press "Unsubscribe from I am <strong>er Than Yesterday & Other Lies"
Then I should see "You have successfully unsubscribed from I am <strong>er Than Yesterday & Other Lies"

Scenario: subscribe to series

Expand Down
4 changes: 2 additions & 2 deletions features/works/work_search.feature
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ Feature: Search Works
When I am on the homepage.
And I fill in "site_search" with "testuser2"
And I press "Search"
Then I should see "2 Found"
Then I should see "3 Found"
When I follow "Edit Your Search"
Then I should be on the search works page
When I fill in "Any Field" with ""
And I fill in "Author/Artist" with "testuser2"
And I press "Search" within "form#new_work_search"
Then I should see "2 Found"
Then I should see "3 Found"
# When I am on the search works page
# And I fill in "Kudos" with ">0"
# And I press "Search" within "form#new_work_search"
Expand Down

0 comments on commit 5b34fe0

Please sign in to comment.