A platform for community discussion. Free, open, simple.
FIX: ensures autogrid works with French spacing (#33823)
Joffrey JAFFEUX264389603e1b
diff --git a/app/assets/javascripts/discourse/app/lib/uppy/composer-upload.js b/app/assets/javascripts/discourse/app/lib/uppy/composer-upload.jsindex 2966bcd24e1..e175438dae6 100644--- a/app/assets/javascripts/discourse/app/lib/uppy/composer-upload.js+++ b/app/assets/javascripts/discourse/app/lib/uppy/composer-upload.js@@ -640,7 +640,9 @@ export default class UppyComposerUpload {}const uploadingImagePattern = new RegExp(- "\\[" + uploadingTextMatch[0].trim() + ": ([^\\]]+?)\\.\\w+…\\]\\(\\)",+ "\\[" ++ uploadingTextMatch[0].trim() ++ "\\s?: ([^\\]]+?)\\.\\w+…\\]\\(\\)","g");@@ -654,7 +656,7 @@ export default class UppyComposerUpload {imagePlaceholder = imagePlaceholder.trim();const filenamePattern = new RegExp(- "\\[" + uploadingTextMatch[0].trim() + ": ([^\\]]+?)\\…\\]\\(\\)"+ "\\[" + uploadingTextMatch[0].trim() + "\\s?: ([^\\]]+?)\\…\\]\\(\\)");const filenameMatch = imagePlaceholder.match(filenamePattern);diff --git a/spec/system/composer_uploads_spec.rb b/spec/system/composer_uploads_spec.rbindex 81986ab1775..4eff93c9dc3 100644--- a/spec/system/composer_uploads_spec.rb+++ b/spec/system/composer_uploads_spec.rb@@ -155,6 +155,25 @@ describe "Uploading files in the composer", type: :system docontext "when multiple images are uploaded" dobefore { SiteSetting.experimental_auto_grid_images = true }+ context "when the locale is fr" do+ before { SiteSetting.default_locale = "fr" }++ it "works with the French locale" do+ visit "/new-topic"+ expect(composer).to be_opened++ file_path_1 = file_from_fixtures("logo.png", "images").path+ file_path_2 = file_from_fixtures("logo.jpg", "images").path+ file_path_3 = file_from_fixtures("downsized.png", "images").path+ attach_file("file-uploader", [file_path_1, file_path_2, file_path_3], make_visible: true)++ expect(composer).to have_no_in_progress_uploads+ expect(composer.composer_input.value).to match(+ %r{\[grid\].*!\[.*?\]\(upload://.*?\).*!\[.*?\]\(upload://.*?\).*!\[.*?\]\(upload://.*?\).*?\[/grid\]}m,+ )+ end+ end+it "automatically wraps images in [grid] tags on 3 or more images" dovisit "/new-topic"expect(composer).to be_opened