Skip to content

Commit

Permalink
Merge pull request #2719 from ClearlyClaire/glitch-soc/merge-upstream
Browse files Browse the repository at this point in the history
Merge upstream changes up to ccb6aed
  • Loading branch information
ClearlyClaire authored May 25, 2024
2 parents ef01546 + 1a2a28e commit 60c2310
Show file tree
Hide file tree
Showing 21 changed files with 747 additions and 705 deletions.
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ gem 'rdf-normalize', '~> 0.5'

gem 'private_address_check', '~> 0.5'

gem 'opentelemetry-api', '~> 1.2.5'

group :opentelemetry do
gem 'opentelemetry-exporter-otlp', '~> 0.26.3', require: false
gem 'opentelemetry-instrumentation-active_job', '~> 0.7.1', require: false
Expand Down
5 changes: 3 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ GEM
rspec-mocks (~> 3.0)
sidekiq (>= 5, < 8)
rspec-support (3.13.1)
rubocop (1.63.5)
rubocop (1.64.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand Down Expand Up @@ -877,7 +877,7 @@ GEM
webfinger (1.2.0)
activesupport
httpclient (>= 2.4)
webmock (3.23.0)
webmock (3.23.1)
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
Expand Down Expand Up @@ -975,6 +975,7 @@ DEPENDENCIES
omniauth-rails_csrf_protection (~> 1.0)
omniauth-saml (~> 2.0)
omniauth_openid_connect (~> 0.6.1)
opentelemetry-api (~> 1.2.5)
opentelemetry-exporter-otlp (~> 0.26.3)
opentelemetry-instrumentation-active_job (~> 0.7.1)
opentelemetry-instrumentation-active_model_serializers (~> 0.20.1)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/auth/registrations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def update_resource(resource, params)
end

def build_resource(hash = nil)
super(hash)
super

resource.locale = I18n.locale
resource.invite_code = @invite&.code if resource.invite_code.blank?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const mapStateToProps = (state, { columnId }) => {
return {
settings: columns.get(index).get('params'),
onLoad (value) {
return api(() => state).get('/api/v2/search', { params: { q: value, type: 'hashtags' } }).then(response => {
return api().get('/api/v2/search', { params: { q: value, type: 'hashtags' } }).then(response => {
return (response.data.hashtags || []).map((tag) => {
return { value: tag.name, label: `#${tag.name}` };
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const mapStateToProps = (state, { columnId }) => {
return {
settings: columns.get(index).get('params'),
onLoad (value) {
return api(() => state).get('/api/v2/search', { params: { q: value, type: 'hashtags' } }).then(response => {
return api().get('/api/v2/search', { params: { q: value, type: 'hashtags' } }).then(response => {
return (response.data.hashtags || []).map((tag) => {
return { value: tag.name, label: `#${tag.name}` };
});
Expand Down
2 changes: 1 addition & 1 deletion app/javascript/mastodon/locales/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@
"embed.preview": "이렇게 표시됩니다:",
"emoji_button.activity": "활동",
"emoji_button.clear": "지우기",
"emoji_button.custom": "사용자 지정",
"emoji_button.custom": "커스텀",
"emoji_button.flags": "깃발",
"emoji_button.food": "음식과 마실것",
"emoji_button.label": "에모지 추가",
Expand Down
5 changes: 5 additions & 0 deletions app/javascript/mastodon/locales/nn.json
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@
"filter_modal.select_filter.subtitle": "Bruk ein eksisterande kategori eller opprett ein ny",
"filter_modal.select_filter.title": "Filtrer dette innlegget",
"filter_modal.title.status": "Filtrer eit innlegg",
"filtered_notifications_banner.mentions": "{count, plural, one {omtale} other {omtaler}}",
"filtered_notifications_banner.pending_requests": "Varsel frå {count, plural, =0 {ingen} one {ein person} other {# folk}} du kanskje kjenner",
"filtered_notifications_banner.title": "Filtrerte varslingar",
"firehose.all": "Alle",
Expand All @@ -307,13 +308,17 @@
"follow_requests.unlocked_explanation": "Sjølv om kontoen din ikkje er låst tenkte dei som driv {domain} at du kanskje ville gå gjennom førespurnadar frå desse kontoane manuelt.",
"follow_suggestions.curated_suggestion": "Utvalt av staben",
"follow_suggestions.dismiss": "Ikkje vis igjen",
"follow_suggestions.featured_longer": "Hanplukka av gjengen på {domain}",
"follow_suggestions.friends_of_friends_longer": "Populært hjå dei du fylgjer",
"follow_suggestions.hints.featured": "Denne profilen er handplukka av folka på {domain}.",
"follow_suggestions.hints.friends_of_friends": "Denne profilen er populær hjå dei du fylgjer.",
"follow_suggestions.hints.most_followed": "Mange på {domain} fylgjer denne profilen.",
"follow_suggestions.hints.most_interactions": "Denne profilen har nyss fått mykje merksemd på {domain}.",
"follow_suggestions.hints.similar_to_recently_followed": "Denne profilen liknar på dei andre profilane du har fylgt i det siste.",
"follow_suggestions.personalized_suggestion": "Personleg forslag",
"follow_suggestions.popular_suggestion": "Populært forslag",
"follow_suggestions.popular_suggestion_longer": "Populært på {domain}",
"follow_suggestions.similar_to_recently_followed_longer": "Liknar på profilar du har fylgt i det siste",
"follow_suggestions.view_all": "Vis alle",
"follow_suggestions.who_to_follow": "Kven du kan fylgja",
"followed_tags": "Fylgde emneknaggar",
Expand Down
2 changes: 1 addition & 1 deletion app/lib/activitypub/serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ def serializable_hash(adapter_options = nil, options = {}, adapter_instance = se
adapter_options[:named_contexts].merge!(_named_contexts)
adapter_options[:context_extensions].merge!(_context_extensions)
end
super(adapter_options, options, adapter_instance)
super
end
end
2 changes: 1 addition & 1 deletion app/lib/advanced_text_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def autolink(link, link_type)
# @option options [String] :content_type
def initialize(text, options = {})
@content_type = options.delete(:content_type)
super(text, options)
super

@text = format_markdown(text) if content_type == 'text/markdown'
end
Expand Down
2 changes: 1 addition & 1 deletion app/lib/connection_pool/shared_connection_pool.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class ConnectionPool::SharedConnectionPool < ConnectionPool
def initialize(options = {}, &block)
super(options, &block)
super

@available = ConnectionPool::SharedTimedStack.new(@size, &block)
end
Expand Down
2 changes: 1 addition & 1 deletion app/lib/rss/channel.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class RSS::Channel < RSS::Element
def initialize
super()
super

@root = create_element('channel')
end
Expand Down
2 changes: 1 addition & 1 deletion app/lib/rss/item.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class RSS::Item < RSS::Element
def initialize
super()
super

@root = create_element('item')
end
Expand Down
2 changes: 1 addition & 1 deletion app/models/concerns/attachmentable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module Attachmentable

included do
def self.has_attached_file(name, options = {}) # rubocop:disable Naming/PredicateName
super(name, options)
super

send(:"before_#{name}_validate", prepend: true) do
attachment = send(name)
Expand Down
22 changes: 16 additions & 6 deletions app/services/account_search_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,23 @@ def core_query
end

def call(query, account = nil, options = {})
@query = query&.strip&.gsub(/\A@/, '')
@limit = options[:limit].to_i
@offset = options[:offset].to_i
@options = options
@account = account
MastodonOTELTracer.in_span('AccountSearchService#call') do |span|
@query = query&.strip&.gsub(/\A@/, '')
@limit = options[:limit].to_i
@offset = options[:offset].to_i
@options = options
@account = account

span.add_attributes(
'search.offset' => @offset,
'search.limit' => @limit,
'search.backend' => Chewy.enabled? ? 'elasticsearch' : 'database'
)

search_service_results.compact.uniq
search_service_results.compact.uniq.tap do |results|
span.set_attribute('search.results.count', results.size)
end
end
end

private
Expand Down
26 changes: 18 additions & 8 deletions app/services/statuses_search_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,24 @@

class StatusesSearchService < BaseService
def call(query, account = nil, options = {})
@query = query&.strip
@account = account
@options = options
@limit = options[:limit].to_i
@offset = options[:offset].to_i

convert_deprecated_options!
status_search_results
MastodonOTELTracer.in_span('StatusesSearchService#call') do |span|
@query = query&.strip
@account = account
@options = options
@limit = options[:limit].to_i
@offset = options[:offset].to_i
convert_deprecated_options!

span.add_attributes(
'search.offset' => @offset,
'search.limit' => @limit,
'search.backend' => Chewy.enabled? ? 'elasticsearch' : 'database'
)

status_search_results.tap do |results|
span.set_attribute('search.results.count', results.size)
end
end
end

private
Expand Down
24 changes: 17 additions & 7 deletions app/services/tag_search_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,25 @@

class TagSearchService < BaseService
def call(query, options = {})
@query = query.strip.delete_prefix('#')
@offset = options.delete(:offset).to_i
@limit = options.delete(:limit).to_i
@options = options
MastodonOTELTracer.in_span('TagSearchService#call') do |span|
@query = query.strip.delete_prefix('#')
@offset = options.delete(:offset).to_i
@limit = options.delete(:limit).to_i
@options = options

results = from_elasticsearch if Chewy.enabled?
results ||= from_database
span.add_attributes(
'search.offset' => @offset,
'search.limit' => @limit,
'search.backend' => Chewy.enabled? ? 'elasticsearch' : 'database'
)

results
results = from_elasticsearch if Chewy.enabled?
results ||= from_database

span.set_attribute('search.results.count', results.size)

results
end
end

private
Expand Down
2 changes: 1 addition & 1 deletion config/initializers/0_duplicate_migrations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def self.new(direction, migrations, schema_migration, internal_metadata, target_
end
end

super(direction, migrations, schema_migration, internal_metadata, target_version)
super
end
end

Expand Down
2 changes: 2 additions & 0 deletions config/initializers/opentelemetry.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,5 @@
c.service_version = Mastodon::Version.to_s
end
end

MastodonOTELTracer = OpenTelemetry.tracer_provider.tracer('mastodon')
1 change: 1 addition & 0 deletions config/locales/fi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,7 @@ fi:
delete: Poista
edit_preset: Muokkaa varoituksen esiasetusta
empty: Et ole vielä määrittänyt yhtäkään varoitusten esiasetusta.
title: Varoituksen esiasetukset
webhooks:
add_new: Lisää päätepiste
delete: Poista
Expand Down
2 changes: 2 additions & 0 deletions config/locales/nn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ nn:
update_custom_emoji_html: "%{name} oppdaterte emojien %{target}"
update_domain_block_html: "%{name} oppdaterte domeneblokkeringa for %{target}"
update_ip_block_html: "%{name} endret regel for IP %{target}"
update_report_html: "%{name} oppdaterte rapporten %{target}"
update_status_html: "%{name} oppdaterte innlegg av %{target}"
update_user_role_html: "%{name} endret %{target} -rolle"
deleted_account: sletta konto
Expand Down Expand Up @@ -950,6 +951,7 @@ nn:
delete: Slett
edit_preset: Endr åtvaringsoppsett
empty: Du har ikke definert noen forhåndsinnstillinger for advarsler enda.
title: Førehandsinnstillingar for varsel
webhooks:
add_new: Legg til endepunkt
delete: Slett
Expand Down
Loading

0 comments on commit 60c2310

Please sign in to comment.