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.
This commit is contained in:
Sam Saffron 2019-06-26 17:53:29 +10:00
parent 333b5a19b2
commit 39b856dce7
1 changed files with 8 additions and 1 deletions

View File

@ -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 (