Merge pull request #2836 from Elberet/smf2-import
FIX: quoting non-existing messages would break SMF2 importer
This commit is contained in:
commit
0d7eb1ed55
|
@ -8,7 +8,7 @@ module PrettyText
|
||||||
class Helpers
|
class Helpers
|
||||||
|
|
||||||
def t(key, opts)
|
def t(key, opts)
|
||||||
str = I18n.t("js." + key)
|
str = I18n.t("js." + key, opts)
|
||||||
if opts
|
if opts
|
||||||
# TODO: server localisation has no parity with client should be fixed
|
# TODO: server localisation has no parity with client should be fixed
|
||||||
str = str.dup
|
str = str.dup
|
||||||
|
|
|
@ -421,7 +421,7 @@ class ImportScripts::Smf2 < ImportScripts::Base
|
||||||
quote = "[quote=\"#{params['author']}"
|
quote = "[quote=\"#{params['author']}"
|
||||||
if QuoteParamsPattern =~ params['link']
|
if QuoteParamsPattern =~ params['link']
|
||||||
tl = topic_lookup_from_imported_post_id($~[:msg].to_i)
|
tl = topic_lookup_from_imported_post_id($~[:msg].to_i)
|
||||||
quote << ", post:#{tl[:post_number]}, topic:#{tl[:topic_id]}"
|
quote << ", post:#{tl[:post_number]}, topic:#{tl[:topic_id]}" if tl
|
||||||
end
|
end
|
||||||
quote << "\"]#{inner}[/quote]"
|
quote << "\"]#{inner}[/quote]"
|
||||||
else
|
else
|
||||||
|
@ -606,7 +606,7 @@ class ImportScripts::Smf2 < ImportScripts::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def quoted
|
def quoted
|
||||||
@quoted.map {|id| @graph[id] }
|
@quoted.map {|id| @graph[id] }.reject(&:nil?)
|
||||||
end
|
end
|
||||||
|
|
||||||
def ignore_quotes?
|
def ignore_quotes?
|
||||||
|
@ -634,7 +634,13 @@ class ImportScripts::Smf2 < ImportScripts::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def inspect
|
def inspect
|
||||||
"#<#{self.class.name}: id=#{id.inspect}, prev=#{prev.try(:id).inspect}, quoted=#{quoted.map{|e|e.id}.inspect}>"
|
"#<#{self.class.name}: id=#{id.inspect}, prev=#{safe_id(@prev)}, quoted=[#{@quoted.map(&method(:safe_id)).join(', ')}]>"
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def safe_id(id)
|
||||||
|
@graph[id].present? ? @graph[id].id.inspect : "(#{id})"
|
||||||
end
|
end
|
||||||
end #Node
|
end #Node
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue