mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Make General the default category (#18383)
* FEATURE: Make General the default category * Set general as the default category in the composer model instead * use semicolon * Enable allow_uncategorized_topics in create_post spec helper for now * Check if general_category_id is set * Enable allow_uncategorized_topics for test env * Provide an option to the create_post helper to not set allow_uncategorized_topics * Add tests to check that category… is not present and that General is selected automatically
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class DisableAllowUncategorizedNewSites < ActiveRecord::Migration[7.0]
|
||||
def up
|
||||
result = execute <<~SQL
|
||||
SELECT created_at
|
||||
FROM schema_migration_details
|
||||
ORDER BY created_at
|
||||
LIMIT 1
|
||||
SQL
|
||||
|
||||
# keep allow uncategorized for existing sites
|
||||
if result.first['created_at'].to_datetime < 1.hour.ago
|
||||
execute <<~SQL
|
||||
INSERT INTO site_settings(name, data_type, value, created_at, updated_at)
|
||||
VALUES('allow_uncategorized_topics', 5, 't', NOW(), NOW())
|
||||
ON CONFLICT (name) DO NOTHING
|
||||
SQL
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user