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

Merge upstream changes up to 0f14d82050 into stable-4.7
This commit is contained in:
Claire authored and GitHub committed 2026-09-28 12:13:15 +02:00
commit 53425dace3
30 files changed
+109 -45

No files matched your search

+8 -14
View File
@@ -18,18 +18,13 @@ concurrency:
jobs:
build:
name: build (production)
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: true
matrix:
mode:
- production
- test
env:
RAILS_ENV: ${{ matrix.mode }}
BUNDLE_WITH: ${{ matrix.mode }}
RAILS_ENV: production
BUNDLE_WITH: production
SECRET_KEY_BASE_DUMMY: 1
steps:
@@ -51,12 +46,12 @@ jobs:
public/packs
public/packs-test
tmp/cache/vite
key: ${{ matrix.mode }}-assets-${{ github.head_ref || github.ref_name }}-${{ github.sha }}
key: assets-${{ github.head_ref || github.ref_name }}-${{ github.sha }}
restore-keys: |
${{ matrix.mode }}-assets-${{ github.head_ref || github.ref_name }}-${{ github.sha }}
${{ matrix.mode }}-assets-${{ github.head_ref || github.ref_name }}
${{ matrix.mode }}-assets-main
${{ matrix.mode }}-assets
assets-${{ github.head_ref || github.ref_name }}-${{ github.sha }}
assets-${{ github.head_ref || github.ref_name }}
assets-main
assets
- name: Precompile assets
run: |-
@@ -67,7 +62,6 @@ jobs:
tar --exclude={"*.br","*.gz"} -zcf artifacts.tar.gz public/assets public/packs*
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6
if: matrix.mode == 'test'
with:
path: |-
./artifacts.tar.gz
+1 -1
View File
@@ -234,7 +234,7 @@ FROM media-build AS ffmpeg
# ffmpeg version to compile, change with [--build-arg FFMPEG_VERSION="7.0.x"]
# renovate: datasource=github-tags depName=FFmpeg/FFmpeg extractVersion=^n(?<version>\d+\.\d+(\.\d+)?)$
ARG FFMPEG_VERSION=9.0.1
ARG FFMPEG_VERSION=9.0.2
# ffmpeg download URL, change with [--build-arg FFMPEG_URL="https://ffmpeg.org/releases"]
ARG FFMPEG_URL=https://github.com/FFmpeg/FFmpeg/archive/refs/tags
@@ -72,6 +72,7 @@ module Admin
def destroy
authorize @account, :destroy?
Admin::AccountDeletionWorker.perform_async(@account.id)
log_action :destroy, @account
redirect_to admin_account_path(@account.id), notice: I18n.t('admin.accounts.destroyed_msg', username: @account.acct)
end
@@ -128,6 +128,6 @@ class Api::V1::AccountsController < Api::BaseController
end
def check_enabled_registrations
forbidden unless allowed_registration?(request.remote_ip, invite)
forbidden if ENV['SSO_ACCOUNT_SIGN_UP'].present? || !allowed_registration?(request.remote_ip, invite)
end
end
@@ -69,6 +69,7 @@ class Api::V1::Admin::AccountsController < Api::BaseController
def destroy
authorize @account, :destroy?
Admin::AccountDeletionWorker.perform_async(@account.id)
log_action :destroy, @account
render_empty
end
@@ -29,11 +29,9 @@ class Settings::DeletesController < Settings::BaseController
end
def challenge_passed?
if current_user.encrypted_password.blank?
current_account.username == resource_params[:username]
else
current_user.valid_password?(resource_params[:password])
end
return false unless current_account.username == resource_params[:username]
current_user.encrypted_password.blank? || current_user.valid_password?(resource_params[:password])
end
def destroy_account!
@@ -42,12 +42,13 @@
}
p {
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
line-clamp: 2;
font-size: 16px;
line-height: 24px;
text-overflow: ellipsis;
}
}
@@ -55,7 +55,9 @@ const addReply = (
if (!state.inReplyTos[id]) {
const siblings = (state.replies[in_reply_to_id] ??= []);
const index = siblings.findIndex((sibling) => compareId(sibling, id) < 0);
const index = siblings.findLastIndex(
(sibling) => compareId(sibling, id) < 0,
);
siblings.splice(index + 1, 0, id);
state.inReplyTos[id] = in_reply_to_id;
}
@@ -185,6 +185,7 @@ body {
font-size: 20px;
line-height: 28px;
font-weight: 400;
margin-bottom: var(--space-md);
}
}
}
@@ -9074,6 +9074,7 @@ noscript {
bottom: 20px;
inset-inline-end: 20px;
width: 300px;
z-index: 100;
background-color: var(--color-bg-primary);
box-shadow: var(--dropdown-shadow);
@@ -11384,10 +11385,14 @@ noscript {
}
.column-footer {
padding: 16px;
position: sticky;
bottom: 0;
padding: 16px;
background: var(--color-bg-primary);
@media (width <= $mobile-menu-breakpoint) {
padding-bottom: calc(16px + var(--mobile-bottom-nav-height, 0));
}
}
.lists-scrollable {
@@ -17,7 +17,11 @@ import MenuIcon from '@/material-icons/400-24px/menu.svg?react';
import NotificationsIcon from '@/material-icons/400-24px/notifications-fill.svg?react';
import PublicIcon from '@/material-icons/400-24px/public.svg?react';
import SettingsIcon from '@/material-icons/400-24px/settings.svg?react';
import { mountCompose, unmountCompose } from 'mastodon/actions/compose';
import {
changeComposing,
mountCompose,
unmountCompose,
} from 'mastodon/actions/compose';
import { openModal } from 'mastodon/actions/modal';
import { Column } from 'mastodon/components/column';
import { ColumnHeader } from 'mastodon/components/column_header';
@@ -63,6 +67,10 @@ const Compose: React.FC<{ multiColumn: boolean }> = ({ multiColumn }) => {
};
}, [dispatch]);
const handleFocus = useCallback(() => {
dispatch(changeComposing(true));
}, [dispatch]);
const handleLogoutClick = useCallback(
(e: React.MouseEvent) => {
e.preventDefault();
@@ -164,7 +172,7 @@ const Compose: React.FC<{ multiColumn: boolean }> = ({ multiColumn }) => {
role='region'
aria-label={intl.formatMessage(navbarMessages.publish)}
>
<div className='drawer__inner'>
<div className='drawer__inner' onFocus={handleFocus}>
<ComposeFormContainer />
<div className='drawer__inner__mastodon with-zig-zag-decoration'>
@@ -42,12 +42,13 @@
}
p {
overflow: hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
line-clamp: 2;
font-size: 16px;
line-height: 24px;
text-overflow: ellipsis;
}
}
+3 -1
View File
@@ -55,7 +55,9 @@ const addReply = (
if (!state.inReplyTos[id]) {
const siblings = (state.replies[in_reply_to_id] ??= []);
const index = siblings.findIndex((sibling) => compareId(sibling, id) < 0);
const index = siblings.findLastIndex(
(sibling) => compareId(sibling, id) < 0,
);
siblings.splice(index + 1, 0, id);
state.inReplyTos[id] = in_reply_to_id;
}
@@ -516,7 +516,7 @@ table + p {
text-decoration: underline;
}
&:first-child {
&:not(last-child) {
margin-bottom: 12px;
}
}
@@ -185,6 +185,7 @@ body {
font-size: 20px;
line-height: 28px;
font-weight: 400;
margin-bottom: var(--space-md);
}
}
}
@@ -8739,6 +8739,7 @@ noscript {
bottom: 20px;
inset-inline-end: 20px;
width: 300px;
z-index: 100;
background-color: var(--color-bg-primary);
box-shadow: var(--dropdown-shadow);
@@ -11030,10 +11031,14 @@ noscript {
}
.column-footer {
padding: 16px;
position: sticky;
bottom: 0;
padding: 16px;
background: var(--color-bg-primary);
@media (width <= $mobile-menu-breakpoint) {
padding-bottom: calc(16px + var(--mobile-bottom-nav-height, 0));
}
}
.lists-scrollable {
+1
View File
@@ -43,6 +43,7 @@ class Admin::BaseAction
private
def process_strike!(action = type)
authorize(target_account, :warn?)
@warning = target_account.strikes.create!(
account: current_account,
report: report,
@@ -36,6 +36,9 @@ class BatchedRemoveStatusService < BaseService
# cascade the delete faster without loading the associations.
statuses_and_reblogs.each_slice(50) { |slice| Status.unscoped.where(id: slice.pluck(:id)).delete_all }
# TODO: remove later, when we have added appropriate foreign keys
PreviewCardsStatus.where(status_id: statuses_and_reblogs.pluck(:id)).in_batches.delete_all
# Since we skipped all callbacks, we also need to manually
# deindex the statuses
if Chewy.enabled?
+5
View File
@@ -11,6 +11,7 @@ class DeleteAccountService < BaseService
block_relationships
blocked_by_relationships
collections
collection_items
conversation_mutes
conversations
custom_filters
@@ -162,6 +163,8 @@ class DeleteAccountService < BaseService
end
def purge_statuses!
@account.statuses.reorder(nil).where(id: reported_status_ids).in_batches.update_all('deleted_at = COALESCE(statuses.deleted_at, NOW())')
@account.statuses.reorder(nil).where.not(id: reported_status_ids).in_batches do |statuses|
BatchedRemoveStatusService.new.call(statuses, skip_side_effects: skip_side_effects?)
end
@@ -252,6 +255,8 @@ class DeleteAccountService < BaseService
@account.also_known_as = []
@account.avatar.destroy
@account.header.destroy
@account.avatar_description = ''
@account.header_description = ''
@account.save!
end
+2 -1
View File
@@ -12,8 +12,9 @@
= theme_style_tags [Setting.default_settings['flavour'], Setting.default_settings['skin']]
= flavoured_vite_typescript_tag 'error.ts', flavour: Setting.default_settings['flavour'], crossorigin: 'anonymous'
%body.error
.dialog
%main.dialog
.dialog__illustration
%img{ alt: Setting.default_settings['site_title'], src: '/oops.png' }/
.dialog__message
%h1= yield :content
%a{ class: 'button button-secondary', href: '/' }= t('errors.go_home')
+2 -2
View File
@@ -20,10 +20,10 @@
%hr.spacer/
= f.input :username, wrapper: :with_block_label, input_html: { autocomplete: 'off' }, hint: t('deletes.confirm_username')
- if current_user.encrypted_password.present?
= f.input :password, wrapper: :with_block_label, input_html: { autocomplete: 'current-password' }, hint: t('deletes.confirm_password')
- else
= f.input :username, wrapper: :with_block_label, input_html: { autocomplete: 'off' }, hint: t('deletes.confirm_username')
.actions
= f.button :button, t('deletes.proceed'), type: :submit, class: 'negative'
+3 -3
View File
@@ -6,10 +6,10 @@ class Admin::AccountDeletionWorker
sidekiq_options queue: 'pull', lock: :until_executed, lock_ttl: 1.week.to_i
def perform(account_id)
delete_account = Account.find(account_id)
return unless delete_account.unavailable?
account = Account.find(account_id)
return unless account.unavailable?
DeleteAccountService.new.call(delete_account, reserve_username: true, reserve_email: true)
DeleteAccountService.new.call(account, reserve_username: true, reserve_email: true, suspended_at: account.suspended_at)
rescue ActiveRecord::RecordNotFound
true
end
@@ -30,7 +30,7 @@ class Scheduler::SuspendedUserCleanupScheduler
# This should be fine because we only process a small amount of deletion requests at once and
# `id` and `created_at` should follow the same order.
AccountDeletionRequest.reorder(id: :asc).take(MAX_DELETIONS_PER_JOB).each do |deletion_request|
next unless deletion_request.created_at < AccountDeletionRequest::DELAY_TO_DELETION.ago
next unless deletion_request.due_at.past?
Admin::AccountDeletionWorker.perform_async(deletion_request.account_id)
end
+8 -4
View File
@@ -60,6 +60,10 @@ class Rack::Attack
def paging_request?
params['page'].present? || params['min_id'].present? || params['max_id'].present? || params['since_id'].present?
end
def normalized_email
CanonicalEmailBlock.canonicalize_email(params.dig('user', 'email')) if params.dig('user', 'email').present?
end
end
Rack::Attack.blocklist('deny from blocklist') do |req|
@@ -118,7 +122,7 @@ class Rack::Attack
end
throttle('throttle_password_resets/email', limit: 5, period: 30.minutes) do |req|
req.params.dig('user', 'email').presence if req.post? && req.path_matches?('/auth/password')
req.normalized_email if req.post? && req.path_matches?('/auth/password')
end
throttle('throttle_email_confirmations/ip', limit: 25, period: 5.minutes) do |req|
@@ -127,14 +131,14 @@ class Rack::Attack
throttle('throttle_email_confirmations/email', limit: 5, period: 30.minutes) do |req|
if req.post? && req.path_matches?('/auth/confirmation')
req.params.dig('user', 'email').presence
req.normalized_email
elsif req.post? && req.path == '/api/v1/emails/confirmations'
req.authenticated_user_id
end
end
throttle('throttle_auth_setup/email', limit: 5, period: 10.minutes) do |req|
req.params.dig('user', 'email').presence if (req.put? || req.patch?) && req.path_matches?('/auth/setup')
req.normalized_email if (req.put? || req.patch?) && req.path_matches?('/auth/setup')
end
throttle('throttle_auth_setup/account', limit: 5, period: 10.minutes) do |req|
@@ -146,7 +150,7 @@ class Rack::Attack
end
throttle('throttle_login_attempts/email', limit: 25, period: 1.hour) do |req|
req.session[:attempt_user_id] || req.params.dig('user', 'email').presence if req.post? && req.path_matches?('/auth/sign_in')
req.session[:attempt_user_id] || req.normalized_email if req.post? && req.path_matches?('/auth/sign_in')
end
throttle('throttle_password_change/account', limit: 10, period: 10.minutes) do |req|
+3
View File
@@ -200,6 +200,7 @@ en:
create_user_role: Create Role
create_username_block: Create Username Rule
demote_user: Demote User
destroy_account: Delete Account Data
destroy_announcement: Delete Announcement
destroy_canonical_email_block: Delete Email Block
destroy_custom_emoji: Delete Custom Emoji
@@ -268,6 +269,7 @@ en:
create_user_role_html: "%{name} created %{target} role"
create_username_block_html: "%{name} added rule for usernames containing %{target}"
demote_user_html: "%{name} demoted user %{target}"
destroy_account_html: "%{name} deleted account data for %{target}"
destroy_announcement_html: "%{name} deleted announcement %{target}"
destroy_canonical_email_block_html: "%{name} unblocked email with the hash %{target}"
destroy_collection_html: "%{name} removed collection by %{target}"
@@ -1596,6 +1598,7 @@ en:
content: We're sorry, but something went wrong on our end.
title: This page is not correct
'503': The page could not be served due to a temporary server failure.
go_home: Go home
noscript_html: To use the Mastodon web application, please enable JavaScript. Alternatively, try one of the <a href="%{apps_path}">native apps</a> for Mastodon for your platform.
existing_username_validator:
not_found: could not find a local user with that username
@@ -71,6 +71,18 @@ RSpec.describe Rack::Attack, type: :request do
let(:remote_ip) { '1.2.3.5' }
let(:discriminator) { remote_ip }
describe 'throttle excessive confirmation e-mail requests by e-mail address' do
let(:throttle) { 'throttle_email_confirmations/email' }
let(:limit) { 5 }
let(:period) { 30.minutes }
let(:request) { -> { post path, params: { user: { email: email } } } }
let(:path) { '/auth/confirmation' }
let(:email) { 'foo@bar.com' }
let(:discriminator) { email }
it_behaves_like 'throttled endpoint'
end
describe 'throttle excessive sign-up requests by IP address' do
context 'when accessed through the website' do
let(:throttle) { 'throttle_sign_up_attempts/ip' }
+2 -2
View File
@@ -149,13 +149,13 @@ RSpec.describe MediaAttachment, :attachment_processing do
it_behaves_like 'static 600x400 image', 'image/webp', '.webp'
end
describe 'avif' do
describe 'avif', skip: 'HEIF temporarily disabled' do
let(:media) { Fabricate(:media_attachment, file: attachment_fixture('600x400.avif')) }
it_behaves_like 'static 600x400 image', 'image/jpeg', '.jpeg'
end
describe 'heic' do
describe 'heic', skip: 'HEIF temporarily disabled' do
let(:media) { Fabricate(:media_attachment, file: attachment_fixture('600x400.heic')) }
it_behaves_like 'static 600x400 image', 'image/jpeg', '.jpeg'
+7 -1
View File
@@ -7,6 +7,7 @@ RSpec.describe DeleteAccountService do
subject { described_class.new.call(account) }
let!(:status) { Fabricate(:status, account: account) }
let!(:reported_status) { Fabricate(:status, account: account) }
let!(:mention) { Fabricate(:mention, account: local_follower) }
let!(:status_with_mention) { Fabricate(:status, account: account, mentions: [mention]) }
let!(:media_attachment) { Fabricate(:media_attachment, account: account) }
@@ -28,8 +29,13 @@ RSpec.describe DeleteAccountService do
let!(:account_note) { Fabricate(:account_note, account: account) }
let!(:generated_annual_report) { Fabricate(:generated_annual_report, account: account) }
before do
Fabricate(:report, target_account: account, status_ids: [reported_status.id])
end
it 'deletes associated owned and target records and target notifications' do
subject
expect { subject }
.to change { reported_status.reload.deleted_at }.from(nil)
expect_deletion_of_associated_owned_records
expect_deletion_of_associated_target_records
+9
View File
@@ -15,12 +15,21 @@ RSpec.describe 'Settings Deletes' do
.and have_private_cache_control
# Wrong confirmation value
fill_in 'form_delete_confirmation_username', with: user.account.username
fill_in 'form_delete_confirmation_password', with: 'wrongvalue'
click_on I18n.t('deletes.proceed')
expect(page)
.to have_text(I18n.t('deletes.challenge_not_passed'))
# Wrong confirmation value
fill_in 'form_delete_confirmation_username', with: 'wrongvalue'
fill_in 'form_delete_confirmation_password', with: user.password
click_on I18n.t('deletes.proceed')
expect(page)
.to have_text(I18n.t('deletes.challenge_not_passed'))
# Correct confirmation value
fill_in 'form_delete_confirmation_username', with: user.account.username
fill_in 'form_delete_confirmation_password', with: user.password
click_on I18n.t('deletes.proceed')
expect(page)
@@ -13,7 +13,7 @@ RSpec.describe Admin::AccountDeletionWorker do
allow(DeleteAccountService).to receive(:new).and_return(service)
worker.perform(account.id)
expect(service).to have_received(:call).with(account, { reserve_email: true, reserve_username: true })
expect(service).to have_received(:call).with(account, { reserve_email: true, reserve_username: true, suspended_at: account.reload.suspended_at })
end
end
end