Merge commit '17eb1a7e668dbba6e79612395b99407e8e8de6b9' into glitch-soc/merge-upstream

This commit is contained in:
Claire
2025-10-21 18:15:56 +02:00
10 changed files with 51 additions and 35 deletions

2
.nvmrc
View File

@@ -1 +1 @@
22.20 24.10

View File

@@ -14,9 +14,9 @@ ARG BASE_REGISTRY="docker.io"
# Ruby image to use for base image, change with [--build-arg RUBY_VERSION="3.4.x"] # Ruby image to use for base image, change with [--build-arg RUBY_VERSION="3.4.x"]
# renovate: datasource=docker depName=docker.io/ruby # renovate: datasource=docker depName=docker.io/ruby
ARG RUBY_VERSION="3.4.7" ARG RUBY_VERSION="3.4.7"
# # Node.js version to use in base image, change with [--build-arg NODE_MAJOR_VERSION="20"] # # Node.js version to use in base image, change with [--build-arg NODE_MAJOR_VERSION="22"]
# renovate: datasource=node-version depName=node # renovate: datasource=node-version depName=node
ARG NODE_MAJOR_VERSION="22" ARG NODE_MAJOR_VERSION="24"
# Debian image to use for base image, change with [--build-arg DEBIAN_VERSION="trixie"] # Debian image to use for base image, change with [--build-arg DEBIAN_VERSION="trixie"]
ARG DEBIAN_VERSION="trixie" ARG DEBIAN_VERSION="trixie"
# Node.js image to use for base image based on combined variables (ex: 20-trixie-slim) # Node.js image to use for base image based on combined variables (ex: 20-trixie-slim)

View File

@@ -73,7 +73,7 @@ Mastodon is a **free, open-source social network server** based on [ActivityPub]
### Requirements ### Requirements
- **Ruby** 3.2+ - **Ruby** 3.2+
- **PostgreSQL** 13+ - **PostgreSQL** 14+
- **Redis** 7.0+ - **Redis** 7.0+
- **Node.js** 20+ - **Node.js** 20+

View File

@@ -8,4 +8,11 @@ class REST::ScheduledStatusSerializer < ActiveModel::Serializer
def id def id
object.id.to_s object.id.to_s
end end
def params
object.params.merge(
quoted_status_id: object.params['quoted_status_id']&.to_s,
quote_approval_policy: Status::QUOTE_APPROVAL_POLICY_FLAGS.keys.find { |key| object.params['quote_approval_policy']&.anybits?(Status::QUOTE_APPROVAL_POLICY_FLAGS[key] << 16) }&.to_s || 'nobody'
)
end
end end

View File

@@ -23,6 +23,7 @@ class PublishScheduledStatusWorker
options.tap do |options_hash| options.tap do |options_hash|
options_hash[:application] = Doorkeeper::Application.find(options_hash.delete(:application_id)) if options[:application_id] options_hash[:application] = Doorkeeper::Application.find(options_hash.delete(:application_id)) if options[:application_id]
options_hash[:thread] = Status.find(options_hash.delete(:in_reply_to_id)) if options_hash[:in_reply_to_id] options_hash[:thread] = Status.find(options_hash.delete(:in_reply_to_id)) if options_hash[:in_reply_to_id]
options_hash[:quoted_status] = Status.find(options_hash.delete(:quoted_status_id)) if options_hash[:quoted_status_id]
end end
end end
end end

View File

@@ -1,4 +1,4 @@
# frozen_string_literal: true # frozen_string_literal: true
StrongMigrations.start_after = 2017_09_24_022025 StrongMigrations.start_after = 2017_09_24_022025
StrongMigrations.target_version = 13 StrongMigrations.target_version = 14

View File

@@ -63,7 +63,7 @@ namespace :db do
task pre_migration_check: :environment do task pre_migration_check: :environment do
pg_version = ActiveRecord::Base.connection.database_version pg_version = ActiveRecord::Base.connection.database_version
abort 'This version of Mastodon requires PostgreSQL 13.0 or newer. Please update PostgreSQL before updating Mastodon.' if pg_version < 130_000 abort 'This version of Mastodon requires PostgreSQL 14.0 or newer. Please update PostgreSQL before updating Mastodon.' if pg_version < 140_000
schema_version = ActiveRecord::Migrator.current_version schema_version = ActiveRecord::Migrator.current_version
abort <<~MESSAGE if ENV['SKIP_POST_DEPLOYMENT_MIGRATIONS'] && schema_version < 2023_09_07_150100 abort <<~MESSAGE if ENV['SKIP_POST_DEPLOYMENT_MIGRATIONS'] && schema_version < 2023_09_07_150100

