From b3a686ca4e6b3decfb678f3025ed61572df48eb4 Mon Sep 17 00:00:00 2001 From: Ted Johansson Date: Wed, 12 Feb 2025 11:18:24 +0800 Subject: [PATCH] DEV: Move image auto-grid back to experimental (#31296) This feature was originally experimental. We made it baseline in #29572, however this was met with some pushback, so we have decided to make it experimental again. The original PR couldn't be reverted, but this one basically does the same by cherry-picking all the changes back. --- .../javascripts/discourse/app/lib/uppy/composer-upload.js | 5 ++++- config/locales/server.en.yml | 2 +- config/site_settings.yml | 3 +++ spec/system/composer_uploads_spec.rb | 4 ++++ 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/discourse/app/lib/uppy/composer-upload.js b/app/assets/javascripts/discourse/app/lib/uppy/composer-upload.js index a56ed7a5bee..346f722c12c 100644 --- a/app/assets/javascripts/discourse/app/lib/uppy/composer-upload.js +++ b/app/assets/javascripts/discourse/app/lib/uppy/composer-upload.js @@ -344,7 +344,10 @@ export default class UppyComposerUpload { }); const MIN_IMAGES_TO_AUTO_GRID = 3; - if (this.#consecutiveImages?.length >= MIN_IMAGES_TO_AUTO_GRID) { + if ( + this.siteSettings.experimental_auto_grid_images && + this.#consecutiveImages?.length >= MIN_IMAGES_TO_AUTO_GRID + ) { this.#autoGridImages(); } }); diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index a5491b2046a..48a6f8851d7 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -2755,7 +2755,7 @@ en: experimental_form_templates: "Enable the form templates feature. Manage the templates at Customize / Templates." admin_sidebar_enabled_groups: "Enable sidebar navigation for the admin UI for the specified groups, which replaces the top-level admin navigation buttons." lazy_load_categories_groups: "Lazy load category information only for users of these groups. This improves performance on sites with many categories." - + experimental_auto_grid_images: "Automatically wraps images in [grid] tags when 3 or more images are uploaded in the composer." page_loading_indicator: "Configure the loading indicator which appears during page navigations within Discourse. 'Spinner' is a full page indicator. 'Slider' shows a narrow bar at the top of the screen." show_user_menu_avatars: "Show user avatars in the user menu" about_page_hidden_groups: "Do not show members of specific groups on the /about page." diff --git a/config/site_settings.yml b/config/site_settings.yml index b9a8e9537d4..42c1c52db72 100644 --- a/config/site_settings.yml +++ b/config/site_settings.yml @@ -3514,6 +3514,9 @@ dashboard: client: true experimental: + experimental_auto_grid_images: + default: false + client: true experimental_rename_faq_to_guidelines: default: false hidden: true diff --git a/spec/system/composer_uploads_spec.rb b/spec/system/composer_uploads_spec.rb index deaf75a47a1..bbee973b819 100644 --- a/spec/system/composer_uploads_spec.rb +++ b/spec/system/composer_uploads_spec.rb @@ -160,6 +160,8 @@ describe "Uploading files in the composer", type: :system do end context "when multiple images are uploaded" do + before { SiteSetting.experimental_auto_grid_images = true } + it "automatically wraps images in [grid] tags on 3 or more images" do visit "/new-topic" expect(composer).to be_opened @@ -225,6 +227,8 @@ describe "Uploading files in the composer", type: :system do end it "does not automatically wrap images in [grid] tags when setting is disabled" do + SiteSetting.experimental_auto_grid_images = false + visit "/new-topic" expect(composer).to be_opened