FIX: Show Uncategorized when unsubscribing (#13832)

FIX: Show Uncategorized when unsubscribing (#13832)

If user tried to unsubscribe from a post from category Uncategorized, the category name was not displayed. It said only “Stop watching all topics in”.

diff --git a/app/views/email/unsubscribe.html.erb b/app/views/email/unsubscribe.html.erb
index 2125d30..6351b5e 100644
--- a/app/views/email/unsubscribe.html.erb
+++ b/app/views/email/unsubscribe.html.erb
@@ -37,7 +37,7 @@
           <p>
           <label>
             <%= check_box_tag 'unwatch_category' %>
-            <%= t('unsubscribe.unwatch_category', category: category_badge(@topic.category)).html_safe %>
+            <%= t('unsubscribe.unwatch_category', category: category_badge(@topic.category, show_uncategorized: true)).html_safe %>
           </label>
           </p>
         <% end %>
diff --git a/spec/requests/email_controller_spec.rb b/spec/requests/email_controller_spec.rb
index 3d79fb7..4e61b3e 100644
--- a/spec/requests/email_controller_spec.rb
+++ b/spec/requests/email_controller_spec.rb
@@ -273,6 +273,8 @@ RSpec.describe EmailController do
 
         navigate_to_unsubscribe
         expect(response.body).to include("unwatch_category")
+        doc = Nokogiri::HTML5::fragment(response.body)
+        expect(doc.css('a.badge-wrapper[href="/c/uncategorized/1"]').size).to eq(1)
 
         cu.destroy!
 

GitHub sha: 6db93e86d4eb0a58349344db4cb5ce7d0339ae9d

This commit appears in #13832 which was approved by ZogStriP. It was merged by SamSaffron.