Merge commit 'e5826777b6c06a32b97388657beaca1e5eccb421' into glitch-soc/merge-upstream

Conflicts:
- `config/settings.yml`:
  Not a real conflict, upstream removed settings that are identical in glitch-soc
  but textually adjacent to glitch-soc-only settings.
  Removed what upstream removed.
This commit is contained in:
Claire
2025-07-30 20:05:45 +02:00
172 changed files with 2202 additions and 647 deletions

View File

@@ -0,0 +1,23 @@
# frozen_string_literal: true
class CreateUsernameBlocks < ActiveRecord::Migration[8.0]
def change
create_table :username_blocks do |t|
t.string :username, null: false
t.string :normalized_username, null: false
t.boolean :exact, null: false, default: false
t.boolean :allow_with_approval, null: false, default: false
t.timestamps
end
add_index :username_blocks, 'lower(username)', unique: true, name: 'index_username_blocks_on_username_lower_btree'
add_index :username_blocks, :normalized_username
reversible do |dir|
dir.up do
load Rails.root.join('db', 'seeds', '05_blocked_usernames.rb')
end
end
end
end

View File

@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.0].define(version: 2025_06_27_132728) do
ActiveRecord::Schema[8.0].define(version: 2025_07_17_003848) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_catalog.plpgsql"
@@ -1241,6 +1241,17 @@ ActiveRecord::Schema[8.0].define(version: 2025_06_27_132728) do
t.datetime "updated_at", null: false
end
create_table "username_blocks", force: :cascade do |t|
t.string "username", null: false
t.string "normalized_username", null: false
t.boolean "exact", default: false, null: false
t.boolean "allow_with_approval", default: false, null: false
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index "lower((username)::text)", name: "index_username_blocks_on_username_lower_btree", unique: true
t.index ["normalized_username"], name: "index_username_blocks_on_normalized_username"
end
create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false
t.datetime "created_at", precision: nil, null: false

View File

@@ -7,7 +7,17 @@ if Rails.env.development?
admin = Account.where(username: 'admin').first_or_initialize(username: 'admin')
admin.save(validate: false)
user = User.where(email: "admin@#{domain}").first_or_initialize(email: "admin@#{domain}", password: 'mastodonadmin', password_confirmation: 'mastodonadmin', confirmed_at: Time.now.utc, role: UserRole.find_by(name: 'Owner'), account: admin, agreement: true, approved: true)
user = User.where(email: "admin@#{domain}").first_or_initialize(
email: "admin@#{domain}",
password: 'mastodonadmin',
password_confirmation: 'mastodonadmin',
confirmed_at: Time.now.utc,
role: UserRole.find_by(name: 'Owner'),
account: admin,
agreement: true,
approved: true,
bypass_registration_checks: true
)
user.save!
user.approve!
end

View File

@@ -0,0 +1,34 @@
# frozen_string_literal: true
%w(
abuse
account
accounts
admin
administration
administrator
admins
help
helpdesk
instance
mod
moderator
moderators
mods
owner
root
security
server
staff
support
webmaster
).each do |str|
UsernameBlock.create_with(username: str, exact: true).find_or_create_by(username: str)
end
%w(
mastodon
mastadon
).each do |str|
UsernameBlock.create_with(username: str, exact: false).find_or_create_by(username: str)
end