mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-14 16:28:59 +00:00
Merge commit 'f6e822e1f5c18553db246991ebfb8658acaef59f' into glitch-soc/merge-upstream
This commit is contained in:
2
Gemfile
2
Gemfile
@@ -88,7 +88,7 @@ gem 'sidekiq-scheduler', '~> 6.0'
|
|||||||
gem 'sidekiq-unique-jobs', '> 8'
|
gem 'sidekiq-unique-jobs', '> 8'
|
||||||
gem 'simple_form', '~> 5.2'
|
gem 'simple_form', '~> 5.2'
|
||||||
gem 'simple-navigation', '~> 4.4'
|
gem 'simple-navigation', '~> 4.4'
|
||||||
gem 'stoplight'
|
gem 'stoplight', github: 'ClearlyClaire/stoplight', ref: 'f13e0c0d5e6d34af8d3cfc888871caa84237db42'
|
||||||
gem 'strong_migrations'
|
gem 'strong_migrations'
|
||||||
gem 'tty-prompt', '~> 0.23', require: false
|
gem 'tty-prompt', '~> 0.23', require: false
|
||||||
gem 'twitter-text', '~> 3.1.0'
|
gem 'twitter-text', '~> 3.1.0'
|
||||||
|
|||||||
12
Gemfile.lock
12
Gemfile.lock
@@ -1,3 +1,11 @@
|
|||||||
|
GIT
|
||||||
|
remote: https://github.com/ClearlyClaire/stoplight.git
|
||||||
|
revision: f13e0c0d5e6d34af8d3cfc888871caa84237db42
|
||||||
|
ref: f13e0c0d5e6d34af8d3cfc888871caa84237db42
|
||||||
|
specs:
|
||||||
|
stoplight (5.3.1)
|
||||||
|
zeitwerk
|
||||||
|
|
||||||
GIT
|
GIT
|
||||||
remote: https://github.com/mastodon/webpush.git
|
remote: https://github.com/mastodon/webpush.git
|
||||||
revision: 9631ac63045cfabddacc69fc06e919b4c13eb913
|
revision: 9631ac63045cfabddacc69fc06e919b4c13eb913
|
||||||
@@ -853,8 +861,6 @@ GEM
|
|||||||
stackprof (0.2.27)
|
stackprof (0.2.27)
|
||||||
starry (0.2.0)
|
starry (0.2.0)
|
||||||
base64
|
base64
|
||||||
stoplight (5.3.1)
|
|
||||||
zeitwerk
|
|
||||||
stringio (3.1.7)
|
stringio (3.1.7)
|
||||||
strong_migrations (2.5.0)
|
strong_migrations (2.5.0)
|
||||||
activerecord (>= 7.1)
|
activerecord (>= 7.1)
|
||||||
@@ -1086,7 +1092,7 @@ DEPENDENCIES
|
|||||||
simplecov (~> 0.22)
|
simplecov (~> 0.22)
|
||||||
simplecov-lcov (~> 0.8)
|
simplecov-lcov (~> 0.8)
|
||||||
stackprof
|
stackprof
|
||||||
stoplight
|
stoplight!
|
||||||
strong_migrations
|
strong_migrations
|
||||||
test-prof
|
test-prof
|
||||||
thor (~> 1.2)
|
thor (~> 1.2)
|
||||||
|
|||||||
@@ -22,6 +22,6 @@ class RuleTranslation < ApplicationRecord
|
|||||||
scope :by_language_length, -> { order(Arel.sql('LENGTH(LANGUAGE)').desc) }
|
scope :by_language_length, -> { order(Arel.sql('LENGTH(LANGUAGE)').desc) }
|
||||||
|
|
||||||
def self.languages
|
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
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -307,7 +307,7 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
|
|||||||
@quote_changed = true
|
@quote_changed = true
|
||||||
else
|
else
|
||||||
quote = @status.quote
|
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
|
end
|
||||||
else
|
else
|
||||||
quote = Quote.create(status: @status, approval_uri: approval_uri, legacy: @status_parser.legacy_quote?)
|
quote = Quote.create(status: @status, approval_uri: approval_uri, legacy: @status_parser.legacy_quote?)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class ActivityPub::VerifyQuoteService < BaseService
|
|||||||
@fetching_error = nil
|
@fetching_error = nil
|
||||||
|
|
||||||
fetch_quoted_post_if_needed!(fetchable_quoted_uri, prefetched_body: prefetched_quoted_object)
|
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?
|
return if fast_track_approval! || quote.approval_uri.blank?
|
||||||
|
|
||||||
@json = fetch_approval_object(quote.approval_uri, prefetched_body: prefetched_approval)
|
@json = fetch_approval_object(quote.approval_uri, prefetched_body: prefetched_approval)
|
||||||
@@ -35,15 +35,6 @@ class ActivityPub::VerifyQuoteService < BaseService
|
|||||||
|
|
||||||
private
|
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
|
# FEP-044f defines rules that don't require the approval flow
|
||||||
def fast_track_approval!
|
def fast_track_approval!
|
||||||
return false if @quote.quoted_status_id.blank?
|
return false if @quote.quoted_status_id.blank?
|
||||||
|
|||||||
@@ -52,4 +52,22 @@ RSpec.describe RuleTranslation do
|
|||||||
end
|
end
|
||||||
end
|
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
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user