View File

@@ -10,14 +10,18 @@ RSpec.describe REST::ScheduledStatusSerializer do
) )
end end
let(:scheduled_status) { Fabricate.build(:scheduled_status, scheduled_at: 4.minutes.from_now, params: { application_id: 123 }) } let(:scheduled_status) { Fabricate.build(:scheduled_status, scheduled_at: 4.minutes.from_now, params: { application_id: 123, quoted_status_id: 456, quote_approval_policy: Status::QUOTE_APPROVAL_POLICY_FLAGS[:public] << 16 }) }
describe 'serialization' do describe 'serialization' do
it 'returns expected values and removes application_id from params' do it 'returns expected values and removes application_id from params' do
expect(subject.deep_symbolize_keys) expect(subject.deep_symbolize_keys)
.to include( .to include(
scheduled_at: be_a(String).and(match_api_datetime_format), scheduled_at: be_a(String).and(match_api_datetime_format),
params: include(:application_id) params: a_hash_including(
application_id: 123,
quoted_status_id: '456',
quote_approval_policy: 'public'
)
) )
end end
end end

View File

@@ -13,8 +13,12 @@ RSpec.describe PublishScheduledStatusWorker do
end end
context 'when the account is not disabled' do context 'when the account is not disabled' do
let(:user) { Fabricate(:user) }
let(:scheduled_status) { Fabricate(:scheduled_status, account: user.account, params: { text: 'Hello world, future!', quoted_status_id: Fabricate(:status, account: user.account).id }) }
it 'creates a status and removes scheduled record' do it 'creates a status and removes scheduled record' do
expect(scheduled_status.account.statuses.first.text).to eq 'Hello world, future!' expect(scheduled_status.account.statuses.first.text).to eq 'Hello world, future!'
expect(scheduled_status.account.statuses.first.quote).to_not be_nil
expect(ScheduledStatus.find_by(id: scheduled_status.id)).to be_nil expect(ScheduledStatus.find_by(id: scheduled_status.id)).to be_nil
end end

View File

