FIX: advanced tutorial errors when all categories are secured (#10111)

FIX: advanced tutorial errors when all categories are secured (#10111)

The category hashtag step will fail with an error when all categories aren’t public. Choose a category that the user can see.

diff --git a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/advanced_user_narrative.rb b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/advanced_user_narrative.rb
index 52f1cda..bd6bb02 100644
--- a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/advanced_user_narrative.rb
+++ b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/advanced_user_narrative.rb
@@ -41,7 +41,7 @@ module DiscourseNarrativeBot
       tutorial_recover: {
         next_state: :tutorial_category_hashtag,
         next_instructions: Proc.new do
-          category = Category.secured.last
+          category = Category.secured(Guardian.new(@user)).last
           slug = category.slug
 
           if parent_category = category.parent_category

GitHub sha: 713298c6

1 Like

This commit appears in #10111 which was approved by eviltrout. It was merged by SamSaffron.