From 39b856dce720ecd1ee22380371c7f4198be69d58 Mon Sep 17 00:00:00 2001 From: Sam Saffron Date: Wed, 26 Jun 2019 17:53:29 +1000 Subject: [PATCH] DEV: correct edge case introduced in 333b5a19 We need to allow users to edit uncategorized topics out of uncategorized when for some reason admin just turns it off. --- lib/guardian/topic_guardian.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/guardian/topic_guardian.rb b/lib/guardian/topic_guardian.rb index d52c1e7a99..941d76e166 100644 --- a/lib/guardian/topic_guardian.rb +++ b/lib/guardian/topic_guardian.rb @@ -76,7 +76,14 @@ module TopicGuardian return true if is_moderator? && can_create_post?(topic) # can't edit topics in secured categories where you don't have permission to create topics - return false if !can_create_topic_on_category?(topic.category) + # except for a tiny edge case where the topic is uncategorized and you are trying + # to fix it but uncategorized is disabled + if ( + SiteSetting.allow_uncategorized_topics || + topic.category_id != SiteSetting.uncategorized_category_id + ) + return false if !can_create_topic_on_category?(topic.category) + end # TL4 users can edit archived topics, but can not edit private messages return true if (