Imported categories use colors from settings instead of brown

This commit is contained in:
Gerhard Schlager 2018-05-22 21:27:25 +02:00
parent beed676b04
commit eceeef8413

View File

@ -442,7 +442,7 @@ class ImportScripts::Base
user_id: opts[:user_id] || opts[:user].try(:id) || Discourse::SYSTEM_USER_ID,
position: opts[:position],
parent_category_id: opts[:parent_category_id],
color: opts[:color] || "AB9364",
color: opts[:color] || category_color,
text_color: opts[:text_color] || "FFF",
read_restricted: opts[:read_restricted] || false,
)
@ -463,6 +463,15 @@ class ImportScripts::Base
new_category
end
def category_color
@category_colors ||= SiteSetting.category_colors.split('|')
index = @next_category_color_index.presence || 0
@next_category_color_index = index + 1 >= @category_colors.count ? 0 : index + 1
@category_colors[index]
end
def created_post(post)
# override if needed
end