mirror of
https://github.com/discourse/discourse.git
synced 2025-03-22 05:47:24 +08:00
DEV: lint importer
commit #f490ed3b introduced a few linting issues, resolved now
This commit is contained in:
parent
f490ed3bbc
commit
678a9a61c4
@ -261,7 +261,7 @@ class ImportScripts::XenForo < ImportScripts::Base
|
|||||||
|
|
||||||
# [QUOTE="username, post: 28662, member: 1283"]
|
# [QUOTE="username, post: 28662, member: 1283"]
|
||||||
s.gsub!(/\[quote="(\w+), post: (\d*), member: (\d*)"\]/i) do
|
s.gsub!(/\[quote="(\w+), post: (\d*), member: (\d*)"\]/i) do
|
||||||
username, imported_post_id, imported_user_id = $1, $2, $3
|
username, imported_post_id, _imported_user_id = $1, $2, $3
|
||||||
|
|
||||||
topic_mapping = topic_lookup_from_imported_post_id(imported_post_id)
|
topic_mapping = topic_lookup_from_imported_post_id(imported_post_id)
|
||||||
|
|
||||||
@ -315,10 +315,9 @@ class ImportScripts::XenForo < ImportScripts::Base
|
|||||||
s
|
s
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
def process_xf_attachments(xf_type, s)
|
def process_xf_attachments(xf_type, s)
|
||||||
ids = Set.new
|
ids = Set.new
|
||||||
ids.merge(s.scan(get_xf_regexp(xf_type)).map {|x| x[0].to_i})
|
ids.merge(s.scan(get_xf_regexp(xf_type)).map { |x| x[0].to_i })
|
||||||
ids.each do |id|
|
ids.each do |id|
|
||||||
next unless id
|
next unless id
|
||||||
sql = get_xf_sql(xf_type, id).squish!
|
sql = get_xf_sql(xf_type, id).squish!
|
||||||
@ -360,9 +359,9 @@ class ImportScripts::XenForo < ImportScripts::Base
|
|||||||
def get_xf_regexp(type, id = nil)
|
def get_xf_regexp(type, id = nil)
|
||||||
case type
|
case type
|
||||||
when :gallery
|
when :gallery
|
||||||
Regexp.new /\[GALLERY=media,\s#{id ? id : '(\d+)'}\].+?\]/i
|
Regexp.new(/\[GALLERY=media,\s#{id ? id : '(\d+)'}\].+?\]/i)
|
||||||
when :attachment
|
when :attachment
|
||||||
Regexp.new /\[ATTACH(?>=\w+)?\]#{id ? id : '(\d+)'}\[\/ATTACH\]/i
|
Regexp.new(/\[ATTACH(?>=\w+)?\]#{id ? id : '(\d+)'}\[\/ATTACH\]/i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user