A platform for community discussion. Free, open, simple.
DEV: Correctly tag heredocs (#16061)
Jarek Radosz2fc70c5572ca
diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rbindex da7ecf92fdb..e31b08fbe9e 100644--- a/app/controllers/posts_controller.rb+++ b/app/controllers/posts_controller.rb@@ -45,14 +45,14 @@ class PostsController < ApplicationControlleropts[:limit] = MARKDOWN_TOPIC_PAGE_SIZEtopic_view = TopicView.new(params[:topic_id], current_user, opts)content = topic_view.posts.map do |p|- <<~HEREDOC+ <<~MD#{p.user.username} | #{p.updated_at} | ##{p.post_number}#{p.raw}-------------------------- HEREDOC+ MDendrender plain: content.joinenddiff --git a/app/controllers/session_controller.rb b/app/controllers/session_controller.rbindex 277be0ef215..9a35400ab22 100644--- a/app/controllers/session_controller.rb+++ b/app/controllers/session_controller.rb@@ -247,7 +247,7 @@ class SessionController < ApplicationControllerrescue ActiveRecord::RecordInvalid => eif SiteSetting.verbose_discourse_connect_logging- Rails.logger.warn(<<~EOF)+ Rails.logger.warn(<<~TEXT)Verbose SSO log: Record was invalid: #{e.record.class.name} #{e.record.id}#{e.record.errors.to_h}@@ -256,7 +256,7 @@ class SessionController < ApplicationControllerSSO Diagnostics:#{sso.diagnostics}- EOF+ TEXTendtext = nildiff --git a/app/jobs/base.rb b/app/jobs/base.rbindex 8d82e2d2dfc..381e5a93f8d 100644--- a/app/jobs/base.rb+++ b/app/jobs/base.rb@@ -303,11 +303,11 @@ module Jobs# Simulate the args being dumped/parsed through JSONparsed_opts = JSON.parse(JSON.dump(opts))if opts != parsed_opts- Discourse.deprecate(<<~MSG.squish, since: "2.9", drop_from: "3.0")+ Discourse.deprecate(<<~TEXT.squish, since: "2.9", drop_from: "3.0")#{klass.name} was enqueued with argument values which do not cleanly serialize to/from JSON.This means that the job will be run with slightly different values than the ones supplied to `enqueue`.Argument values should be strings, booleans, numbers, or nil (or arrays/hashes of those value types).- MSG+ TEXTendopts = parsed_optsdiff --git a/app/serializers/reviewable_serializer.rb b/app/serializers/reviewable_serializer.rbindex c1af40b2a2b..5dafa06a0b9 100644--- a/app/serializers/reviewable_serializer.rb+++ b/app/serializers/reviewable_serializer.rb@@ -59,7 +59,7 @@ class ReviewableSerializer < ApplicationSerializerdef self.create_attribute(name, field)attribute(name)- class_eval <<~GETTER+ class_eval <<~RUBYdef #{name}#{field}end@@ -67,7 +67,7 @@ class ReviewableSerializer < ApplicationSerializerdef include_#{name}?#{name}.present?end- GETTER+ RUBYend# This is easier than creating an AMS method for each attributediff --git a/app/services/user_action_manager.rb b/app/services/user_action_manager.rbindex fa80f040859..b3c169466a8 100644--- a/app/services/user_action_manager.rb+++ b/app/services/user_action_manager.rb@@ -11,7 +11,7 @@ class UserActionManagerend[:notification, :post, :topic, :post_action].each do |type|- self.class_eval(<<~METHODS)+ self.class_eval(<<~RUBY)def self.#{type}_created(*args)return if @disabled#{type}_rows(*args).each { |row| UserAction.log_action!(row) }@@ -20,7 +20,7 @@ class UserActionManagerreturn if @disabled#{type}_rows(*args).each { |row| UserAction.remove_action!(row) }end- METHODS+ RUBYendprivatediff --git a/config/initializers/000-trace_pg_connections.rb b/config/initializers/000-trace_pg_connections.rbindex ef4c4572e9c..ccfa7600080 100644--- a/config/initializers/000-trace_pg_connections.rb+++ b/config/initializers/000-trace_pg_connections.rb@@ -39,7 +39,7 @@ if ENV["TRACE_PG_CONNECTIONS"]def log_access(&blk)@access_log_mutex.synchronize doif !@accessor_thread.nil?- Rails.logger.error <<~STRING+ Rails.logger.error <<~TEXTPG Clash: A connection is being accessed from two locations#{@accessor_thread} was using the connection. Backtrace:@@ -49,7 +49,7 @@ if ENV["TRACE_PG_CONNECTIONS"]#{Thread.current} is now attempting to use the connection. Backtrace:#{Thread.current&.backtrace&.join("\n")}- STRING+ TEXTif ENV["ON_PG_CLASH"] == "byebug"require "byebug"diff --git a/config/initializers/100-verify_config.rb b/config/initializers/100-verify_config.rbindex 4d2d986cd15..c2e7c63e669 100644--- a/config/initializers/100-verify_config.rb+++ b/config/initializers/100-verify_config.rb@@ -5,7 +5,7 @@if defined?(Rails::Server) && Rails.env.production? # Only run these checks when starting up a production serverif ['localhost', 'production.localhost'].include?(Discourse.current_hostname)- puts <<END+ puts <<~TEXTDiscourse.current_hostname = '#{Discourse.current_hostname}'@@ -13,20 +13,20 @@ if defined?(Rails::Server) && Rails.env.production? # Only run these checks whenso that it uses the hostname of your site. Otherwise you willexperience problems, like links in emails using #{Discourse.current_hostname}.-END+ TEXTraise "Invalid host_names in database.yml"endif !Dir.glob(File.join(Rails.root, 'public', 'assets', 'application*.js')).present?- puts <<END+ puts <<~TEXTAssets have not been precompiled. Please run the following commandbefore starting the rails server in production mode:rake assets:precompile-END+ TEXTraise "Assets have not been precompiled"enddiff --git a/db/migrate/20160108051129_fix_incorrect_user_history.rb b/db/migrate/20160108051129_fix_incorrect_user_history.rbindex 84282877fd4..5e2928d2586 100644--- a/db/migrate/20160108051129_fix_incorrect_user_history.rb+++ b/db/migrate/20160108051129_fix_incorrect_user_history.rb@@ -11,10 +11,10 @@ class FixIncorrectUserHistory < ActiveRecord::Migration[4.2]# this is a :auto_trust_level_change mislabeled as :check_email# impersonate that was actually delete topic- condition = <<CLAUSE-(action = 16 AND previous_value in ('0','1','2','3','4')) OR-(action = 19 AND target_user_id IS NULL AND details IS NOT NULL)-CLAUSE+ condition = <<~SQL+ (action = 16 AND previous_value in ('0','1','2','3','4')) OR+ (action = 19 AND target_user_id IS NULL AND details IS NOT NULL)+ SQLfirst_wrong_id = execute("SELECT min(id) FROM user_histories WHERE #{condition}").values[0][0].to_ilast_wrong_id = execute("SELECT max(id) FROM user_histories WHERE #{condition}").values[0][0].to_idiff --git a/lib/email/receiver.rb b/lib/email/receiver.rbindex c0ce08eac61..3aa97258302 100644--- a/lib/email/receiver.rb+++ b/lib/email/receiver.rb@@ -1011,13 +1011,13 @@ module Emaildef forwarded_email_quote_forwarded(destination, user)embedded = embedded_email_raw- raw = <<~EOF+ raw = <<~MD#{@before_embedded}[quote]#{PlainTextToMarkdown.new(embedded).to_markdown}[/quote]- EOF+ MDreturn true if forwarded_email_create_topic(destination: destination, user: user, raw: raw, title: subject)enddiff --git a/lib/freedom_patches/raw_handlebars.rb b/lib/freedom_patches/raw_handlebars.rbindex 7340e4aa5d3..2e520d2db6e 100644--- a/lib/freedom_patches/raw_handlebars.rb+++ b/lib/freedom_patches/raw_handlebars.rb@@ -18,7 +18,7 @@ class Barber::Precompiler# very hacky but lets us use ES6. I'm ashamed of this code -RWtranspiled = transpiled[transpiled.index('var RawHandlebars = ')...transpiled.index('export ')]- @precompiler = StringIO.new <<~END+ @precompiler = StringIO.new <<~JSvar __RawHandlebars;(function() {#{transpiled};@@ -30,7 +30,7 @@ class Barber::Precompilerreturn __RawHandlebars.precompile(string, false).toString();}};- END+ JSend@precompiler@@ -111,10 +111,10 @@ class Ember::Handlebars::Template"define('#{module_name}', ['exports'], function(__exports__){ __exports__['default'] = #{template} });"when :globalif raw- return <<~RAW_TEMPLATE+ return <<~JSvar __t = #{template};requirejs('discourse-common/lib/raw-templates').addRawTemplate(#{path_for(template_name, config)}, __t);- RAW_TEMPLATE+ JSendtarget = global_template_target('Ember.TEMPLATES', template_name, config)diff --git a/lib/migration/safe_migrate.rb b/lib/migration/safe_migrate.rbindex 3b4a386dfaf..0c8105e5593 100644--- a/lib/migration/safe_migrate.rb+++ b/lib/migration/safe_migrate.rb@@ -121,7 +121,7 @@ class Migration::SafeMigratedef self.protect!(sql)if sql =~ /^\s*(?:drop\s+table|alter\s+table.*rename\s+to)\s+/i- $stdout.puts("", <<~STR)+ $stdout.puts("", <<~TEXT)WARNING-------------------------------------------------------------------------------------An attempt was made to drop or rename a table in a migration@@ -131,10 +131,10 @@ class Migration::SafeMigrateThis protection is in place to protect us against dropping tables that are currentlyin use by live applications.- STR+ TEXTraise Discourse::InvalidMigration, "Attempt was made to drop a table"elsif sql =~ /^\s*alter\s+table.*(?:rename|drop)\s+/i- $stdout.puts("", <<~STR)+ $stdout.puts("", <<~TEXT)WARNING-------------------------------------------------------------------------------------An attempt was made to drop or rename a column in a migration@@ -148,7 +148,7 @@ class Migration::SafeMigrateThis protection is in place to protect us against dropping columns that are currentlyin use by live applications.- STR+ TEXTraise Discourse::InvalidMigration, "Attempt was made to rename or delete column"endenddiff --git a/lib/onebox/engine/allowlisted_generic_onebox.rb b/lib/onebox/engine/allowlisted_generic_onebox.rbindex 0bb2d72a007..aa25dd54a6a 100644--- a/lib/onebox/engine/allowlisted_generic_onebox.rb+++ b/lib/onebox/engine/allowlisted_generic_onebox.rb@@ -218,14 +218,14 @@ module Oneboxdef card_htmlescaped_url = ::Onebox::Helpers.normalize_url_for_output(data[:player])- <<~RAW+ <<~HTML<iframe src="#{escaped_url}"width="#{data[:player_width] || "100%"}"height="#{data[:player_height]}"scrolling="no"frameborder="0"></iframe>- RAW+ HTMLenddef article_htmldiff --git a/lib/plugin_initialization_guard.rb b/lib/plugin_initialization_guard.rbindex 8b5935dc370..9f9676ef159 100644--- a/lib/plugin_initialization_guard.rb+++ b/lib/plugin_initialization_guard.rb@@ -24,7 +24,7 @@ def plugin_initialization_guard(&block)endend.reverse.join("\n")- STDERR.puts <<~MESSAGE+ STDERR.puts <<~TEXT#{stack_trace}** INCOMPATIBLE PLUGIN **@@ -33,9 +33,9 @@ def plugin_initialization_guard(&block)#{plugin_path}Please try removing this plugin and rebuilding again!- MESSAGE+ TEXTelse- STDERR.puts <<~MESSAGE+ STDERR.puts <<~TEXT** PLUGIN FAILURE **You are unable to build Discourse due to this error during plugin@@ -44,7 +44,7 @@ def plugin_initialization_guard(&block)#{error}#{error.backtrace.join("\n")}- MESSAGE+ TEXTendexit 1enddiff --git a/lib/stylesheet/importer.rb b/lib/stylesheet/importer.rbindex e323f38f3c6..36de290b259 100644--- a/lib/stylesheet/importer.rb+++ b/lib/stylesheet/importer.rb@@ -34,23 +34,23 @@ module Stylesheetcontents = +""if body_font.present?- contents << <<~EOF+ contents << <<~CSS#{font_css(body_font)}:root {--font-family: #{body_font[:stack]};}- EOF+ CSSendif heading_font.present?- contents << <<~EOF+ contents << <<~CSS#{font_css(heading_font)}:root {--heading-font-family: #{heading_font[:stack]};}- EOF+ CSSendcontents@@ -70,14 +70,14 @@ module Stylesheetendcontents << font_css(font)- contents << <<~EOF+ contents << <<~CSS.body-font-#{font[:key].tr("_", "-")} {font-family: #{font[:stack]};}.heading-font-#{font[:key].tr("_", "-")} h2 {font-family: #{font[:stack]};}- EOF+ CSSendcontents@@ -184,11 +184,11 @@ module Stylesheetfields.map do |field|value = field.valueif value.present?- contents << <<~COMMENT+ contents << <<~SCSS// Theme: #{field.theme.name}// Target: #{field.target_name} #{field.name}// Last Edited: #{field.updated_at}- COMMENT+ SCSScontents << valueend@@ -216,13 +216,13 @@ module Stylesheetfonts_dir = UrlHelper.absolute("#{Discourse.base_path}/fonts")font[:variants].each do |variant|src = variant[:src] ? variant[:src] : "url(\"#{fonts_dir}/#{variant[:filename]}?v=#{DiscourseFonts::VERSION}\") format(\"#{variant[:format]}\")"- contents << <<~EOF+ contents << <<~CSS@font-face {font-family: #{font[:name]};src: #{src};font-weight: #{variant[:weight]};}- EOF+ CSSendenddiff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rakeindex 9a504ab46a6..3c580944bbb 100644--- a/lib/tasks/assets.rake+++ b/lib/tasks/assets.rake@@ -15,10 +15,10 @@ task 'assets:precompile:before' doif EMBER_CLI && !(ENV["EMBER_CLI_COMPILE_DONE"] == "1")# Using exec to free up Rails app memory during ember build- exec <<~SCRIPT+ exec <<~SHNODE_OPTIONS='--max-old-space-size=2048' yarn --cwd app/assets/javascripts/discourse run ember build -prod && \EMBER_CLI_COMPILE_DONE=1 bin/rake assets:precompile- SCRIPT+ SHend# Ensure we ALWAYS do a clean build@@ -124,9 +124,9 @@ def compress_node(from, to)source_map_url = "#{File.basename(to)}.map"base_source_map = assets_path + assets_additional_path- cmd = <<~EOS+ cmd = <<~SHterser '#{assets_path}/#{from}' -m -c -o '#{to_path}' --source-map "base='#{base_source_map}',root='#{source_map_root}',url='#{source_map_url}',includeSources=true"- EOS+ SHSTDERR.puts cmdresult = `#{cmd} 2>&1`diff --git a/lib/tasks/emails.rake b/lib/tasks/emails.rakeindex 13fa2bce164..0c31c645b14 100644--- a/lib/tasks/emails.rake+++ b/lib/tasks/emails.rake@@ -65,7 +65,7 @@ task 'emails:test', [:email] => [:environment] do |_, args|smtp = Discourse::Application.config.action_mailer.smtp_settingsif smtp[:address].match(/smtp\.gmail\.com/)- puts <<~STR+ puts <<~TEXT#{smtp}============================== WARNING ==============================@@ -75,7 +75,7 @@ task 'emails:test', [:email] => [:environment] do |_, args|https://meta.discourse.org/t/discourse-aws-ec2-g-suite-troubleshooting/62931?u=pfaffman========================= CONTINUING TEST ============================- STR+ TEXTendputs "Testing sending to #{email} using #{smtp[:address]}:#{smtp[:port]}, username:#{smtp[:user_name]} with #{smtp[:authentication]} auth."@@ -93,21 +93,21 @@ task 'emails:test', [:email] => [:environment] do |_, args|rescue Exception => eif e.to_s.match(/execution expired/)- message = <<~STR+ message = <<~TEXT======================================== ERROR ========================================Connection to port #{smtp[:port]} failed.====================================== SOLUTION =======================================The most likely problem is that your server has outgoing SMTP traffic blocked.If you are using a service like Mailgun or Sendgrid, try using port 2525.=======================================================================================- STR+ TEXTelsif e.to_s.match(/530.*STARTTLS/)# We can't run a preliminary test with STARTTLS, we'll just try sending the test email.message = "OK"elsif e.to_s.match(/535/)- message = <<~STR+ message = <<~TEXT======================================== ERROR ========================================AUTHENTICATION FAILED@@ -117,10 +117,10 @@ task 'emails:test', [:email] => [:environment] do |_, args|The most likely problem is that your SMTP username and/or Password is incorrect.Check them and try again.=======================================================================================- STR+ TEXTelsif e.to_s.match(/Connection refused/)- message = <<~STR+ message = <<~TEXT======================================== ERROR ========================================CONNECTION REFUSED@@ -132,10 +132,10 @@ task 'emails:test', [:email] => [:environment] do |_, args|Check the port and your networking configuration.=======================================================================================- STR+ TEXTelsif e.to_s.match(/service not known/)- message = <<~STR+ message = <<~TEXT======================================== ERROR ========================================SMTP SERVER NOT FOUND@@ -145,10 +145,10 @@ task 'emails:test', [:email] => [:environment] do |_, args|The most likely problem is that the host name of your SMTP server is incorrect.Check it and try again.=======================================================================================- STR+ TEXTelse- message = <<~STR+ message = <<~TEXT======================================== ERROR ========================================UNEXPECTED ERROR@@ -160,7 +160,7 @@ task 'emails:test', [:email] => [:environment] do |_, args|Please report the exact error message above to https://meta.discourse.org/(And a solution, if you find one!)=======================================================================================- STR+ TEXTendendif message == "OK"@@ -174,13 +174,13 @@ task 'emails:test', [:email] => [:environment] do |_, args|email_log = Email::Sender.new(TestMailer.send_test(email), :test_message).sendcase email_logwhen SkippedEmailLog- puts <<~STR+ puts <<~TEXTMail was not sent.Reason: #{email_log.reason}- STR+ TEXTwhen EmailLog- puts <<~STR+ puts <<~TEXTMail accepted by SMTP server.Message-ID: #{email_log.message_id}@@ -190,20 +190,20 @@ task 'emails:test', [:email] => [:environment] do |_, args|If the message is not delivered it is not a problem with Discourse.Check the SMTP server logs for the above Message ID to see why itfailed to deliver the message.- STR+ TEXTwhen nil- puts <<~STR+ puts <<~TEXTMail was not sent.Verify the status of the `disable_emails` site setting.- STR+ TEXTelse- puts <<~STR+ puts <<~TEXTSCRIPT BUG: Got back a #{email_log.class}#{email_log.inspect}Mail may or may not have been sent. Check the destination mailbox.- STR+ TEXTendrescue => errorputs "Sending mail failed."@@ -211,11 +211,11 @@ task 'emails:test', [:email] => [:environment] do |_, args|endif SiteSetting.disable_emails != 'no'- puts <<~STR+ puts <<~TEXT### WARNINGThe `disable_emails` site setting is currently set to #{SiteSetting.disable_emails}.Consider changing it to 'no' before performing any further troubleshooting.- STR+ TEXTendenddiff --git a/lib/tasks/javascript.rake b/lib/tasks/javascript.rakeindex 4a5d5cd6fb2..4af192ad647 100644--- a/lib/tasks/javascript.rake+++ b/lib/tasks/javascript.rake@@ -22,7 +22,7 @@ def html_for_section(group)" {{replace-emoji \":#{icon['name']}:\" (hash lazy=true#{class_attr})}}"end- <<~SECTION+ <<~HTML<div class="section" data-section="#{group["name"]}"><div class="section-header"><span class="title">{{i18n "emoji_picker.#{group["name"]}"}}</span>@@ -31,14 +31,14 @@ def html_for_section(group)#{icons.join("\n").strip}</div></div>- SECTION+ HTMLenddef write_template(path, task_name, template)- header = <<~HEADER+ header = <<~JS// DO NOT EDIT THIS FILE!!!// Update it by running `rake javascript:#{task_name}`- HEADER+ JSbasename = File.basename(path)output_path = "#{Rails.root}/app/assets/javascripts/#{path}"@@ -50,10 +50,10 @@ def write_template(path, task_name, template)enddef write_hbs_template(path, task_name, template)- header = <<~HEADER+ header = <<~HBS{{!-- DO NOT EDIT THIS FILE!!! --}}{{!-- Update it by running `rake javascript:#{task_name}` --}}- HEADER+ HBSbasename = File.basename(path)output_path = "#{Rails.root}/app/assets/javascripts/#{path}"@@ -244,11 +244,11 @@ task 'javascript:update_constants' => :environment dogroups_json = JSON.parse(File.read("lib/emoji/groups.json"))emoji_buttons = groups_json.map do |group|- <<~BUTTON+ <<~HTML<button type="button" data-section="#{group["name"]}" {{action onCategorySelection "#{group["name"]}"}} class="btn btn-default category-button emoji">{{replace-emoji ":#{group["tabicon"]}:"}}</button>- BUTTON+ HTMLendemoji_sections = groups_json.map { |group| html_for_section(group) }diff --git a/lib/tasks/populate.thor b/lib/tasks/populate.thorindex 50087729f86..52ad939eb47 100644--- a/lib/tasks/populate.thor+++ b/lib/tasks/populate.thor@@ -3,7 +3,7 @@# Generates posts and topicsclass Populate < Thordesc "posts", "Generate posts"- long_desc <<-LONGDESC+ long_desc <<-MDCreate topics with any number of posts, or add posts to an existing topic.Examples:@@ -20,7 +20,7 @@ class Populate < Thor> $ thor populate:posts -p 10 -n 5- LONGDESC+ MDmethod_option :num_posts, aliases: '-n', type: :numeric, required: true, desc: "Number of posts to make"method_option :users, aliases: '-u', type: :array, desc: "Usernames of users who will make the posts"method_option :title, aliases: '-t', desc: "The title of the topic, if making a new topic"diff --git a/lib/tasks/themes.rake b/lib/tasks/themes.rakeindex 387b9d18a43..83336f0a469 100644--- a/lib/tasks/themes.rake+++ b/lib/tasks/themes.rake@@ -118,7 +118,7 @@ task "themes:qunit", :type, :value do |t, args|type = args[:type]value = args[:value]if !%w(name url id).include?(type) || value.blank?- raise <<~MSG+ raise <<~TEXTWrong arguments type:#{type.inspect}, value:#{value.inspect}"Usage:`bundle exec rake "themes:qunit[url,<theme_url>]"`@@ -126,7 +126,7 @@ task "themes:qunit", :type, :value do |t, args|`bundle exec rake "themes:qunit[name,<theme_name>]"`OR`bundle exec rake "themes:qunit[id,<theme_id>]"`- MSG+ TEXTendENV["THEME_#{type.upcase}"] = value.to_sENV["QUNIT_RAILS_ENV"] ||= 'development' # qunit:test will switch to `test` by defaultdiff --git a/lib/tasks/uploads.rake b/lib/tasks/uploads.rakeindex 00079e05930..e3428629c08 100644--- a/lib/tasks/uploads.rake+++ b/lib/tasks/uploads.rake@@ -165,11 +165,11 @@ def clean_up_uploadsexit 1end- puts <<~OUTPUT+ puts <<~TEXTThis task will remove upload records and files permanently.Would you like to take a full backup before the clean up? (Y/N)- OUTPUT+ TEXTif STDIN.gets.chomp.downcase == 'y'puts "Starting backup..."@@ -420,7 +420,7 @@ task "uploads:analyze", [:cache_path, :limit] => :environment do |_, args|uploads_count = Upload.countoptimized_images_count = OptimizedImage.count- puts <<~REPORT+ puts <<~TEXTReport for '#{current_db}'-----------#{'-' * current_db.length}Number of `Upload` records in DB: #{uploads_count}@@ -430,7 +430,7 @@ task "uploads:analyze", [:cache_path, :limit] => :environment do |_, args|Number of images in uploads folder: #{paths_count}------------------------------------#{'-' * paths_count.to_s.length}- REPORT+ TEXThelper = Class.new doinclude ActionView::Helpers::NumberHelperdiff --git a/plugins/discourse-details/spec/components/pretty_text_spec.rb b/plugins/discourse-details/spec/components/pretty_text_spec.rbindex c208b762913..7c74a53c281 100644--- a/plugins/discourse-details/spec/components/pretty_text_spec.rb+++ b/plugins/discourse-details/spec/components/pretty_text_spec.rb@@ -28,13 +28,13 @@ describe PrettyText doendit 'can replace spoilers in emails' do- md = PrettyText.cook(<<~EOF)+ md = PrettyText.cook(<<~MD)hello[details="Summary"]world[/details]- EOF+ MDmd = PrettyText.format_for_email(md, post)html = "<p>hello</p>\n\nSummary <a href=\"#{post.full_url}\">(click for more details)</a>"@@ -42,7 +42,7 @@ describe PrettyText doendit 'properly handles multiple spoiler blocks in a post' do- md = PrettyText.cook(<<~EOF)+ md = PrettyText.cook(<<~MD)[details="First"]body secret stuff very long[/details]@@ -55,7 +55,7 @@ describe PrettyText do[details="Third"]body secret stuff very long[/details]- EOF+ MDmd = PrettyText.format_for_email(md, post)expect(md).not_to include('secret stuff')@@ -65,12 +65,12 @@ describe PrettyText doendit 'escapes summary text' do- md = PrettyText.cook(<<~EOF)+ md = PrettyText.cook(<<~MD)<script>alert('hello')</script>[details="<script>alert('hello')</script>"]<script>alert('hello')</script>[/details]- EOF+ MDmd = PrettyText.format_for_email(md, post)expect(md).not_to include('<script>')diff --git a/plugins/discourse-local-dates/spec/integration/local_dates_spec.rb b/plugins/discourse-local-dates/spec/integration/local_dates_spec.rbindex f1974732758..d8a10857f80 100644--- a/plugins/discourse-local-dates/spec/integration/local_dates_spec.rb+++ b/plugins/discourse-local-dates/spec/integration/local_dates_spec.rb@@ -8,9 +8,9 @@ RSpec.describe "Local Dates" doendit "should work without timezone" do- post = Fabricate(:post, raw: <<~TXT)+ post = Fabricate(:post, raw: <<~MD)[date=2018-05-08 time=22:00 format="L LTS" timezones="Europe/Paris|America/Los_Angeles"]- TXT+ MDcooked = post.cooked@@ -28,9 +28,9 @@ RSpec.describe "Local Dates" doendit "should work with timezone" do- post = Fabricate(:post, raw: <<~TXT)+ post = Fabricate(:post, raw: <<~MD)[date=2018-05-08 time=22:00 format="L LTS" timezone="Asia/Calcutta" timezones="Europe/Paris|America/Los_Angeles"]- TXT+ MDcooked = post.cooked@@ -39,9 +39,9 @@ RSpec.describe "Local Dates" doendit 'requires the right attributes to convert to a local date' do- post = Fabricate(:post, raw: <<~TXT)+ post = Fabricate(:post, raw: <<~MD)[date]- TXT+ MDcooked = post.cooked@@ -50,9 +50,9 @@ RSpec.describe "Local Dates" doendit 'requires the right attributes to convert to a local date' do- post = Fabricate(:post, raw: <<~TXT)+ post = Fabricate(:post, raw: <<~MD)[date]- TXT+ MDcooked = post.cookeddiff --git a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/advanced_user_narrative.rb b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/advanced_user_narrative.rbindex 53e4d39f602..dc5b1962c36 100644--- a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/advanced_user_narrative.rb+++ b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/advanced_user_narrative.rb@@ -163,11 +163,11 @@ module DiscourseNarrativeBotdef start_advanced_trackraw = I18n.t("#{I18N_KEY}.start_message", i18n_post_args(username: @user.username))- raw = <<~RAW+ raw = <<~MD#{raw}#{instance_eval(&@next_instructions)}- RAW+ MDopts = {title: I18n.t("#{I18N_KEY}.title"),@@ -197,11 +197,11 @@ module DiscourseNarrativeBotfake_delay- raw = <<~RAW+ raw = <<~MD#{I18n.t("#{I18N_KEY}.edit.reply", i18n_post_args)}#{instance_eval(&@next_instructions)}- RAW+ MDreply_to(@post, raw)end@@ -227,11 +227,11 @@ module DiscourseNarrativeBotfake_delay- raw = <<~RAW+ raw = <<~MD#{I18n.t("#{I18N_KEY}.delete.reply", i18n_post_args)}#{instance_eval(&@next_instructions)}- RAW+ MDPostCreator.create!(self.discobot_user,raw: raw,@@ -252,11 +252,11 @@ module DiscourseNarrativeBotfake_delay- raw = <<~RAW+ raw = <<~MD#{I18n.t("#{I18N_KEY}.recover.reply", i18n_post_args(deletion_after: SiteSetting.delete_removed_posts_after))}#{instance_eval(&@next_instructions)}- RAW+ MDPostCreator.create!(self.discobot_user,raw: raw,@@ -279,11 +279,11 @@ module DiscourseNarrativeBotreturn unless valid_topic?(topic_id)if Nokogiri::HTML5.fragment(@post.cooked).css('.hashtag').size > 0- raw = <<~RAW+ raw = <<~MD#{I18n.t("#{I18N_KEY}.category_hashtag.reply", i18n_post_args)}#{instance_eval(&@next_instructions)}- RAW+ MDfake_delayreply_to(@post, raw)@@ -308,11 +308,11 @@ module DiscourseNarrativeBotreturn unless valid_topic?(@topic_id)fake_delay- raw = <<~RAW+ raw = <<~MD#{I18n.t("#{I18N_KEY}.change_topic_notification_level.reply", i18n_post_args)}#{instance_eval(&@next_instructions)}- RAW+ MDfake_delay@@ -330,11 +330,11 @@ module DiscourseNarrativeBotreturn unless valid_topic?(topic_id)if Nokogiri::HTML5.fragment(@post.cooked).css(".poll").size > 0- raw = <<~RAW+ raw = <<~MD#{I18n.t("#{I18N_KEY}.poll.reply", i18n_post_args)}#{instance_eval(&@next_instructions)}- RAW+ MDfake_delayreply_to(@post, raw)diff --git a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/new_user_narrative.rb b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/new_user_narrative.rbindex cd8e96d7e1c..98ef6e4c8eb 100644--- a/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/new_user_narrative.rb+++ b/plugins/discourse-narrative-bot/lib/discourse_narrative_bot/new_user_narrative.rb@@ -175,11 +175,11 @@ module DiscourseNarrativeBotMessageBus.publish('/new_user_narrative/tutorial_search', {}, user_ids: [@user.id])- raw = <<~RAW+ raw = <<~MD#{post.raw}#{I18n.t("#{I18N_KEY}.search.hidden_message", i18n_post_args.merge(search_answer: NewUserNarrative.search_answer))}- RAW+ MDPostRevisor.new(post, topic).revise!(self.discobot_user,@@ -206,11 +206,11 @@ module DiscourseNarrativeBot))- raw = <<~RAW+ raw = <<~MD#{raw}#{instance_eval(&@next_instructions)}- RAW+ MDtitle = I18n.t("#{I18N_KEY}.hello.title", title: SiteSetting.title)if SiteSetting.max_emojis_in_title == 0@@ -259,11 +259,11 @@ module DiscourseNarrativeBotprofile_page_url = url_helpers(:user_url, username: @user.username)bookmark_url = "#{profile_page_url}/activity/bookmarks"- raw = <<~RAW+ raw = <<~MD#{I18n.t("#{I18N_KEY}.bookmark.reply", i18n_post_args(bookmark_url: bookmark_url))}#{instance_eval(&@next_instructions)}- RAW+ MDfake_delay@@ -279,11 +279,11 @@ module DiscourseNarrativeBot@post.post_analyzer.cook(@post.raw, {})if @post.post_analyzer.found_oneboxes?- raw = <<~RAW+ raw = <<~MD#{I18n.t("#{I18N_KEY}.onebox.reply", i18n_post_args)}#{instance_eval(&@next_instructions)}- RAW+ MDfake_delay@@ -315,11 +315,11 @@ module DiscourseNarrativeBotfake_delaylike_post(post)- raw = <<~RAW+ raw = <<~MD#{I18n.t("#{I18N_KEY}.images.reply", i18n_post_args)}#{instance_eval(&@next_instructions)}- RAW+ MDreply = reply_to(@post, raw)enqueue_timeout_job(@user)@@ -350,11 +350,11 @@ module DiscourseNarrativeBotset_state_data(:post_id, @post.id)if get_state_data(:liked)- raw = <<~RAW+ raw = <<~MD#{I18n.t("#{I18N_KEY}.images.reply", i18n_post_args)}#{instance_eval(&@next_instructions)}- RAW+ MDlike_post(@post)else@@ -405,11 +405,11 @@ module DiscourseNarrativeBot)if post_liked- raw = <<~RAW+ raw = <<~MD#{I18n.t("#{I18N_KEY}.likes.reply", i18n_post_args)}#{instance_eval(&@next_instructions)}- RAW+ MDfake_delay@@ -426,11 +426,11 @@ module DiscourseNarrativeBotreturn unless valid_topic?(post_topic_id)if Nokogiri::HTML5.fragment(@post.cooked).css("b", "strong", "em", "i", ".bbcode-i", ".bbcode-b").size > 0- raw = <<~RAW+ raw = <<~MD#{I18n.t("#{I18N_KEY}.formatting.reply", i18n_post_args)}#{instance_eval(&@next_instructions)}- RAW+ MDfake_delay@@ -452,11 +452,11 @@ module DiscourseNarrativeBotdoc = Nokogiri::HTML5.fragment(@post.cooked)if doc.css(".quote").size > 0- raw = <<~RAW+ raw = <<~MD#{I18n.t("#{I18N_KEY}.quoting.reply", i18n_post_args)}#{instance_eval(&@next_instructions)}- RAW+ MDfake_delay@@ -478,11 +478,11 @@ module DiscourseNarrativeBotdoc = Nokogiri::HTML5.fragment(@post.cooked)if doc.css(".emoji").size > 0- raw = <<~RAW+ raw = <<~MD#{I18n.t("#{I18N_KEY}.emoji.reply", i18n_post_args)}#{instance_eval(&@next_instructions)}- RAW+ MDfake_delay@@ -502,11 +502,11 @@ module DiscourseNarrativeBotreturn unless valid_topic?(post_topic_id)if bot_mentioned?(@post)- raw = <<~RAW+ raw = <<~MD#{I18n.t("#{I18N_KEY}.mention.reply", i18n_post_args)}#{instance_eval(&@next_instructions)}- RAW+ MDfake_delay@@ -552,11 +552,11 @@ module DiscourseNarrativeBotreturn unless valid_topic?(post_topic_id)return unless @post.user.id == -2- raw = <<~RAW+ raw = <<~MD#{I18n.t("#{I18N_KEY}.flag.reply", i18n_post_args)}#{instance_eval(&@next_instructions)}- RAW+ MDfake_delaydiff --git a/plugins/lazy-yt/plugin.rb b/plugins/lazy-yt/plugin.rbindex 1025fdfd955..494d5d14362 100644--- a/plugins/lazy-yt/plugin.rb+++ b/plugins/lazy-yt/plugin.rb@@ -36,7 +36,7 @@ class Onebox::Engine::YoutubeOnebox# Put in the LazyYT div instead of the iframeescaped_title = ERB::Util.html_escape(video_title)- <<~EOF+ <<~HTML<div class="onebox lazyYT lazyYT-container"data-youtube-id="#{video_id}"data-youtube-title="#{escaped_title}"@@ -49,7 +49,7 @@ class Onebox::Engine::YoutubeOneboxtitle="#{escaped_title}"></a></div>- EOF+ HTMLelseyt_onebox_to_htmlenddiff --git a/plugins/poll/spec/lib/new_post_manager_spec.rb b/plugins/poll/spec/lib/new_post_manager_spec.rbindex 4bee4c5a4fc..5f4c975cfc9 100644--- a/plugins/poll/spec/lib/new_post_manager_spec.rb+++ b/plugins/poll/spec/lib/new_post_manager_spec.rb@@ -39,12 +39,12 @@ describe NewPostManager doendit 're-validates the poll when the approve_post event is triggered' do- invalid_raw_poll = <<~RAW+ invalid_raw_poll = <<~MD[poll type=multiple min=0]* 1* 2[/poll]- RAW+ MDresult = NewPostManager.new(user, params).performdiff --git a/script/db_timestamps_mover.rb b/script/db_timestamps_mover.rbindex ad085692477..30701dd1f6f 100644--- a/script/db_timestamps_mover.rb+++ b/script/db_timestamps_mover.rb@@ -1,12 +1,12 @@# frozen_string_literal: truerequire "pg"-usage = <<-END+usage = <<-TEXTCommands:ruby db_timestamp_updater.rb yesterday <date> move all timestamps by x days so that <date> will be moved to yesterdayruby db_timestamp_updater.rb 100 move all timestamps forward by 100 daysruby db_timestamp_updater.rb -100 move all timestamps backward by 100 days-END+TEXTclass TimestampsUpdaterdef initialize(schema, ignore_tables)diff --git a/script/discourse b/script/discourseindex bca7197c309..03c40195406 100755--- a/script/discourse+++ b/script/discourse@@ -9,7 +9,7 @@ class DiscourseCLI < Thorenddesc "remap [--global,--regex] FROM TO", "Remap a string sequence across all tables"- long_desc <<-LONGDESC+ long_desc <<-TEXTReplace a string sequence FROM with TO across all tables.With --global option, the remapping is run on ***ALL***@@ -30,7 +30,7 @@ class DiscourseCLI < Thordiscourse remap talk.foo.com talk.bar.com # renaming a Discourse domain namediscourse remap --regex "\[\/?color(=[^\]]*)*]" "" # removing "color" bbcodes- LONGDESC+ TEXToption :global, type: :booleanoption :regex, type: :booleandef remap(from, to)diff --git a/script/import_scripts/google_groups.rb b/script/import_scripts/google_groups.rbindex 212702fc77d..494346292c1 100755--- a/script/import_scripts/google_groups.rb+++ b/script/import_scripts/google_groups.rb@@ -85,11 +85,11 @@ def crawl_topicsbeginif start == 1 && find("h2").text == "Error 403"- exit_with_error(<<~MSG.red.bold)+ exit_with_error(<<~TEXT.red.bold)Unable to find topics. Try running the script with the "--domain example.com"option if you are a G Suite user and your group's URL contains a path withyour domain that looks like "/a/example.com".- MSG+ TEXTendrescue Selenium::WebDriver::Error::NoSuchElementError# Ignore this error. It simply means there wasn't an error.@@ -151,10 +151,10 @@ def crawl_message(url, might_be_deleted)@first_message_checked = trueif content.match?(/From:.*\.\.\.@.*/i) && !@force_import- exit_with_error(<<~MSG.red.bold)+ exit_with_error(<<~TEXT.red.bold)It looks like you do not have permissions to see email addresses. Aborting.Use the --force option to import anyway.- MSG+ TEXTendenddiff --git a/script/import_scripts/ipboard.rb b/script/import_scripts/ipboard.rbindex 3f418ab5380..dcd8cb03f52 100644--- a/script/import_scripts/ipboard.rb+++ b/script/import_scripts/ipboard.rb@@ -114,28 +114,28 @@ class ImportScripts::IpboardSQL < ImportScripts::Baserescue Exception => eputs '=' * 50puts e.message- puts <<EOM-Cannot log in to database.--Hostname: #{DB_HOST}-Username: #{DB_USER}-Password: #{DB_PW}-database: #{DB_NAME}--You should set these variables:--export DB_HOST="localhost"-export DB_NAME="ipboard"-export DB_PW="ipboard"-export DB_USER="ipboard"-export TABLE_PREFIX="ipb_"-export IMPORT_AFTER="1970-01-01"-export URL="http://example.com"-export UPLOADS=-export USERDIR="user"--Exiting.-EOM+ puts <<~TEXT+ Cannot log in to database.++ Hostname: #{DB_HOST}+ Username: #{DB_USER}+ Password: #{DB_PW}+ database: #{DB_NAME}++ You should set these variables:++ export DB_HOST="localhost"+ export DB_NAME="ipboard"+ export DB_PW="ipboard"+ export DB_USER="ipboard"+ export TABLE_PREFIX="ipb_"+ export IMPORT_AFTER="1970-01-01"+ export URL="http://example.com"+ export UPLOADS=+ export USERDIR="user"++ Exiting.+ TEXTexitendenddiff --git a/script/import_scripts/modx.rb b/script/import_scripts/modx.rbindex d2031bd3364..1221dcc4428 100644--- a/script/import_scripts/modx.rb+++ b/script/import_scripts/modx.rb@@ -43,25 +43,25 @@ class ImportScripts::Modx < ImportScripts::Baserescue Exception => eputs '=' * 50puts e.message- puts <<EOM-Cannot connect in to database.+ puts <<~TEXT+ Cannot connect in to database.-Hostname: #{DB_HOST}-Username: #{DB_USER}-Password: #{DB_PW}-database: #{DB_NAME}+ Hostname: #{DB_HOST}+ Username: #{DB_USER}+ Password: #{DB_PW}+ database: #{DB_NAME}-Edit the script or set these environment variables:+ Edit the script or set these environment variables:-export DB_HOST="localhost"-export DB_NAME="modx"-export DB_PW="modx"-export DB_USER="modx"-export TABLE_PREFIX="modx_"-export ATTACHMENT_DIR '/path/to/your/attachment/folder'+ export DB_HOST="localhost"+ export DB_NAME="modx"+ export DB_PW="modx"+ export DB_USER="modx"+ export TABLE_PREFIX="modx_"+ export ATTACHMENT_DIR '/path/to/your/attachment/folder'-Exiting.-EOM+ Exiting.+ TEXTexitend@@ -446,12 +446,12 @@ FROM #{TABLE_PREFIX}discuss_users# keep track of closed topicsclosed_topic_ids = []- topics = mysql_query <<-MYSQL+ topics = mysql_query <<-SQLSELECT t.threadid threadid, firstpostid, openFROM #{TABLE_PREFIX}thread tJOIN #{TABLE_PREFIX}post p ON p.postid = t.firstpostidORDER BY t.threadid- MYSQL+ SQLtopics.each do |topic|topic_id = "thread-#{topic["threadid"]}"closed_topic_ids << topic_id if topic["open"] == 0diff --git a/script/import_scripts/mylittleforum.rb b/script/import_scripts/mylittleforum.rbindex aa7ebcccc8c..de82d141334 100644--- a/script/import_scripts/mylittleforum.rb+++ b/script/import_scripts/mylittleforum.rb@@ -58,27 +58,27 @@ class ImportScripts::MylittleforumSQL < ImportScripts::Baserescue Exception => eputs '=' * 50puts e.message- puts <<EOM-Cannot log in to database.--Hostname: #{DB_HOST}-Username: #{DB_USER}-Password: #{DB_PW}-database: #{DB_NAME}--You should set these variables:--export DB_HOST="localhost"-export DB_NAME="mylittleforum"-export DB_PW=""-export DB_USER="root"-export TABLE_PREFIX="forum_"-export IMPORT_AFTER="1970-01-01"-export IMAGE_BASE="http://www.example.com/forum"-export BASE="forum"--Exiting.-EOM+ puts <<~TEXT+ Cannot log in to database.++ Hostname: #{DB_HOST}+ Username: #{DB_USER}+ Password: #{DB_PW}+ database: #{DB_NAME}++ You should set these variables:++ export DB_HOST="localhost"+ export DB_NAME="mylittleforum"+ export DB_PW=""+ export DB_USER="root"+ export TABLE_PREFIX="forum_"+ export IMPORT_AFTER="1970-01-01"+ export IMAGE_BASE="http://www.example.com/forum"+ export BASE="forum"++ Exiting.+ TEXTexitendenddiff --git a/script/import_scripts/phpbb3/database/database.rb b/script/import_scripts/phpbb3/database/database.rbindex 725d932ab8f..ca0d1ee94fc 100644--- a/script/import_scripts/phpbb3/database/database.rb+++ b/script/import_scripts/phpbb3/database/database.rb@@ -26,10 +26,10 @@ module ImportScripts::PhpBB3require_relative 'database_3_1'Database_3_1.new(@database_client, @database_settings)else- raise UnsupportedVersionError, <<~MSG+ raise UnsupportedVersionError, <<~TEXTUnsupported version (#{version}) of phpBB detected.Currently only version 3.0, 3.1 and 3.2 are supported by this importer.- MSG+ TEXTendenddiff --git a/script/import_scripts/vbulletin.rb b/script/import_scripts/vbulletin.rbindex 5882fabd63d..30bfcfc1d1c 100644--- a/script/import_scripts/vbulletin.rb+++ b/script/import_scripts/vbulletin.rb@@ -53,25 +53,25 @@ class ImportScripts::VBulletin < ImportScripts::Baserescue Exception => eputs '=' * 50puts e.message- puts <<EOM-Cannot connect in to database.+ puts <<~TEXT+ Cannot connect in to database.-Hostname: #{DB_HOST}-Username: #{DB_USER}-Password: #{DB_PW}-database: #{DB_NAME}+ Hostname: #{DB_HOST}+ Username: #{DB_USER}+ Password: #{DB_PW}+ database: #{DB_NAME}-Edit the script or set these environment variables:+ Edit the script or set these environment variables:-export DB_HOST="localhost"-export DB_NAME="vbulletin"-export DB_PW=""-export DB_USER="root"-export TABLE_PREFIX="vb_"-export ATTACHMENT_DIR '/path/to/your/attachment/folder'+ export DB_HOST="localhost"+ export DB_NAME="vbulletin"+ export DB_PW=""+ export DB_USER="root"+ export TABLE_PREFIX="vb_"+ export ATTACHMENT_DIR '/path/to/your/attachment/folder'-Exiting.-EOM+ Exiting.+ TEXTexitend@@ -674,12 +674,12 @@ EOM# keep track of closed topicsclosed_topic_ids = []- topics = mysql_query <<-MYSQL+ topics = mysql_query <<-SQLSELECT t.threadid threadid, firstpostid, openFROM #{TABLE_PREFIX}thread tJOIN #{TABLE_PREFIX}post p ON p.postid = t.firstpostidORDER BY t.threadid- MYSQL+ SQLtopics.each do |topic|topic_id = "thread-#{topic["threadid"]}"closed_topic_ids << topic_id if topic["open"] == 0diff --git a/script/promote_migrations b/script/promote_migrationsindex a57ddde1a88..5dea7f00900 100755--- a/script/promote_migrations+++ b/script/promote_migrations@@ -100,9 +100,9 @@ endputs 'Done! File moves are staged and ready for commit.'puts 'Suggested commit message:'puts '-' * 20-puts <<~MESSAGE+puts <<~TEXTDEV: Promote historic post_deploy migrationsThis commit promotes all post_deploy migrations which existed in Discourse #{previous_stable_version} (timestamp <= #{promote_threshold})-MESSAGE+TEXTputs '-' * 20diff --git a/spec/fabricators/incoming_email_fabricator.rb b/spec/fabricators/incoming_email_fabricator.rbindex de76343f815..2b9db359b83 100644--- a/spec/fabricators/incoming_email_fabricator.rb+++ b/spec/fabricators/incoming_email_fabricator.rb@@ -8,7 +8,7 @@ Fabricator(:incoming_email) doimap_sync falsecreated_via 0- raw <<~RAW+ raw <<~EMAILReturn-Path: <[email protected]>From: Foo <[email protected]>@@ -20,5 +20,5 @@ Fabricator(:incoming_email) doContent-Transfer-Encoding: quoted-printableThe body contains "Hello world" too.- RAWenddiff --git a/spec/fabricators/post_fabricator.rb b/spec/fabricators/post_fabricator.rbindex 840dcd8ed0a..9b3b5d85f1b 100644--- a/spec/fabricators/post_fabricator.rb+++ b/spec/fabricators/post_fabricator.rb@@ -102,20 +102,20 @@ Fabricator(:post_with_uploads, from: :post) doendFabricator(:post_with_uploads_and_links, from: :post) do- raw <<~RAW+ raw <<~MD<a href="/#{Discourse.store.upload_path}/original/2X/2345678901234567.jpg">Link</a><img src="/#{Discourse.store.upload_path}/original/1X/1234567890123456.jpg"><a href="http://www.google.com">Google</a><img src="http://foo.bar/image.png"><a class="attachment" href="/#{Discourse.store.upload_path}/original/1X/af2c2618032c679333bebf745e75f9088748d737.txt">text.txt</a> (20 Bytes):smile:- RAW+ MDendFabricator(:post_with_external_links, from: :post) dousertopic- raw <<~RAW+ raw <<~MDHere's a link to twitter: http://twitter.comAnd a link to google: http://google.comAnd a secure link to google: https://google.com@@ -123,7 +123,7 @@ Fabricator(:post_with_external_links, from: :post) doAnd a markdown link with a period after it [codinghorror](http://www.codinghorror.com/blog).And one with a hash http://discourse.org#faqAnd one with a two hash http://discourse.org#a#b- RAW+ MDendFabricator(:private_message_post, from: :post) dodiff --git a/spec/integrity/coding_style_spec.rb b/spec/integrity/coding_style_spec.rbindex 49a5737844f..23e18abc1cc 100644--- a/spec/integrity/coding_style_spec.rb+++ b/spec/integrity/coding_style_spec.rb@@ -25,13 +25,13 @@ describe 'Coding style' dojs_files = list_js_files('app/assets/javascripts')offenses = grep_files(js_files, /this\.get\("\w+"\)/)- expect(offenses).to be_empty, <<~MSG+ expect(offenses).to be_empty, <<~TEXTDo not use this.get("foo") accessor for single property, insteadprefer to use this.fooOffenses:#{offenses.join("\n")}- MSG+ TEXTendend@@ -41,7 +41,7 @@ describe 'Coding style' doconstant_name_regex = /#{Regexp.escape(constant_name)}/offenses = files.reject { |file| is_valid?(file, method_name_regex, constant_name_regex) }- expect(offenses).to be_empty, <<~MSG+ expect(offenses).to be_empty, <<~TEXTYou need to use the constant #{constant_name} when you use#{method_name} in order to help with restoring backups.@@ -49,7 +49,7 @@ describe 'Coding style' doOffenses:#{offenses.join("\n")}- MSG+ TEXTenddef is_valid?(file, method_name_regex, constant_name_regex)diff --git a/spec/jobs/old_keys_reminder_spec.rb b/spec/jobs/old_keys_reminder_spec.rbindex bcbb2523669..1f6455ba193 100644--- a/spec/jobs/old_keys_reminder_spec.rb+++ b/spec/jobs/old_keys_reminder_spec.rb@@ -25,36 +25,36 @@ describe Jobs::OldKeysReminder doexpect(post.archetype).to eq(Archetype.private_message)expect(post.topic.topic_allowed_users.map(&:user_id).sort).to eq([Discourse.system_user.id, admin.id, another_admin.id].sort)expect(post.topic.title).to eq('Reminder about old credentials')- expect(post.raw).to eq(<<-MSG.rstrip)-Hello! This is a routine yearly security reminder from your Discourse instance.+ expect(post.raw).to eq(<<~TEXT.rstrip)+ Hello! This is a routine yearly security reminder from your Discourse instance.-As a courtesy, we wanted to let you know that the following credentials used on your Discourse instance have not been updated in more than two years:+ As a courtesy, we wanted to let you know that the following credentials used on your Discourse instance have not been updated in more than two years:-google_oauth2_client_secret - #{google_secret.updated_at.to_date.to_s(:db)}-github_client_secret - #{github_secret.updated_at.to_date.to_s(:db)}-api key description - #{api_key.created_at.to_date.to_s(:db)}+ google_oauth2_client_secret - #{google_secret.updated_at.to_date.to_s(:db)}+ github_client_secret - #{github_secret.updated_at.to_date.to_s(:db)}+ api key description - #{api_key.created_at.to_date.to_s(:db)}-No action is required at this time, however, it is considered good security practice to cycle all your important credentials every few years.- MSG+ No action is required at this time, however, it is considered good security practice to cycle all your important credentials every few years.+ TEXTpost.topic.destroyfreeze_time 4.years.from_nowdescribed_class.new.execute({})post = Post.lastexpect(post.topic.title).to eq('Reminder about old credentials')- expect(post.raw).to eq(<<-MSG.rstrip)-Hello! This is a routine yearly security reminder from your Discourse instance.+ expect(post.raw).to eq(<<~TEXT.rstrip)+ Hello! This is a routine yearly security reminder from your Discourse instance.-As a courtesy, we wanted to let you know that the following credentials used on your Discourse instance have not been updated in more than two years:+ As a courtesy, we wanted to let you know that the following credentials used on your Discourse instance have not been updated in more than two years:-google_oauth2_client_secret - #{google_secret.updated_at.to_date.to_s(:db)}-github_client_secret - #{github_secret.updated_at.to_date.to_s(:db)}-twitter_consumer_secret - #{recent_twitter_secret.updated_at.to_date.to_s(:db)}-api key description - #{api_key.created_at.to_date.to_s(:db)}-recent api key description - #{admin.username} - #{recent_api_key.created_at.to_date.to_s(:db)}+ google_oauth2_client_secret - #{google_secret.updated_at.to_date.to_s(:db)}+ github_client_secret - #{github_secret.updated_at.to_date.to_s(:db)}+ twitter_consumer_secret - #{recent_twitter_secret.updated_at.to_date.to_s(:db)}+ api key description - #{api_key.created_at.to_date.to_s(:db)}+ recent api key description - #{admin.username} - #{recent_api_key.created_at.to_date.to_s(:db)}-No action is required at this time, however, it is considered good security practice to cycle all your important credentials every few years.- MSG+ No action is required at this time, however, it is considered good security practice to cycle all your important credentials every few years.+ TEXTendit 'does not send message when send_old_credential_reminder_days is set to 0 or no old keys' dodiff --git a/spec/jobs/pull_hotlinked_images_spec.rb b/spec/jobs/pull_hotlinked_images_spec.rbindex 1a67b1dbce8..072ff276971 100644--- a/spec/jobs/pull_hotlinked_images_spec.rb+++ b/spec/jobs/pull_hotlinked_images_spec.rb@@ -122,12 +122,12 @@ describe Jobs::PullHotlinkedImages dostub_request(:get, "http://test.localhost/uploads/short-url/z2QSs1KJWoj51uYhDjb6ifCzxH6.gif").to_return(status: 200, body: "")- post = Fabricate(:post, raw: <<~RAW)+ post = Fabricate(:post, raw: <<~MD)<h1></h1><a href="https://somelink.com"><img alt="somelink" src="#{image_url}" /></a>- RAW+ MDexpect doJobs::PullHotlinkedImages.new.execute(post_id: post.id)@@ -135,12 +135,12 @@ describe Jobs::PullHotlinkedImages doupload = post.uploads.last- expect(post.reload.raw).to eq(<<~RAW.chomp)+ expect(post.reload.raw).to eq(<<~MD.chomp)<h1></h1><a href="https://somelink.com"></a>- RAW+ MDendit 'replaces correct image URL' do@@ -371,12 +371,12 @@ describe Jobs::PullHotlinkedImages doendit 'all combinations' do- post = Fabricate(:post, raw: <<~BODY)+ post = Fabricate(:post, raw: <<~MD)<img src='#{image_url}'>#{url}<img src='#{broken_image_url}'><a href='#{url}'><img src='#{large_image_url}'></a>- BODY+ MDstub_image_size2.times dodiff --git a/spec/lib/content_security_policy_spec.rb b/spec/lib/content_security_policy_spec.rbindex c8fbcb45c75..e662f2c0fa8 100644--- a/spec/lib/content_security_policy_spec.rb+++ b/spec/lib/content_security_policy_spec.rb@@ -327,13 +327,13 @@ describe ContentSecurityPolicy doit 'is extended automatically when themes reference external scripts' dopolicy # call this first to make sure further actions clear the cache- theme.set_field(target: :common, name: "header", value: <<~SCRIPT)+ theme.set_field(target: :common, name: "header", value: <<~HTML)<script src='https://example.com/myscript.js'></script><script src='https://example.com/myscript2.js?with=query'></script><script src='//example2.com/protocol-less-script.js'></script><script src='domain-only.com'></script><script>console.log('inline script')</script>- SCRIPT+ HTMLtheme.set_field(target: :desktop, name: "header", value: "")theme.save!diff --git a/spec/lib/email/authentication_results_spec.rb b/spec/lib/email/authentication_results_spec.rbindex 02ef205d2c2..2b4c2b3b844 100644--- a/spec/lib/email/authentication_results_spec.rb+++ b/spec/lib/email/authentication_results_spec.rb@@ -14,10 +14,10 @@ describe Email::AuthenticationResults doit "parses 'Service Provided, Authentication Done' correctly" do# https://tools.ietf.org/html/rfc8601#appendix-B.3- results = described_class.new(<<~EOF+ results = described_class.new(<<~RAWexample.com;spf=pass smtp.mailfrom=example.net- EOF+ RAW).resultsexpect(results[0][:authserv_id]).to eq "example.com"expect(results[0][:resinfo][0][:method]).to eq "spf"@@ -30,15 +30,15 @@ describe Email::AuthenticationResults doit "parses 'Service Provided, Several Authentications Done, Single MTA' correctly" do# https://tools.ietf.org/html/rfc8601#appendix-B.4- results = described_class.new([<<~EOF ,+ results = described_class.new([<<~RAW ,example.com;auth=pass (cram-md5) [email protected];spf=pass smtp.mailfrom=example.net- EOF- <<~EOF ,+ RAW+ <<~RAW ,example.com; iprev=passpolicy.iprev=192.0.2.200- EOF+ RAW]).resultsexpect(results[0][:authserv_id]).to eq "example.com"expect(results[0][:resinfo][0][:method]).to eq "auth"@@ -64,15 +64,15 @@ describe Email::AuthenticationResults doit "parses 'Service Provided, Several Authentications Done, Different MTAs' correctly" do# https://tools.ietf.org/html/rfc8601#appendix-B.5- results = described_class.new([<<~EOF ,+ results = described_class.new([<<~RAW ,example.com;dkim=pass (good signature) header.d=example.com- EOF- <<~EOF ,+ RAW+ <<~RAW ,example.com;auth=pass (cram-md5) [email protected];spf=fail smtp.mailfrom=example.com- EOF+ RAW]).resultsexpect(results[0][:authserv_id]).to eq "example.com"@@ -99,17 +99,17 @@ describe Email::AuthenticationResults doit "parses 'Service Provided, Multi-tiered Authentication Done' correctly" do# https://tools.ietf.org/html/rfc8601#appendix-B.6- results = described_class.new([<<~EOF ,+ results = described_class.new([<<~RAW ,example.com;dkim=pass reason="good signature"dkim=fail reason="bad signature"- EOF- <<~EOF ,+ RAW+ <<~RAW ,example.net;dkim=pass (good signature) [email protected]- EOF+ RAW]).resultsexpect(results[0][:authserv_id]).to eq "example.com"@@ -136,12 +136,12 @@ describe Email::AuthenticationResults doit "parses 'Comment-Heavy Example' correctly" do# https://tools.ietf.org/html/rfc8601#appendix-B.7- results = described_class.new(<<~EOF+ results = described_class.new(<<~RAWfoo.example.net (foobar) 1 (baz);dkim (Because I like it) / 1 (One yay) = (wait for it) failpolicy (A dot can go here) . (like that) expired(this surprised me) = (as I wasn't expecting it) 1362471462- EOF+ RAW).resultsexpect(results[0][:authserv_id]).to eq "foo.example.net"@@ -163,12 +163,12 @@ describe Email::AuthenticationResults doendit "parses header with multiple props correctly" do- results = described_class.new(<<~EOF+ results = described_class.new(<<~RAWmx.google.com;dkim=pass [email protected] header.s=20111006 header.b=URn9MW+F;spf=pass (google.com: domain of [email protected] designates 1.2.3.4 as permitted sender) [email protected];dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=email.example.com- EOF+ RAW).resultsexpect(results[0][:authserv_id]).to eq "mx.google.com"diff --git a/spec/lib/email/receiver_spec.rb b/spec/lib/email/receiver_spec.rbindex 10112f4ed35..c152e173254 100644--- a/spec/lib/email/receiver_spec.rb+++ b/spec/lib/email/receiver_spec.rb@@ -808,7 +808,7 @@ describe Email::Receiver dopost = Post.lastexpect(post.user.email).to eq("[email protected]")- expect(post.raw).to eq(<<~EOF.chomp+ expect(post.raw).to eq(<<~RAW.chomp)@team, can you have a look at this email below?[quote]@@ -823,8 +823,7 @@ describe Email::Receiver doXoXo[/quote]- EOF- )+ RAWendend@@ -976,7 +975,7 @@ describe Email::Receiver dolet!(:post) { Fabricate(:post, topic: topic) }def process_mail_with_message_id(message_id)- mail_string = <<~REPLY+ mail_string = <<~EMAILReturn-Path: <[email protected]>From: Two <[email protected]>@@ -989,7 +988,7 @@ describe Email::Receiver doContent-Transfer-Encoding: 7bitThis is email reply testing with Message-ID formats.- REPLYEmail::Receiver.new(mail_string).process!end@@ -1867,7 +1866,7 @@ describe Email::Receiver docontext "#select_body" dolet(:email) {- <<~EOFMIME-Version: 1.0Date: Tue, 01 Jan 2019 00:00:00 +0300Subject: An email with whitespaces@@ -1916,11 +1915,11 @@ describe Email::Receiver doThis is going to be stripped too.Bye!- EOF}let(:stripped_text) {- <<~EOF+ <<~MDThis is a line that will be strippedThis is another line that will be stripped@@ -1962,7 +1961,7 @@ describe Email::Receiver doThis is going to be stripped too.Bye!- EOF+ MD}it "strips lines if strip_incoming_email_lines is enabled" do@@ -1976,7 +1975,7 @@ describe Email::Receiver doit "works with empty mail body" doSiteSetting.strip_incoming_email_lines = true- email = <<~EOF+ email = <<~EMAILDate: Tue, 01 Jan 2019 00:00:00 +0300Subject: An email with whitespacesFrom: Foo <[email protected]>@@ -1986,7 +1985,7 @@ describe Email::Receiver do--my signature- EOFreceiver = Email::Receiver.new(email)text, _elided, _format = receiver.select_body@@ -2004,7 +2003,7 @@ describe Email::Receiver domessage_id: digest_message_id)}let(:email) {- <<~EOFMIME-Version: 1.0Date: Tue, 01 Jan 2019 00:00:00 +0300From: someone <#{user.email}>@@ -2017,7 +2016,7 @@ describe Email::Receiver dohello there! I like the digest!- EOF}before do@@ -2034,7 +2033,7 @@ describe Email::Receiver dolet(:user) { Fabricate(:user) }let(:group) { Fabricate(:group, users: [user]) }- let (:email_1) { <<~EOF+ let (:email_1) { <<~EMAILMIME-Version: 1.0Date: Wed, 01 Jan 2019 12:00:00 +0200Message-ID: <[email protected]>@@ -2052,7 +2051,7 @@ describe Email::Receiver doVivamus semper lacinia scelerisque. Cras urna magna, porttitor neclibero quis, congue viverra sapien. Nulla sodales ac tellus asuscipit.- EOF}let (:post_2) {@@ -2064,7 +2063,7 @@ describe Email::Receiver do)}- let (:email_3) { <<~EOF+ let (:email_3) { <<~EMAILMIME-Version: 1.0Date: Wed, 01 Jan 2019 12:00:00 +0200References: <[email protected]> <topic/#{post_2.topic_id}/#{post_2.id}@test.localhost>@@ -2087,7 +2086,7 @@ describe Email::Receiver dofelis. Sed pellentesque, massa auctor venenatis gravida, risus loremiaculis mi, at hendrerit nisi turpis sit amet metus. Nulla egestasante eget nisi luctus consectetur.- EOF}def receive(email_string)diff --git a/spec/lib/email_cook_spec.rb b/spec/lib/email_cook_spec.rbindex d47f5b91f80..f120233ce5c 100644--- a/spec/lib/email_cook_spec.rb+++ b/spec/lib/email_cook_spec.rb@@ -16,28 +16,28 @@ describe EmailCook doendit "doesn't add linebreaks to long lines" do- long = plaintext(<<~LONG_EMAIL)+ long = plaintext(<<~EMAIL)Hello,Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc convallis volutpatrisus. Nulla ac faucibus quam, quis cursus lorem. Sed rutrum eget nunc sed accumsan.Vestibulum feugiat mi vitae turpis tempor dignissim.- LONG_EMAIL- long_cooked = (+<<~LONG_COOKED).strip!+ long_cooked = (+<<~HTML).strip!Hello,<br><br>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc convallis volutpatrisus. Nulla ac faucibus quam, quis cursus lorem. Sed rutrum eget nunc sed accumsan.Vestibulum feugiat mi vitae turpis tempor dignissim.<br>- LONG_COOKED+ HTMLexpect(cook(long)).to eq(long_cooked)endit "replaces a blank line with 2 linebreaks" do- long = plaintext(<<~LONG_EMAIL)+ long = plaintext(<<~EMAIL)Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc convallis volutpatrisus.Nulla ac faucibus quam, quis cursus lorem. Sed rutrum eget nunc sed accumsan.@@ -45,9 +45,9 @@ describe EmailCook doVestibulum feugiat mi vitae turpis tempor dignissim.Stet clita kasd gubergren.- LONG_EMAIL- long_cooked = (+<<~LONG_COOKED).strip!+ long_cooked = (+<<~HTML).strip!Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc convallis volutpatrisus.<br>Nulla ac faucibus quam, quis cursus lorem. Sed rutrum eget nunc sed accumsan.@@ -56,13 +56,13 @@ describe EmailCook do<br><br>Stet clita kasd gubergren.<br>- LONG_COOKED+ HTMLexpect(cook(long)).to eq(long_cooked)endit "escapes HTML" do- long = plaintext(<<~LONG_EMAIL)+ long = plaintext(<<~EMAIL)Lorem ipsum dolor sit amet, consectetur adipiscing elit.<form name="f1" method="post" action="test.html" onsubmit="javascript:showAlert()">@@ -70,9 +70,9 @@ describe EmailCook do</form>Nunc convallis volutpat risus.- LONG_EMAIL- long_cooked = (+<<~LONG_COOKED).strip!+ long_cooked = (+<<~HTML).strip!Lorem ipsum dolor sit amet, consectetur adipiscing elit.<br><br><form name="f1" method="post" action="test.html" onsubmit="javascript:showAlert()">@@ -81,29 +81,29 @@ describe EmailCook do<br><br>Nunc convallis volutpat risus.<br>- LONG_COOKED+ HTMLexpect(cook(long)).to eq(long_cooked)endit "replaces indentation of more than 2 spaces with corresponding amount of non-breaking spaces" donbsp = "\u00A0"- long = plaintext(<<~LONG_EMAIL)+ long = plaintext(<<~EMAIL)Lorem ipsum dolor sit amet, consectetur adipiscing elit.this is intended by 4 spacesthis is intended by 1 spaceno indentation, but lots of spaces- LONG_EMAIL- long_cooked = (+<<~LONG_COOKED).strip!+ long_cooked = (+<<~HTML).strip!Lorem ipsum dolor sit amet, consectetur adipiscing elit.<br><br>#{nbsp}#{nbsp}#{nbsp}#{nbsp}this is intended by 4 spaces<br> this is intended by 1 space<br>no indentation, but lots of spaces<br>- LONG_COOKED+ HTMLexpect(cook(long)).to eq(long_cooked)end@@ -129,7 +129,7 @@ describe EmailCook doendit "it works and does not interpret Markdown in plaintext and elided" do- long = <<~LONG_EMAIL+ long = <<~EMAIL[plaintext]*Lorem ipsum* dolor sit amet, consectetur adipiscing elit.[/plaintext]@@ -139,9 +139,9 @@ describe EmailCook do[elided]At vero eos *et accusam* et justo duo dolores et ea rebum.[/elided]- LONG_EMAIL- long_cooked = <<~LONG_COOKED+ long_cooked = <<~HTML*Lorem ipsum* dolor sit amet, consectetur adipiscing elit.<br><br><img src='some_image.png' width='100' height='100'><br><br>@@ -152,22 +152,22 @@ describe EmailCook doAt vero eos *et accusam* et justo duo dolores et ea rebum.<br></details>- LONG_COOKED+ HTMLexpect(cook(long)).to eq(long_cooked)endit "works without attachments" do- long = <<~LONG_EMAIL+ long = <<~EMAIL[plaintext]*Lorem ipsum* dolor sit amet, consectetur adipiscing elit.[/plaintext][elided]At vero eos *et accusam* et justo duo dolores et ea rebum.[/elided]- LONG_EMAIL- long_cooked = <<~LONG_COOKED+ long_cooked = <<~HTML*Lorem ipsum* dolor sit amet, consectetur adipiscing elit.<br><br><br>@@ -177,7 +177,7 @@ describe EmailCook doAt vero eos *et accusam* et justo duo dolores et ea rebum.<br></details>- LONG_COOKED+ HTMLexpect(cook(long)).to eq(long_cooked)enddiff --git a/spec/lib/pretty_text_spec.rb b/spec/lib/pretty_text_spec.rbindex 8b213fb0c49..b5b884051b4 100644--- a/spec/lib/pretty_text_spec.rb+++ b/spec/lib/pretty_text_spec.rb@@ -353,7 +353,7 @@ describe PrettyText doexpect(PrettyText.cook("[quote]\ntest")).not_to include('aside')expect(PrettyText.cook("[quote]\ntest\n[/quote]z")).not_to include('aside')- nested = <<~QUOTE+ nested = <<~MD[quote]a[quote]@@ -361,7 +361,7 @@ describe PrettyText do[/quote]c[/quote]- QUOTE+ MDcooked = PrettyText.cook(nested)expect(cooked.scan('aside').length).to eq(4)@@ -799,9 +799,9 @@ describe PrettyText docontext "emojis" doit "should remove broken emoji" do- html = <<~EOS+ html = <<~HTML<img src=\"//localhost:3000/images/emoji/twitter/bike.png?v=#{Emoji::EMOJI_VERSION}\" title=\":bike:\" class=\"emoji\" alt=\":bike:\" loading=\"lazy\" width=\"20\" height=\"20\"> <img src=\"//localhost:3000/images/emoji/twitter/cat.png?v=#{Emoji::EMOJI_VERSION}\" title=\":cat:\" class=\"emoji\" alt=\":cat:\" loading=\"lazy\" width=\"20\" height=\"20\"> <img src=\"//localhost:3000/images/emoji/twitter/discourse.png?v=#{Emoji::EMOJI_VERSION}\" title=\":discourse:\" class=\"emoji\" alt=\":discourse:\" loading=\"lazy\" width=\"20\" height=\"20\">- EOS+ HTMLexpect(PrettyText.excerpt(html, 7)).to eq(":bike: …")expect(PrettyText.excerpt(html, 8)).to eq(":bike: …")expect(PrettyText.excerpt(html, 9)).to eq(":bike: …")@@ -914,7 +914,7 @@ describe PrettyText doendit "should not extract links inside oneboxes" do- onebox = <<~EOF+ onebox = <<~HTML<aside class="onebox twitterstatus" data-onebox-src="https://twitter.com/EDBPostgres/status/1402528437441634306"><header class="source"><a href="https://twitter.com/EDBPostgres/status/1402528437441634306" target="_blank" rel="noopener">twitter.com</a>@@ -924,7 +924,7 @@ describe PrettyText do<div class="tweet">Example URL: <a target="_blank" href="https://example.com" rel="noopener">example.com</a></div></article></aside>- EOF+ HTMLexpect(PrettyText.extract_links(onebox).map(&:url)).to contain_exactly("https://twitter.com/EDBPostgres/status/1402528437441634306")end@@ -938,12 +938,13 @@ describe PrettyText doendit "handles custom bbcode excerpt" do- raw = <<~RAW+ raw = <<~MD[excerpt]hello [site](https://site.com)[/excerpt]more stuff- RAW+ MD+post = Fabricate(:post, raw: raw)expect(post.excerpt).to eq("hello <a href=\"https://site.com\" rel=\"noopener nofollow ugc\">site</a>")end@@ -1929,17 +1930,17 @@ HTMLit "can properly allowlist iframes" doSiteSetting.allowed_iframes = "https://bob.com/a|http://silly.com?EMBED="- raw = <<~IFRAMES+ raw = <<~HTML<iframe src='https://www.google.com/maps/Embed?testing'></iframe><iframe src='https://bob.com/a?testing'></iframe><iframe src='HTTP://SILLY.COM?EMBED=111'></iframe>- IFRAMES+ HTML# we require explicit HTTPS here- html = <<~IFRAMES+ html = <<~HTML<iframe src="https://bob.com/a?testing"></iframe><iframe src="HTTP://SILLY.COM?EMBED=111"></iframe>- IFRAMES+ HTMLcooked = PrettyText.cook(raw).stripdiff --git a/spec/lib/search_spec copy.rb b/spec/lib/search_spec copy.rbindex cff820c6025..c0b7d5efb06 100644--- a/spec/lib/search_spec copy.rb+++ b/spec/lib/search_spec copy.rb@@ -551,9 +551,9 @@ describe Search doresult = Search.execute('search term')- expect(result.posts.first.topic_title_headline).to eq(<<~TITLE.chomp)+ expect(result.posts.first.topic_title_headline).to eq(<<~HTML.chomp)Very very very very very very very long topic title with our <span class=\"#{Search::HIGHLIGHT_CSS_CLASS}\">search</span> <span class=\"#{Search::HIGHLIGHT_CSS_CLASS}\">term</span> in the middle of the title- TITLE+ HTMLendit "limits the search headline to #{Search::GroupedSearchResults::BLURB_LENGTH} characters" dodiff --git a/spec/lib/version_spec.rb b/spec/lib/version_spec.rbindex c9012037031..284a6e64e77 100644--- a/spec/lib/version_spec.rb+++ b/spec/lib/version_spec.rb@@ -76,25 +76,25 @@ describe Discourse::VERSION doendcontext "with a regular compatible list" do- let(:version_list) { <<~VERSION_LIST+ let(:version_list) { <<~YML2.5.0.beta6: twofivebetasix2.5.0.beta4: twofivebetafour2.5.0.beta2: twofivebetatwo2.4.4.beta6: twofourfourbetasix2.4.2.beta1: twofourtwobetaone- VERSION_LIST+ YML}include_examples "test compatible resource"endcontext "handle a compatible resource out of order" do- let(:version_list) { <<~VERSION_LIST+ let(:version_list) { <<~YML2.4.2.beta1: twofourtwobetaone2.5.0.beta4: twofivebetafour2.5.0.beta6: twofivebetasix2.5.0.beta2: twofivebetatwo2.4.4.beta6: twofourfourbetasix- VERSION_LIST+ YML}include_examples "test compatible resource"enddiff --git a/spec/mailers/group_smtp_mailer_spec.rb b/spec/mailers/group_smtp_mailer_spec.rbindex afca00f11e5..e8e2dcc47a4 100644--- a/spec/mailers/group_smtp_mailer_spec.rb+++ b/spec/mailers/group_smtp_mailer_spec.rb@@ -28,7 +28,7 @@ describe GroupSmtpMailer doendlet(:email) do- <<~EOFDelivered-To: [email protected]MIME-Version: 1.0From: John Doe <[email protected]>@@ -41,7 +41,7 @@ describe GroupSmtpMailer doHello,How are you doing?- EOFendlet(:receiver) dodiff --git a/spec/models/theme_field_spec.rb b/spec/models/theme_field_spec.rbindex d09c7625b61..f2bf4b88ca2 100644--- a/spec/models/theme_field_spec.rb+++ b/spec/models/theme_field_spec.rb@@ -92,10 +92,10 @@ describe ThemeField do<script>var b = 10</script>HTML- extracted = <<~JavaScript+ extracted = <<~JSvar a = 10var b = 10- JavaScript+ JStheme_field = ThemeField.create!(theme_id: 1, target_id: 0, name: "header", value: html)theme_field.ensure_baked!diff --git a/spec/models/theme_spec.rb b/spec/models/theme_spec.rbindex 50424e2c477..17175164084 100644--- a/spec/models/theme_spec.rb+++ b/spec/models/theme_spec.rb@@ -326,10 +326,10 @@ HTMLexpect(scss).to include("font-size:30px")# Escapes correctly. If not, compiling this would throw an exception- setting.value = <<~MULTILINE+ setting.value = <<~CSS\#{$fakeinterpolatedvariable}andanothervalue 'withquotes'; margin: 0;- MULTILINE+ CSStheme.set_field(target: :common, name: :scss, value: 'body {font-size: quote($font-size)}')theme.save!diff --git a/spec/models/topic_embed_spec.rb b/spec/models/topic_embed_spec.rbindex abd7cd57f66..9c434a6fd14 100644--- a/spec/models/topic_embed_spec.rb+++ b/spec/models/topic_embed_spec.rb@@ -390,10 +390,10 @@ describe TopicEmbed doit "handles malformed links" dourl = "https://somesource.com"- contents = <<~CONTENT+ contents = <<~HTMLhello world new post <a href="mailto:[email protected]>">hello</a>some image <img src="https:/><invalidimagesrc/">- CONTENT+ HTMLraw = TopicEmbed.absolutize_urls(url, contents)expect(raw).to eq(contents)diff --git a/spec/requests/admin/backups_controller_spec.rb b/spec/requests/admin/backups_controller_spec.rbindex 673d42dee28..01a0732b991 100644--- a/spec/requests/admin/backups_controller_spec.rb+++ b/spec/requests/admin/backups_controller_spec.rb@@ -454,14 +454,14 @@ RSpec.describe Admin::BackupsController doBackupRestore::S3BackupStore.any_instance.stubs(:temporary_upload_path).returns("temp/default/#{test_bucket_prefix}/28fccf8259bbe75b873a2bd2564b778c/2u98j832nx93272x947823.gz")- create_multipart_result = <<~BODY+ create_multipart_result = <<~XML<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<InitiateMultipartUploadResult><Bucket>s3-backup-bucket</Bucket><Key>temp/default/#{test_bucket_prefix}/28fccf8259bbe75b873a2bd2564b778c/2u98j832nx93272x947823.gz</Key><UploadId>#{mock_multipart_upload_id}</UploadId></InitiateMultipartUploadResult>- BODY+ XMLstub_request(:post, "https://s3-backup-bucket.s3.us-west-1.amazonaws.com/temp/default/#{test_bucket_prefix}/28fccf8259bbe75b873a2bd2564b778c/2u98j832nx93272x947823.gz?uploads").to_return(status: 200, body: create_multipart_result)enddiff --git a/spec/requests/api/search_spec.rb b/spec/requests/api/search_spec.rbindex dc9f63fc769..5335b465f76 100644--- a/spec/requests/api/search_spec.rb+++ b/spec/requests/api/search_spec.rb@@ -20,7 +20,7 @@ describe 'groups' doin: :query,type: :string,example: 'api @blake #support tags:api after:2021-06-04 in:unseen in:open order:latest_topic',- description: <<~HEREDOC+ description: <<~MDThe query string needs to be url encoded and is made up of the following options:- Search term. This is just a string. Usually it would be the first item in the query.- `@<username>`: Use the `@` followed by the username to specify posts by this user.@@ -44,7 +44,7 @@ describe 'groups' docurl -i -sS -X GET -G "http://localhost:4200/search.json" \\--data-urlencode 'q=wordpress @scossar #fun after:2020-01-01'```- HEREDOC+ MD)parameter name: :page, in: :query, type: :integer, example: 1diff --git a/spec/requests/api/uploads_spec.rb b/spec/requests/api/uploads_spec.rbindex 61e13ac002f..55b7d297dd6 100644--- a/spec/requests/api/uploads_spec.rb+++ b/spec/requests/api/uploads_spec.rb@@ -52,7 +52,7 @@ describe 'uploads' dotags 'Uploads'operationId 'generatePresignedPut'consumes 'application/json'- description <<~HEREDOC+ description <<~TEXTDirect external uploads bypass the usual method of creating uploadsvia the POST /uploads route, and upload directly to an external provider,which by default is S3. This route begins the process, and will return@@ -66,7 +66,7 @@ describe 'uploads' dodestination in the external storage service.#{direct_uploads_disclaimer}- HEREDOC+ TEXTexpected_request_schema = load_spec_schema('upload_generate_presigned_put_request')parameter name: :params, in: :body, schema: expected_request_schema@@ -108,7 +108,7 @@ describe 'uploads' dotags 'Uploads'operationId 'completeExternalUpload'consumes 'application/json'- description <<~HEREDOC+ description <<~TEXTCompletes an external upload initialized with /get-presigned-put. Thefile will be moved from its temporary location in external storage toa final destination in the S3 bucket. An Upload record will also be@@ -119,7 +119,7 @@ describe 'uploads' dofile was uploaded. The file size will be compared for the same reason.#{direct_uploads_disclaimer}- HEREDOC+ TEXTexpected_request_schema = load_spec_schema('upload_complete_external_upload_request')parameter name: :params, in: :body, schema: expected_request_schema@@ -154,12 +154,12 @@ describe 'uploads' dotags 'Uploads'operationId 'createMultipartUpload'consumes 'application/json'- description <<~HEREDOC+ description <<~TEXTCreates a multipart upload in the external storage provider, storinga temporary reference to the external upload similar to /get-presigned-put.#{direct_uploads_disclaimer}- HEREDOC+ TEXTexpected_request_schema = load_spec_schema('upload_create_multipart_request')parameter name: :params, in: :body, schema: expected_request_schema@@ -200,7 +200,7 @@ describe 'uploads' dotags 'Uploads'operationId 'batchPresignMultipartParts'consumes 'application/json'- description <<~HEREDOC+ description <<~TEXTMultipart uploads are uploaded in chunks or parts to individual presignedURLs, similar to the one generated by /generate-presigned-put. The partnumbers provided must be between 1 and 10000. The total number of parts@@ -215,7 +215,7 @@ describe 'uploads' dobecause this is needed to complete the multipart upload.#{direct_uploads_disclaimer}- HEREDOC+ TEXTexpected_request_schema = load_spec_schema('upload_batch_presign_multipart_parts_request')parameter name: :params, in: :body, schema: expected_request_schema@@ -255,13 +255,13 @@ describe 'uploads' dotags 'Uploads'operationId 'abortMultipart'consumes 'application/json'- description <<~HEREDOC+ description <<~TEXTThis endpoint aborts the multipart upload initiated with /create-multipart.This should be used when cancelling the upload. It does not matter if partswere already uploaded into the external storage provider.#{direct_uploads_disclaimer}- HEREDOC+ TEXTexpected_request_schema = load_spec_schema('upload_abort_multipart_request')parameter name: :params, in: :body, schema: expected_request_schema@@ -299,7 +299,7 @@ describe 'uploads' dotags 'Uploads'operationId 'completeMultipart'consumes 'application/json'- description <<~HEREDOC+ description <<~TEXTCompletes the multipart upload in the external store, and copies thefile from its temporary location to its final location in the store.All of the parts must have been uploaded to the external storage provider.@@ -307,7 +307,7 @@ describe 'uploads' doto its final location.#{direct_uploads_disclaimer}- HEREDOC+ TEXTexpected_request_schema = load_spec_schema('upload_complete_multipart_request')parameter name: :params, in: :body, schema: expected_request_schemadiff --git a/spec/requests/metadata_controller_spec.rb b/spec/requests/metadata_controller_spec.rbindex a0037c05b95..2245c8f8935 100644--- a/spec/requests/metadata_controller_spec.rb+++ b/spec/requests/metadata_controller_spec.rb@@ -125,13 +125,13 @@ RSpec.describe MetadataController doendit 'returns the right output' do- SiteSetting.app_association_android = <<~EOF+ SiteSetting.app_association_android = <<~JSON[{"relation": ["delegate_permission/common.handle_all_urls"],"target" : { "namespace": "android_app", "package_name": "com.example.app","sha256_cert_fingerprints": ["hash_of_app_certificate"] }}]- EOF+ JSONget "/.well-known/assetlinks.json"expect(response.headers["Cache-Control"]).to eq('max-age=60, private')@@ -150,13 +150,13 @@ RSpec.describe MetadataController doendit 'returns the right output' do- SiteSetting.app_association_ios = <<~EOF+ SiteSetting.app_association_ios = <<~JSON{"applinks": {"apps": []}}- EOF+ JSONget "/apple-app-site-association"expect(response.status).to eq(200)diff --git a/spec/requests/uploads_controller_spec.rb b/spec/requests/uploads_controller_spec.rbindex 4043c018c81..94531e6c0c3 100644--- a/spec/requests/uploads_controller_spec.rb+++ b/spec/requests/uploads_controller_spec.rb@@ -831,14 +831,14 @@ describe UploadsController doFileStore::S3Store.any_instance.stubs(:temporary_upload_path).returns("uploads/default/#{test_bucket_prefix}/temp/28fccf8259bbe75b873a2bd2564b778c/test.png")- create_multipart_result = <<~BODY+ create_multipart_result = <<~XML<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<InitiateMultipartUploadResult><Bucket>s3-upload-bucket</Bucket><Key>uploads/default/#{test_bucket_prefix}/temp/28fccf8259bbe75b873a2bd2564b778c/test.png</Key><UploadId>#{mock_multipart_upload_id}</UploadId></InitiateMultipartUploadResult>- BODY+ XMLstub_request(:post,"https://s3-upload-bucket.s3.us-west-1.amazonaws.com/uploads/default/#{test_bucket_prefix}/temp/28fccf8259bbe75b873a2bd2564b778c/test.png?uploads"@@ -948,7 +948,7 @@ describe UploadsController doenddef stub_list_multipart_request- list_multipart_result = <<~BODY+ list_multipart_result = <<~XML<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ListPartsResult><Bucket>s3-upload-bucket</Bucket>@@ -974,7 +974,7 @@ describe UploadsController do</Owner><StorageClass>STANDARD</StorageClass></ListPartsResult>- BODY+ XMLstub_request(:get, "https://s3-upload-bucket.s3.us-west-1.amazonaws.com/#{external_upload_stub.key}?max-parts=1&uploadId=#{mock_multipart_upload_id}").to_return({ status: 200, body: list_multipart_result })end@@ -1092,7 +1092,7 @@ describe UploadsController doenddef stub_list_multipart_request- list_multipart_result = <<~BODY+ list_multipart_result = <<~XML<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<ListPartsResult><Bucket>s3-upload-bucket</Bucket>@@ -1118,7 +1118,7 @@ describe UploadsController do</Owner><StorageClass>STANDARD</StorageClass></ListPartsResult>- BODY+ XMLstub_request(:get, "#{upload_base_url}/#{external_upload_stub.key}?max-parts=1&uploadId=#{mock_multipart_upload_id}").to_return({ status: 200, body: list_multipart_result })enddiff --git a/spec/services/external_upload_manager_spec.rb b/spec/services/external_upload_manager_spec.rbindex f7abdd8b136..d6de0da8fde 100644--- a/spec/services/external_upload_manager_spec.rb+++ b/spec/services/external_upload_manager_spec.rb@@ -292,14 +292,14 @@ RSpec.describe ExternalUploadManager doenddef copy_object_result- <<~BODY+ <<~XML<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<CopyObjectResultxmlns=\"http://s3.amazonaws.com/doc/2006-03-01/\"><LastModified>2021-07-19T04:10:41.000Z</LastModified><ETag>"#{etag}"</ETag></CopyObjectResult>- BODY+ XMLenddef stub_copy_objectdiff --git a/spec/services/post_alerter_spec.rb b/spec/services/post_alerter_spec.rbindex 9fe7c166fa6..90d5db509d5 100644--- a/spec/services/post_alerter_spec.rb+++ b/spec/services/post_alerter_spec.rb@@ -175,9 +175,9 @@ describe PostAlerter dopost = Fabricate(:post, topic: pm, user: user1)TopicUser.change(user1.id, pm.id, notification_level: TopicUser.notification_levels[:regular])- quote_raw = <<~STRING+ quote_raw = <<~MD[quote="#{user1.username}, post:1, topic:#{pm.id}"]#{post.raw}[/quote]- STRING+ MDexpect {create_post_with_alerts(@@ -190,9 +190,9 @@ describe PostAlerter dogroup.add(admin)TopicUser.change(user2.id, pm.id, notification_level: TopicUser.notification_levels[:regular])- quote_raw = <<~STRING+ quote_raw = <<~MD[quote="#{user2.username}, post:1, topic:#{pm.id}"]#{op.raw}[/quote]- STRING+ MDexpect {create_post_with_alerts(@@ -1566,7 +1566,7 @@ describe PostAlerter doenddef create_post_with_incoming- raw_mail = <<~MAIL+ raw_mail = <<~EMAILFrom: Foo <[email protected]>@@ -1578,7 +1578,7 @@ describe PostAlerter doContent-Transfer-Encoding: 7bitThis is the first email.Email::Receiver.new(raw_mail, {}).process!end@@ -1716,7 +1716,7 @@ describe PostAlerter doemail = ActionMailer::Base.deliveries.last# the reply post from someone who was emailed- reply_raw_mail = <<~MAIL+ reply_raw_mail = <<~EMAILFrom: Bar <[email protected]>@@ -1729,7 +1729,7 @@ describe PostAlerter doContent-Transfer-Encoding: 7bitHey here is my reply!reply_post_from_email = nilexpect {@@ -1767,7 +1767,7 @@ describe PostAlerter doemail = ActionMailer::Base.deliveries.last# the reply post from someone who was emailed- reply_raw_mail = <<~MAIL+ reply_raw_mail = <<~EMAILFrom: Foo <[email protected]>@@ -1780,7 +1780,7 @@ describe PostAlerter doContent-Transfer-Encoding: 7bitI am ~~Commander Shepherd~~ the OP and I approve of this message.reply_post_from_email = nilexpect {@@ -1811,7 +1811,7 @@ describe PostAlerter do# this is a special case where we are not CC'ing on the original email,# only on the follow up email- raw_mail = <<~MAIL+ raw_mail = <<~EMAILFrom: Foo <[email protected]>Subject: Full email group username flow@@ -1822,7 +1822,7 @@ describe PostAlerter doContent-Transfer-Encoding: 7bitThis is the first email.incoming_email_post = Email::Receiver.new(raw_mail, {}).process!topic = incoming_email_post.topic@@ -1833,7 +1833,7 @@ describe PostAlerter doemail = ActionMailer::Base.deliveries.last# the reply post from the OP, cc'ing new people in- reply_raw_mail = <<~MAIL+ reply_raw_mail = <<~EMAILFrom: Foo <[email protected]>@@ -1846,7 +1846,7 @@ describe PostAlerter doContent-Transfer-Encoding: 7bitI am inviting my mates to this email party.reply_post_from_email = nilexpect {diff --git a/spec/swagger_helper.rb b/spec/swagger_helper.rbindex 884b2029490..537c216fe02 100644--- a/spec/swagger_helper.rb+++ b/spec/swagger_helper.rb@@ -14,7 +14,7 @@ def load_spec_schema(name)enddef api_docs_description- <<~HEREDOC+ <<~MDThis page contains the documentation on how to use Discourse through API calls.> Note: For any endpoints not listed you can follow the@@ -71,11 +71,11 @@ def api_docs_descriptionIf an endpoint accepts a boolean be sure to specify it as a lowercase`true` or `false` value unless noted otherwise.- HEREDOC+ MDenddef direct_uploads_disclaimer- <<~HEREDOC+ <<~MDYou must have the correct permissions and CORS settings configured in yourexternal provider. We support AWS S3 as the default. See:@@ -83,7 +83,7 @@ def direct_uploads_disclaimerAn external file store must be set up and `enable_direct_s3_uploads` mustbe set to true for this endpoint to function.- HEREDOC+ MDendRSpec.configure do |config|