mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 18:03:43 +08:00
FEATURE: make the use_email_for_username_and_name_suggestions setting visible and on by default on existing sites (#15751)
This commit is contained in:
parent
c46b55dc3b
commit
dad2e5e513
|
@ -2344,6 +2344,7 @@ en:
|
|||
create_revision_on_bulk_topic_moves: "Create revision for first posts when topics are moved into a new category in bulk."
|
||||
|
||||
allow_changing_staged_user_tracking: "Allow a staged user's category and tag notification preferences to be changed by an admin user."
|
||||
use_email_for_username_and_name_suggestions: "Use the first part of email addresses for username and name suggestions. Note that this makes it easier for the public to guess full user email addresses (because a large proportion of people share common services like `gmail.com`)."
|
||||
|
||||
errors:
|
||||
invalid_css_color: "Invalid color. Enter a color name or hex value."
|
||||
|
|
|
@ -686,7 +686,6 @@ users:
|
|||
default: 2000
|
||||
hidden: true
|
||||
use_email_for_username_and_name_suggestions:
|
||||
hidden: true
|
||||
default: false
|
||||
|
||||
groups:
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class SetUseEmailForUsernameAndNameSuggestionsOnExistingSites < ActiveRecord::Migration[6.1]
|
||||
def up
|
||||
result = execute <<~SQL
|
||||
SELECT created_at
|
||||
FROM schema_migration_details
|
||||
ORDER BY created_at
|
||||
LIMIT 1
|
||||
SQL
|
||||
|
||||
# make setting enabled 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('use_email_for_username_and_name_suggestions', 5, 't', NOW(), NOW())
|
||||
ON CONFLICT (name) DO NOTHING
|
||||
SQL
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user