From 332d655a1db0db4e82a28932b8fca887c15cfbad Mon Sep 17 00:00:00 2001 From: "michael@discoursehosting.com" Date: Sun, 2 Apr 2017 20:25:08 +0000 Subject: [PATCH] Use html_for_upload instead of broken v8 stuff --- script/import_scripts/smf2.rb | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/script/import_scripts/smf2.rb b/script/import_scripts/smf2.rb index 96cabaf0c51..059e4a4be37 100644 --- a/script/import_scripts/smf2.rb +++ b/script/import_scripts/smf2.rb @@ -391,30 +391,8 @@ class ImportScripts::Smf2 < ImportScripts::Base return opts[:ignore_quotes] ? body : convert_quotes(body) end - def v8 - @ctx ||= begin - ctx = PrettyText.create_new_context - PrettyText.decorate_context(ctx) - # provides toHumanSize but restores I18n.t which we need to fix again - ctx.load(Rails.root + "app/assets/javascripts/locales/i18n.js") - helper = PrettyText::Helpers.new - ctx['I18n']['t'] = proc {|_,key,opts| helper.t(key, opts) } - # from i18n_helpers.js -- can't load it directly because Ember is missing - ctx.eval(<<-'end') - var oldI18ntoHumanSize = I18n.toHumanSize; - I18n.toHumanSize = function(number, options) { - options = options || {}; - options.format = I18n.t("number.human.storage_units.format"); - return oldI18ntoHumanSize.apply(this, [number, options]); - }; - end - ctx - end - end - def get_upload_markdown(upload) - @func ||= v8.eval("Discourse.Utilities.getUploadMarkdown") - return @func.call(upload).to_s + html_for_upload(upload, upload.original_filename) end def convert_quotes(body)