smf2: deal with duplicate category names (#5435)

This commit is contained in:
Jay Pfaffman 2017-12-26 21:56:36 -08:00 committed by Sam
parent d18c42abd5
commit cc46ab5bb1
1 changed files with 4 additions and 0 deletions

View File

@ -1,3 +1,4 @@
# coding: utf-8
require 'mysql2'
require File.expand_path(File.dirname(__FILE__) + '/base.rb')
@ -152,6 +153,9 @@ class ImportScripts::Smf2 < ImportScripts::Base
parent_id = category_id_from_imported_category_id(board[:id_parent]) if board[:id_parent] > 0
groups = (board[:member_groups] || "").split(/,/).map(&:to_i)
restricted = !groups.include?(GUEST_GROUP) && !groups.include?(MEMBER_GROUP)
if Category.find_by_name(board[:name])
board[:name] += board[:id_board].to_s
end
{
id: board[:id_board],
name: board[:name],