Merge pull request #3646 from ClearlyClaire/glitch-soc/merge-4.7

Merge upstream changes up to f9655d3c62 into stable-4.7
This commit is contained in:
Claire authored and GitHub committed 2026-08-28 20:07:55 +02:00
commit 21dd3949f2
10 files changed
+94 -11

No files matched your search

+1 -1
View File
@@ -399,7 +399,7 @@ RUN \
RUN \
# Precompile bootsnap code for faster Rails startup
bundle exec bootsnap precompile --gemfile app/ lib/;
bundle exec bootsnap precompile --gemfile app/ lib/ config/;
RUN \
# Pre-create and chown system volume to Mastodon user
@@ -59,7 +59,7 @@ module Admin
def filter_by_domain
scope = EmailDomainBlock.parents.includes(:children).order(id: :desc)
scope.merge!(EmailDomainBlock.matches_domain(params[:domain])) if params[:domain].present?
scope.merge!(EmailDomainBlock.matches_domain(params[:by_domain])) if params[:by_domain].present?
scope
end
@@ -7,8 +7,8 @@
= form_with url: admin_email_domain_blocks_path, method: :get, class: :simple_form do |f|
.fields-group
.input.string.optional
= f.text_field :domain,
value: params[:domain],
= f.text_field :by_domain,
value: params[:by_domain],
class: 'string optional',
placeholder: t('admin.email_domain_blocks.domain')
@@ -20,7 +20,7 @@
= form_with model: @form, url: batch_admin_email_domain_blocks_path do |f|
= hidden_field_tag :page, params[:page] || 1
= hidden_field_tag :domain, params[:domain] if params[:domain].present?
= hidden_field_tag :by_domain, params[:by_domain] if params[:by_domain].present?
.batch-table
.batch-table__toolbar
@@ -3,7 +3,13 @@
class AddIndexAccountIdLocalFragmentToKeypair < ActiveRecord::Migration[8.1]
disable_ddl_transaction!
def change
def up
add_index :keypairs, [:account_id, :local_fragment], unique: true, where: 'local_fragment IS NOT NULL', algorithm: :concurrently
rescue ActiveRecord::StatementInvalid
safety_assured { execute 'REINDEX INDEX CONCURRENTLY index_keypairs_on_account_id_and_local_fragment' }
end
def down
remove_index :keypairs, name: :index_keypairs_on_account_id_and_local_fragment
end
end
@@ -3,7 +3,13 @@
class AddNewIndexAccountIdLocalFragmentToKeypair < ActiveRecord::Migration[8.1]
disable_ddl_transaction!
def change
def up
add_index :keypairs, [:account_id, :local_fragment], unique: true, name: :index_keypairs_on_account_id_and_local_fragment, algorithm: :concurrently
rescue ActiveRecord::StatementInvalid
safety_assured { execute 'REINDEX INDEX CONCURRENTLY index_keypairs_on_account_id_and_local_fragment' }
end
def down
remove_index :keypairs, name: :index_keypairs_on_account_id_and_local_fragment
end
end
+6
View File
@@ -549,6 +549,12 @@ namespace :mastodon do
require_relative '../../config/environment'
disable_log_stdout!
ActiveRecord::Encryption.configure(
primary_key: ENV.fetch('ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY'),
deterministic_key: ENV.fetch('ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY'),
key_derivation_salt: ENV.fetch('ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT')
)
username = prompt.ask('Username:') do |q|
q.required true
q.default 'admin'
+1 -1
View File
@@ -4,7 +4,7 @@ require 'rails_helper'
RSpec.describe PrivateAddressCheck do
describe 'private_address?' do
let(:private_ips) { %w(192.168.1.7 0.0.0.0 127.0.0.1 ::ffff:0.0.0.1) }
let(:private_ips) { %w(192.168.1.7 0.0.0.0 127.0.0.1 ::ffff:0.0.0.1 ::127.0.0.1 ::ffff:127.0.0.1 ::ffff:10.0.0.1 ::ffff:169.254.169.254 ::) }
it 'returns true for private addresses' do
expect(private_ips)
@@ -162,6 +162,46 @@ RSpec.describe ActivityPub::ProcessActivityService do
expect(ActivityPub::Activity).to_not have_received(:factory)
end
context 'when receiving a status with an unsupported JSON-LD keyword' do
let(:payload) do
{
'@context': 'https://www.w3.org/ns/activitystreams',
id: 'foo',
type: 'Announce',
actor: ActivityPub::TagManager.instance.uri_for(actor),
'@reverse': {
object: {
type: 'Undo',
id: 'bar',
actor: ActivityPub::TagManager.instance.uri_for(actor),
},
},
object: {
id: 'bar',
type: 'Note',
content: 'Lorem ipsum',
},
signature: {
type: 'RsaSignature2017',
creator: "#{ActivityPub::TagManager.instance.uri_for(actor)}#foo",
created: '2022-03-09T21:57:25Z',
signatureValue: 'foo',
},
}
end
it 'does not process payload' do
signature_double = instance_double(ActivityPub::LinkedDataSignature, verify_actor!: nil)
allow(ActivityPub::LinkedDataSignature).to receive(:new).and_return(signature_double)
allow(ActivityPub::Activity).to receive(:factory)
subject.call(json, forwarder)
expect(signature_double).to_not have_received(:verify_actor!)
expect(ActivityPub::Activity).to_not have_received(:factory)
end
end
context 'when receiving a fabricated status' do
let!(:actor) do
Fabricate(:account,
@@ -98,7 +98,7 @@ RSpec.describe 'Admin::EmailDomainBlocks' do
end
it 'filters by domain' do
fill_in 'domain', with: 'example.com'
fill_in 'by_domain', with: 'example.com'
click_on I18n.t('admin.email_domain_blocks.search')
expect(page).to have_text('example.com')
@@ -106,7 +106,7 @@ RSpec.describe 'Admin::EmailDomainBlocks' do
end
it 'shows empty page when no such domains are blocked' do
fill_in 'domain', with: 'mydomain.com'
fill_in 'by_domain', with: 'mydomain.com'
click_on I18n.t('admin.email_domain_blocks.search')
expect(page).to have_no_text('mydomain.com')
@@ -114,7 +114,7 @@ RSpec.describe 'Admin::EmailDomainBlocks' do
end
it 'returns to the list when resetting the search' do
fill_in 'domain', with: 'example.com'
fill_in 'by_domain', with: 'example.com'
click_on I18n.t('admin.email_domain_blocks.search')
click_on I18n.t('admin.email_domain_blocks.reset')
@@ -0,0 +1,25 @@
# frozen_string_literal: true
require 'rails_helper'
RSpec.describe EmailAddressValidator do
subject { record_class.new }
context 'with no options' do
let(:record_class) do
Class.new do
include ActiveModel::Validations
def self.name = 'Record'
attr_accessor :email
validates :email, email_address: true
end
end
it { is_expected.to allow_value('foo@example.com').for(:email) }
it { is_expected.to_not allow_value('foo @ example.com').for(:email) }
it { is_expected.to_not allow_value('foo@example.com%foo.example.com').for(:email) }
end
end