mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-25 06:02:57 +08:00
Previously, the Community sidebar section, its 12 default URLs, and the links binding them were inserted across four migrations (`20230411032053_insert_community_to_sidebar_sections.rb`, `20241025045928_add_invites_link_to_sidebar.rb`, `20250626090725_add_my_messages_link_to_sidebar.rb`, `20250721043317_add_filter_link_to_sidebar.rb`), mixing schema and data and re-running data inserts every time a new link was added. This change moves the rows to `db/fixtures/700_sidebar.rb`, gated by a hidden `sidebar_seeded` site setting so admin customizations (renamed links, reordering, even destroying the public Community section via `sidebar_sections_controller#destroy`) survive subsequent `db:seed` runs. The fixture iterates `SidebarUrl::COMMUNITY_SECTION_LINKS` so adding a future link is a one-line model change plus a re-seed. The four existing migrations are gated on `Migration::Helpers.new_site?` so they continue to upgrade existing sites past the point the link didn't yet exist, but no-op on fresh installs (where the fixture is the source of truth). A companion `20260513105516_mark_existing_sites_sidebar_seeded.rb` flips the flag for existing sites so the seed bails immediately on the upgrade deploy. Extracted from https://github.com/discourse/discourse/pull/39788. |
||
|---|---|---|
| .. | ||
| .gitkeep | ||
| 20250714010001_backfill_themeable_site_settings_spec.rb | ||
| 20250902072941_sync_timerable_id_topic_id_spec.rb | ||
| 20251024015907_populate_image_quality_setting_spec.rb | ||
| 20260106060807_add_slug_to_tags_spec.rb | ||
| 20260319054026_add_posting_review_modes_to_category_settings_spec.rb | ||
| 20260513101242_mark_existing_sites_directory_columns_seeded_spec.rb | ||
| 20260513105516_mark_existing_sites_sidebar_seeded_spec.rb | ||