@@ -8,9 +8,9 @@ ARG TARGETPLATFORM=${TARGETPLATFORM}
ARG BUILDPLATFORM=${BUILDPLATFORM} ARG BUILDPLATFORM=${BUILDPLATFORM}
ARG BASE_REGISTRY="docker.io" ARG BASE_REGISTRY="docker.io"
# Node version to use in base image, change with [--build-arg NODE_MAJOR_VERSION="20"] # Node version to use in base image, change with [--build-arg NODE_MAJOR_VERSION="22"]
# renovate: datasource=node-version depName=node # renovate: datasource=node-version depName=node
ARG NODE_MAJOR_VERSION="22" ARG NODE_MAJOR_VERSION="24"
# Debian image to use for base image, change with [--build-arg DEBIAN_VERSION="trixie"] # Debian image to use for base image, change with [--build-arg DEBIAN_VERSION="trixie"]
ARG DEBIAN_VERSION="trixie" ARG DEBIAN_VERSION="trixie"
# Node image to use for base image based on combined variables (ex: 20-trixie-slim) # Node image to use for base image based on combined variables (ex: 20-trixie-slim)
@@ -32,20 +32,20 @@ ARG GID="991"
# Apply Mastodon build options based on options above # Apply Mastodon build options based on options above
ENV \ ENV \
# Apply Mastodon version information # Apply Mastodon version information
MASTODON_VERSION_PRERELEASE="${MASTODON_VERSION_PRERELEASE}" \ MASTODON_VERSION_PRERELEASE="${MASTODON_VERSION_PRERELEASE}" \
MASTODON_VERSION_METADATA="${MASTODON_VERSION_METADATA}" \ MASTODON_VERSION_METADATA="${MASTODON_VERSION_METADATA}" \
# Apply timezone # Apply timezone
TZ=${TZ} TZ=${TZ}
ENV \ ENV \
# Configure the IP to bind Mastodon to when serving traffic # Configure the IP to bind Mastodon to when serving traffic
BIND="0.0.0.0" \ BIND="0.0.0.0" \
# Explicitly set PORT to match the exposed port # Explicitly set PORT to match the exposed port
PORT=4000 \ PORT=4000 \
# Use production settings for Yarn, Node and related nodejs based tools # Use production settings for Yarn, Node and related nodejs based tools
NODE_ENV="production" \ NODE_ENV="production" \
# Add Ruby and Mastodon installation to the PATH # Add Ruby and Mastodon installation to the PATH
DEBIAN_FRONTEND="noninteractive" DEBIAN_FRONTEND="noninteractive"
# Set default shell used for running commands # Set default shell used for running commands
@@ -56,29 +56,29 @@ ARG TARGETPLATFORM
RUN echo "Target platform is ${TARGETPLATFORM}" RUN echo "Target platform is ${TARGETPLATFORM}"
RUN \ RUN \
# Remove automatic apt cache Docker cleanup scripts # Remove automatic apt cache Docker cleanup scripts
rm -f /etc/apt/apt.conf.d/docker-clean; \ rm -f /etc/apt/apt.conf.d/docker-clean; \
# Sets timezone # Sets timezone
echo "${TZ}" > /etc/localtime; \ echo "${TZ}" > /etc/localtime; \
# Creates mastodon user/group and sets home directory # Creates mastodon user/group and sets home directory
groupadd -g "${GID}" mastodon; \ groupadd -g "${GID}" mastodon; \
useradd -l -u "${UID}" -g "${GID}" -m -d /opt/mastodon mastodon; \ useradd -l -u "${UID}" -g "${GID}" -m -d /opt/mastodon mastodon; \
# Creates symlink for /mastodon folder # Creates symlink for /mastodon folder
ln -s /opt/mastodon /mastodon; ln -s /opt/mastodon /mastodon;
# hadolint ignore=DL3008,DL3005 # hadolint ignore=DL3008,DL3005
RUN \ RUN \
# Mount Apt cache and lib directories from Docker buildx caches # Mount Apt cache and lib directories from Docker buildx caches
--mount=type=cache,id=apt-cache-${TARGETPLATFORM},target=/var/cache/apt,sharing=locked \ --mount=type=cache,id=apt-cache-${TARGETPLATFORM},target=/var/cache/apt,sharing=locked \
--mount=type=cache,id=apt-lib-${TARGETPLATFORM},target=/var/lib/apt,sharing=locked \ --mount=type=cache,id=apt-lib-${TARGETPLATFORM},target=/var/lib/apt,sharing=locked \
# Upgrade to check for security updates to Debian image # Upgrade to check for security updates to Debian image
apt-get update; \ apt-get update; \
apt-get dist-upgrade -yq; \ apt-get dist-upgrade -yq; \
apt-get install -y --no-install-recommends \ apt-get install -y --no-install-recommends \
ca-certificates \ ca-certificates \
curl \ curl \
tzdata \ tzdata \
wget \ wget \
; ;
# Set /opt/mastodon as working directory # Set /opt/mastodon as working directory
@@ -91,19 +91,19 @@ COPY .yarn /opt/mastodon/.yarn
COPY ./streaming /opt/mastodon/streaming COPY ./streaming /opt/mastodon/streaming
RUN \ RUN \
# Mount local Corepack and Yarn caches from Docker buildx caches # Mount local Corepack and Yarn caches from Docker buildx caches
--mount=type=cache,id=corepack-cache-${TARGETPLATFORM},target=/usr/local/share/.cache/corepack,sharing=locked \ --mount=type=cache,id=corepack-cache-${TARGETPLATFORM},target=/usr/local/share/.cache/corepack,sharing=locked \
--mount=type=cache,id=yarn-cache-${TARGETPLATFORM},target=/usr/local/share/.cache/yarn,sharing=locked \ --mount=type=cache,id=yarn-cache-${TARGETPLATFORM},target=/usr/local/share/.cache/yarn,sharing=locked \
# Configure Corepack # Configure Corepack
rm /usr/local/bin/yarn*; \ rm /usr/local/bin/yarn*; \
corepack enable; \ corepack enable; \
corepack prepare --activate; corepack prepare --activate;
RUN \ RUN \
# Mount Corepack and Yarn caches from Docker buildx caches # Mount Corepack and Yarn caches from Docker buildx caches
--mount=type=cache,id=corepack-cache-${TARGETPLATFORM},target=/usr/local/share/.cache/corepack,sharing=locked \ --mount=type=cache,id=corepack-cache-${TARGETPLATFORM},target=/usr/local/share/.cache/corepack,sharing=locked \
--mount=type=cache,id=yarn-cache-${TARGETPLATFORM},target=/usr/local/share/.cache/yarn,sharing=locked \ --mount=type=cache,id=yarn-cache-${TARGETPLATFORM},target=/usr/local/share/.cache/yarn,sharing=locked \
# Install Node packages # Install Node packages
yarn workspaces focus --production @mastodon/streaming; yarn workspaces focus --production @mastodon/streaming;
# Set the running user for resulting container # Set the running user for resulting container