diff --git a/.nvmrc b/.nvmrc index 403f75d038..f666621e50 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -22.20 +24.10 diff --git a/Dockerfile b/Dockerfile index e457ae3623..1c9c956b72 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] # renovate: datasource=docker depName=docker.io/ruby 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 -ARG NODE_MAJOR_VERSION="22" +ARG NODE_MAJOR_VERSION="24" # Debian image to use for base image, change with [--build-arg DEBIAN_VERSION="trixie"] ARG DEBIAN_VERSION="trixie" # Node.js image to use for base image based on combined variables (ex: 20-trixie-slim) diff --git a/README.md b/README.md index ba800f59d5..9cb0d3e61f 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ Mastodon is a **free, open-source social network server** based on [ActivityPub] ### Requirements - **Ruby** 3.2+ -- **PostgreSQL** 13+ +- **PostgreSQL** 14+ - **Redis** 7.0+ - **Node.js** 20+ diff --git a/app/serializers/rest/scheduled_status_serializer.rb b/app/serializers/rest/scheduled_status_serializer.rb index 7c54f39c0d..71ddb7b3e1 100644 --- a/app/serializers/rest/scheduled_status_serializer.rb +++ b/app/serializers/rest/scheduled_status_serializer.rb @@ -8,4 +8,11 @@ class REST::ScheduledStatusSerializer < ActiveModel::Serializer def id object.id.to_s 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 diff --git a/app/workers/publish_scheduled_status_worker.rb b/app/workers/publish_scheduled_status_worker.rb index bcf20b4943..0e34aa7791 100644 --- a/app/workers/publish_scheduled_status_worker.rb +++ b/app/workers/publish_scheduled_status_worker.rb @@ -23,6 +23,7 @@ class PublishScheduledStatusWorker options.tap do |options_hash| 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[:quoted_status] = Status.find(options_hash.delete(:quoted_status_id)) if options_hash[:quoted_status_id] end end end diff --git a/config/initializers/strong_migrations.rb b/config/initializers/strong_migrations.rb index 59053ca187..d722b16a0f 100644 --- a/config/initializers/strong_migrations.rb +++ b/config/initializers/strong_migrations.rb @@ -1,4 +1,4 @@ # frozen_string_literal: true StrongMigrations.start_after = 2017_09_24_022025 -StrongMigrations.target_version = 13 +StrongMigrations.target_version = 14 diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index 054f8b0177..e5ca6ac2ac 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -63,7 +63,7 @@ namespace :db do task pre_migration_check: :environment do 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 abort <<~MESSAGE if ENV['SKIP_POST_DEPLOYMENT_MIGRATIONS'] && schema_version < 2023_09_07_150100 diff --git a/spec/serializers/rest/scheduled_status_serializer_spec.rb b/spec/serializers/rest/scheduled_status_serializer_spec.rb index 2cf0098654..6fc2f2eca9 100644 --- a/spec/serializers/rest/scheduled_status_serializer_spec.rb +++ b/spec/serializers/rest/scheduled_status_serializer_spec.rb @@ -10,14 +10,18 @@ RSpec.describe REST::ScheduledStatusSerializer do ) 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 it 'returns expected values and removes application_id from params' do expect(subject.deep_symbolize_keys) .to include( 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 diff --git a/spec/workers/publish_scheduled_status_worker_spec.rb b/spec/workers/publish_scheduled_status_worker_spec.rb index a91e665965..81480f7e54 100644 --- a/spec/workers/publish_scheduled_status_worker_spec.rb +++ b/spec/workers/publish_scheduled_status_worker_spec.rb @@ -13,8 +13,12 @@ RSpec.describe PublishScheduledStatusWorker do end 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 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 end diff --git a/streaming/Dockerfile b/streaming/Dockerfile index 679425dfcc..3a12007f68 100644 --- a/streaming/Dockerfile +++ b/streaming/Dockerfile @@ -8,9 +8,9 @@ ARG TARGETPLATFORM=${TARGETPLATFORM} ARG BUILDPLATFORM=${BUILDPLATFORM} 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 -ARG NODE_MAJOR_VERSION="22" +ARG NODE_MAJOR_VERSION="24" # Debian image to use for base image, change with [--build-arg DEBIAN_VERSION="trixie"] ARG DEBIAN_VERSION="trixie" # 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 ENV \ -# Apply Mastodon version information + # Apply Mastodon version information MASTODON_VERSION_PRERELEASE="${MASTODON_VERSION_PRERELEASE}" \ MASTODON_VERSION_METADATA="${MASTODON_VERSION_METADATA}" \ -# Apply timezone + # Apply timezone TZ=${TZ} 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" \ -# Explicitly set PORT to match the exposed port + # Explicitly set PORT to match the exposed port 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" \ -# Add Ruby and Mastodon installation to the PATH + # Add Ruby and Mastodon installation to the PATH DEBIAN_FRONTEND="noninteractive" # Set default shell used for running commands @@ -56,29 +56,29 @@ ARG TARGETPLATFORM RUN echo "Target platform is ${TARGETPLATFORM}" RUN \ -# Remove automatic apt cache Docker cleanup scripts + # Remove automatic apt cache Docker cleanup scripts rm -f /etc/apt/apt.conf.d/docker-clean; \ -# Sets timezone + # Sets timezone echo "${TZ}" > /etc/localtime; \ -# Creates mastodon user/group and sets home directory + # Creates mastodon user/group and sets home directory groupadd -g "${GID}" 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; # hadolint ignore=DL3008,DL3005 RUN \ -# 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-lib-${TARGETPLATFORM},target=/var/lib/apt,sharing=locked \ -# Upgrade to check for security updates to Debian image + # 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-lib-${TARGETPLATFORM},target=/var/lib/apt,sharing=locked \ + # Upgrade to check for security updates to Debian image apt-get update; \ apt-get dist-upgrade -yq; \ apt-get install -y --no-install-recommends \ - ca-certificates \ - curl \ - tzdata \ - wget \ + ca-certificates \ + curl \ + tzdata \ + wget \ ; # Set /opt/mastodon as working directory @@ -91,19 +91,19 @@ COPY .yarn /opt/mastodon/.yarn COPY ./streaming /opt/mastodon/streaming RUN \ -# 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=yarn-cache-${TARGETPLATFORM},target=/usr/local/share/.cache/yarn,sharing=locked \ + # 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=yarn-cache-${TARGETPLATFORM},target=/usr/local/share/.cache/yarn,sharing=locked \ # Configure Corepack rm /usr/local/bin/yarn*; \ corepack enable; \ corepack prepare --activate; RUN \ -# 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=yarn-cache-${TARGETPLATFORM},target=/usr/local/share/.cache/yarn,sharing=locked \ -# Install Node packages + # 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=yarn-cache-${TARGETPLATFORM},target=/usr/local/share/.cache/yarn,sharing=locked \ + # Install Node packages yarn workspaces focus --production @mastodon/streaming; # Set the running user for resulting container