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

This commit is contained in:
Claire
2025-08-24 11:43:25 +02:00
6 changed files with 31 additions and 16 deletions

View File

@@ -88,7 +88,7 @@ gem 'sidekiq-scheduler', '~> 6.0'
gem 'sidekiq-unique-jobs', '> 8'
gem 'simple_form', '~> 5.2'
gem 'simple-navigation', '~> 4.4'
gem 'stoplight'
gem 'stoplight', github: 'ClearlyClaire/stoplight', ref: 'f13e0c0d5e6d34af8d3cfc888871caa84237db42'
gem 'strong_migrations'
gem 'tty-prompt', '~> 0.23', require: false
gem 'twitter-text', '~> 3.1.0'

View File

@@ -1,3 +1,11 @@
GIT
remote: https://github.com/ClearlyClaire/stoplight.git
revision: f13e0c0d5e6d34af8d3cfc888871caa84237db42
ref: f13e0c0d5e6d34af8d3cfc888871caa84237db42
specs:
stoplight (5.3.1)
zeitwerk
GIT
remote: https://github.com/mastodon/webpush.git
revision: 9631ac63045cfabddacc69fc06e919b4c13eb913
@@ -853,8 +861,6 @@ GEM
stackprof (0.2.27)
starry (0.2.0)
base64
stoplight (5.3.1)
zeitwerk
stringio (3.1.7)
strong_migrations (2.5.0)
activerecord (>= 7.1)
@@ -1086,7 +1092,7 @@ DEPENDENCIES
simplecov (~> 0.22)
simplecov-lcov (~> 0.8)
stackprof
stoplight
stoplight!
strong_migrations
test-prof
thor (~> 1.2)

View File

@@ -22,6 +22,6 @@ class RuleTranslation < ApplicationRecord
scope :by_language_length, -> { order(Arel.sql('LENGTH(LANGUAGE)').desc) }
def self.languages
RuleTranslation.joins(:rule).merge(Rule.kept).select(:language).distinct.pluck(:language).sort
joins(:rule).merge(Rule.kept).distinct.pluck(:language).sort
end
end

View File

@@ -307,7 +307,7 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
@quote_changed = true
else
quote = @status.quote
quote.update(approval_uri: approval_uri, state: :pending, legacy: @status_parser.legacy_quote?) if quote.approval_uri != @status_parser.quote_approval_uri
quote.update(approval_uri: approval_uri, state: :pending, legacy: @status_parser.legacy_quote?) if quote.approval_uri != approval_uri
end
else
quote = Quote.create(status: @status, approval_uri: approval_uri, legacy: @status_parser.legacy_quote?)

View File

@@ -13,7 +13,7 @@ class ActivityPub::VerifyQuoteService < BaseService
@fetching_error = nil
fetch_quoted_post_if_needed!(fetchable_quoted_uri, prefetched_body: prefetched_quoted_object)
return handle_local_quote! if quote.quoted_account&.local?
return if quote.quoted_account&.local?
return if fast_track_approval! || quote.approval_uri.blank?
@json = fetch_approval_object(quote.approval_uri, prefetched_body: prefetched_approval)
@@ -35,15 +35,6 @@ class ActivityPub::VerifyQuoteService < BaseService
private
def handle_local_quote!
@quote.update!(approval_uri: nil)
if StatusPolicy.new(@quote.account, @quote.quoted_status).quote?
@quote.accept!
else
@quote.reject!
end
end
# FEP-044f defines rules that don't require the approval flow
def fast_track_approval!
return false if @quote.quoted_status_id.blank?

View File

@@ -52,4 +52,22 @@ RSpec.describe RuleTranslation do
end
end
end
describe '.languages' do
let(:discarded_rule) { Fabricate :rule, deleted_at: 5.days.ago }
let(:kept_rule) { Fabricate :rule }
before do
Fabricate :rule_translation, rule: discarded_rule, language: 'en'
Fabricate :rule_translation, rule: kept_rule, language: 'es'
Fabricate :rule_translation, language: 'fr'
Fabricate :rule_translation, language: 'es'
end
it 'returns ordered distinct languages connected to non-discarded rules' do
expect(described_class.languages)
.to be_an(Array)
.and eq(%w(es fr))
end
end
end