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.
This commit is contained in:
Ted Johansson 2025-02-12 11:18:24 +08:00 committed by GitHub
parent 2cafd7e79b
commit b3a686ca4e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 2 deletions

View File

@ -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();
}
});

View File

@ -2755,7 +2755,7 @@ en:
experimental_form_templates: "Enable the form templates feature. Manage the templates at <a href='%{base_path}/admin/customize/form-templates'>Customize / Templates</a>."
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."

View File

@ -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

View File

@ -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