Skip to content

Commit

Permalink
Merge branch 'TheEssem:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
bingxin666 authored Jan 17, 2025
2 parents 50301c8 + 7c3b0da commit e87cb11
Show file tree
Hide file tree
Showing 31 changed files with 232 additions and 89 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint-haml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ jobs:
- name: Run haml-lint
run: |
echo "::add-matcher::.github/workflows/haml-lint-problem-matcher.json"
bin/haml-lint --reporter github
bin/haml-lint --parallel --reporter github
3 changes: 3 additions & 0 deletions .rubocop/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,6 @@ Style/TrailingCommaInArrayLiteral:

Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: comma

Style/WordArray:
MinSize: 3 # Override default of 2
18 changes: 1 addition & 17 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This configuration was generated by
# `rubocop --auto-gen-config --auto-gen-only-exclude --no-offense-counts --no-auto-gen-timestamp`
# using RuboCop version 1.69.2.
# using RuboCop version 1.70.0.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
Expand Down Expand Up @@ -69,15 +69,6 @@ Style/MapToHash:
Exclude:
- 'app/models/status.rb'

# This cop supports unsafe autocorrection (--autocorrect-all).
# Configuration parameters: EnforcedStyle.
# SupportedStyles: literals, strict
Style/MutableConstant:
Exclude:
- 'app/models/tag.rb'
- 'app/services/delete_account_service.rb'
- 'lib/mastodon/migration_warning.rb'

# Configuration parameters: AllowedMethods.
# AllowedMethods: respond_to_missing?
Style/OptionalBooleanParameter:
Expand All @@ -103,10 +94,3 @@ Style/RedundantConstantBase:
Exclude:
- 'config/environments/production.rb'
- 'config/initializers/sidekiq.rb'

# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: WordRegex.
# SupportedStyles: percent, brackets
Style/WordArray:
EnforcedStyle: percent
MinSize: 3
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

All notable changes to this project will be documented in this file.

## [4.3.3] - 2025-01-16

### Security

- Fix insufficient validation of account URIs ([GHSA-5wxh-3p65-r4g6](https://github.com/mastodon/mastodon/security/advisories/GHSA-5wxh-3p65-r4g6))
- Update dependencies

### Fixed

- Fix `libyaml` missing from `Dockerfile` build stage (#33591 by @vmstan)
- Fix incorrect notification settings migration for non-followers (#33348 by @ClearlyClaire)
- Fix down clause for notification policy v2 migrations (#33340 by @jesseplusplus)
- Fix error decrementing status count when `FeaturedTags#last_status_at` is `nil` (#33320 by @ClearlyClaire)
- Fix last paginated notification group only including data on a single notification (#33271 by @ClearlyClaire)
- Fix processing of mentions for post edits with an existing corresponding silent mention (#33227 by @ClearlyClaire)
- Fix deletion of unconfirmed users with Webauthn set (#33186 by @ClearlyClaire)
- Fix empty authors preview card serialization (#33151, #33466 by @mjankowski and @ClearlyClaire)

## [4.3.2] - 2024-12-03

### Added
Expand Down
5 changes: 3 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ GEM
opentelemetry-instrumentation-rack (0.25.0)
opentelemetry-api (~> 1.0)
opentelemetry-instrumentation-base (~> 0.22.1)
opentelemetry-instrumentation-rails (0.34.0)
opentelemetry-instrumentation-rails (0.34.1)
opentelemetry-api (~> 1.0)
opentelemetry-instrumentation-action_mailer (~> 0.3.0)
opentelemetry-instrumentation-action_pack (~> 0.10.0)
Expand All @@ -538,6 +538,7 @@ GEM
opentelemetry-instrumentation-active_record (~> 0.8.0)
opentelemetry-instrumentation-active_support (~> 0.7.0)
opentelemetry-instrumentation-base (~> 0.22.1)
opentelemetry-instrumentation-concurrent_ruby (~> 0.21.4)
opentelemetry-instrumentation-redis (0.25.7)
opentelemetry-api (~> 1.0)
opentelemetry-instrumentation-base (~> 0.22.1)
Expand Down Expand Up @@ -793,7 +794,7 @@ GEM
simplecov-html (0.13.1)
simplecov-lcov (0.8.0)
simplecov_json_formatter (0.1.4)
stackprof (0.2.26)
stackprof (0.2.27)
stoplight (4.1.0)
redlock (~> 1.0)
stringio (3.1.2)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/auth/setup_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def update

if @user.update(user_params)
@user.resend_confirmation_instructions unless @user.confirmed?
redirect_to auth_setup_path, notice: I18n.t('auth.setup.new_confirmation_instructions_sent')
redirect_to auth_setup_path, notice: t('auth.setup.new_confirmation_instructions_sent')
else
render :show
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,11 +177,6 @@ export const Conversation = ({ conversation, scrollKey, onMoveUp, onMoveDown })
toggleHidden: handleShowMore,
};

let media = null;
if (lastStatus.get('media_attachments').size > 0) {
media = <AttachmentList compact media={lastStatus.get('media_attachments')} />;
}

return (
<HotKeys handlers={handlers}>
<div className={classNames('conversation focusable muted', { unread })} tabIndex={0}>
Expand All @@ -206,9 +201,15 @@ export const Conversation = ({ conversation, scrollKey, onMoveUp, onMoveDown })
expanded={sharedCWState ? lastStatus.get('hidden') : expanded}
onExpandedToggle={handleShowMore}
collapsible
media={media}
/>

{lastStatus.get('media_attachments').size > 0 && (
<AttachmentList
compact
media={lastStatus.get('media_attachments')}
/>
)}

<div className='status__action-bar'>
<IconButton className='status__action-bar-button' title={intl.formatMessage(messages.reply)} icon='reply' iconComponent={ReplyIcon} onClick={handleReply} />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ class StatusCheckBox extends PureComponent {
</div>
</div>

<StatusContent status={status} media={<MediaAttachments status={status} visible={false} />} />
<StatusContent status={status} />
<MediaAttachments status={status} visible={false} />
</div>
);

Expand Down
9 changes: 9 additions & 0 deletions app/javascript/mastodon/locales/sk.json
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,8 @@
"ignore_notifications_modal.not_followers_title": "Nevšímať si oznámenia od ľudí, ktorí ťa nenasledujú?",
"ignore_notifications_modal.not_following_title": "Nevšímať si oznámenia od ľudí, ktorých nenasleduješ?",
"ignore_notifications_modal.private_mentions_title": "Nevšímať si oznámenia o nevyžiadaných súkromných spomínaniach?",
"interaction_modal.action.favourite": "Pre pokračovanie si musíš obľúbiť zo svojho účtu.",
"interaction_modal.action.follow": "Pre pokračovanie musíš nasledovať zo svojho účtu.",
"interaction_modal.action.reply": "Pre pokračovanie musíš odpovedať s tvojho účtu.",
"interaction_modal.action.vote": "Pre pokračovanie musíš hlasovať s tvojho účtu.",
"interaction_modal.go": "Prejdi",
Expand All @@ -389,6 +391,7 @@
"interaction_modal.title.reblog": "Zdieľať príspevok od {name}",
"interaction_modal.title.reply": "Odpovedať na príspevok od {name}",
"interaction_modal.title.vote": "Hlasuj v ankete od {name}",
"interaction_modal.username_prompt": "Napr. {example}",
"intervals.full.days": "{number, plural, one {# deň} few {# dni} many {# dní} other {# dní}}",
"intervals.full.hours": "{number, plural, one {# hodina} few {# hodiny} many {# hodín} other {# hodín}}",
"intervals.full.minutes": "{number, plural, one {# minúta} few {# minúty} many {# minút} other {# minút}}",
Expand Down Expand Up @@ -517,6 +520,7 @@
"notification.moderation_warning": "Dostal/a si varovanie od moderátora",
"notification.moderation_warning.action_delete_statuses": "Niektoré z tvojich príspevkov boli odstránené.",
"notification.moderation_warning.action_disable": "Tvoj účet bol vypnutý.",
"notification.moderation_warning.action_mark_statuses_as_sensitive": "Niektoré tvoje príspevky boli označené za chúlostivé.",
"notification.moderation_warning.action_none": "Tvoj účet dostal upozornenie od moderátora.",
"notification.moderation_warning.action_sensitive": "Tvoje príspevky budú odteraz označované ako chúlostivé.",
"notification.moderation_warning.action_silence": "Tvoj účet bol obmedzený.",
Expand Down Expand Up @@ -575,9 +579,11 @@
"notifications.policy.accept_hint": "Ukáž v oznámeniach",
"notifications.policy.drop": "Ignoruj",
"notifications.policy.filter": "Triediť",
"notifications.policy.filter_limited_accounts_hint": "Obmedzené moderátormi servera",
"notifications.policy.filter_limited_accounts_title": "Moderované účty",
"notifications.policy.filter_new_accounts_title": "Nové účty",
"notifications.policy.filter_not_followers_title": "Ľudia, ktorí ťa nenasledujú",
"notifications.policy.filter_not_following_hint": "Pokiaľ ich ručne neschváliš",
"notifications.policy.filter_not_following_title": "Ľudia, ktorých nenasleduješ",
"notifications.policy.filter_private_mentions_title": "Nevyžiadané priame spomenutia",
"notifications.policy.title": "Spravuj oznámenia od…",
Expand Down Expand Up @@ -625,6 +631,7 @@
"privacy_policy.title": "Pravidlá ochrany súkromia",
"recommended": "Odporúčané",
"refresh": "Obnoviť",
"regeneration_indicator.please_stand_by": "Prosím, čakajte.",
"regeneration_indicator.preparing_your_home_feed": "Pripravuje sa tvoj domáci kanál…",
"relative_time.days": "{number} dní",
"relative_time.full.days": "Pred {number, plural, one {# dňom} other {# dňami}}",
Expand Down Expand Up @@ -716,6 +723,7 @@
"server_banner.about_active_users": "Ľudia používajúci tento server za posledných 30 dní (aktívni používatelia za mesiac)",
"server_banner.active_users": "Aktívne účty",
"server_banner.administered_by": "Správa servera:",
"server_banner.is_one_of_many": "{domain} je jeden z mnohých nezávislých Mastodon serverov, ktoré môžeš použiť na zúčastňovanie sa v rámci fediversa.",
"server_banner.server_stats": "Štatistiky servera:",
"sign_in_banner.create_account": "Vytvoriť účet",
"sign_in_banner.sign_in": "Prihlásiť sa",
Expand Down Expand Up @@ -758,6 +766,7 @@
"status.reblogs.empty": "Nikto ešte tento príspevok nezdieľal. Keď tak niekto urobí, zobrazí sa to tu.",
"status.redraft": "Vymazať a prepísať",
"status.remove_bookmark": "Odstrániť záložku",
"status.remove_favourite": "Odstráň z obľúbených",
"status.replied_in_thread": "Odpovedal/a vo vlákne",
"status.replied_to": "Odpoveď na {name}",
"status.reply": "Odpovedať",
Expand Down
2 changes: 2 additions & 0 deletions app/lib/delivery_failure_tracker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def without_unavailable(urls)
urls.reject do |url|
host = Addressable::URI.parse(url).normalized_host
unavailable_domains_map[host]
rescue Addressable::URI::InvalidURIError, IDN::Idna::IdnaError
true
end
end

Expand Down
4 changes: 3 additions & 1 deletion app/models/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ class Account < ApplicationRecord
validates :uri, absence: true
end

validates :domain, exclusion: { in: [''] }

normalizes :username, with: ->(username) { username.squish }

scope :without_internal, -> { where(id: 1...) }
Expand Down Expand Up @@ -199,7 +201,7 @@ def local?
end

def remote?
domain.present?
!domain.nil?
end

def moved?
Expand Down
8 changes: 4 additions & 4 deletions app/models/tag.rb
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ class Tag < ApplicationRecord
has_one :trend, class_name: 'TagTrend', inverse_of: :tag, dependent: :destroy

HASHTAG_SEPARATORS = "_\u00B7\u30FB\u200c"
HASHTAG_FIRST_SEQUENCE_CHUNK_ONE = "[[:word:]_][[:word:]#{HASHTAG_SEPARATORS}]*[[:alpha:]#{HASHTAG_SEPARATORS}]"
HASHTAG_FIRST_SEQUENCE_CHUNK_TWO = "[[:word:]#{HASHTAG_SEPARATORS}]*[[:word:]_]"
HASHTAG_FIRST_SEQUENCE = "(#{HASHTAG_FIRST_SEQUENCE_CHUNK_ONE}#{HASHTAG_FIRST_SEQUENCE_CHUNK_TWO})"
HASHTAG_FIRST_SEQUENCE_CHUNK_ONE = "[[:word:]_][[:word:]#{HASHTAG_SEPARATORS}]*[[:alpha:]#{HASHTAG_SEPARATORS}]".freeze
HASHTAG_FIRST_SEQUENCE_CHUNK_TWO = "[[:word:]#{HASHTAG_SEPARATORS}]*[[:word:]_]".freeze
HASHTAG_FIRST_SEQUENCE = "(#{HASHTAG_FIRST_SEQUENCE_CHUNK_ONE}#{HASHTAG_FIRST_SEQUENCE_CHUNK_TWO})".freeze
HASHTAG_LAST_SEQUENCE = '([[:word:]_]*[[:alpha:]][[:word:]_]*)'
HASHTAG_NAME_PAT = "#{HASHTAG_FIRST_SEQUENCE}|#{HASHTAG_LAST_SEQUENCE}"
HASHTAG_NAME_PAT = "#{HASHTAG_FIRST_SEQUENCE}|#{HASHTAG_LAST_SEQUENCE}".freeze

HASHTAG_RE = %r{(?<![=/)\p{Alnum}])#(#{HASHTAG_NAME_PAT})}
HASHTAG_NAME_RE = /\A(#{HASHTAG_NAME_PAT})\z/i
Expand Down
27 changes: 21 additions & 6 deletions app/services/activitypub/process_account_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ class ActivityPub::ProcessAccountService < BaseService
SUBDOMAINS_RATELIMIT = 10
DISCOVERIES_PER_REQUEST = 400

VALID_URI_SCHEMES = %w(http https).freeze

# Should be called with confirmed valid JSON
# and WebFinger-resolved username and domain
def call(username, domain, json, options = {})
Expand Down Expand Up @@ -96,16 +98,28 @@ def update_account
end

def set_immediate_protocol_attributes!
@account.inbox_url = @json['inbox'] || ''
@account.outbox_url = @json['outbox'] || ''
@account.shared_inbox_url = (@json['endpoints'].is_a?(Hash) ? @json['endpoints']['sharedInbox'] : @json['sharedInbox']) || ''
@account.followers_url = @json['followers'] || ''
@account.inbox_url = valid_collection_uri(@json['inbox'])
@account.outbox_url = valid_collection_uri(@json['outbox'])
@account.shared_inbox_url = valid_collection_uri(@json['endpoints'].is_a?(Hash) ? @json['endpoints']['sharedInbox'] : @json['sharedInbox'])
@account.followers_url = valid_collection_uri(@json['followers'])
@account.url = url || @uri
@account.uri = @uri
@account.actor_type = actor_type
@account.created_at = @json['published'] if @json['published'].present?
end

def valid_collection_uri(uri)
uri = uri.first if uri.is_a?(Array)
uri = uri['id'] if uri.is_a?(Hash)
return '' unless uri.is_a?(String)

parsed_uri = Addressable::URI.parse(uri)

VALID_URI_SCHEMES.include?(parsed_uri.scheme) && parsed_uri.host.present? ? parsed_uri : ''
rescue Addressable::URI::InvalidURIError
''
end

def set_immediate_attributes!
@account.featured_collection_url = @json['featured'] || ''
@account.display_name = @json['name'] || ''
Expand Down Expand Up @@ -279,10 +293,11 @@ def followers_private?
end

def collection_info(type)
return [nil, nil] if @json[type].blank?
collection_uri = valid_collection_uri(@json[type])
return [nil, nil] if collection_uri.blank?
return @collections[type] if @collections.key?(type)

collection = fetch_resource_without_id_validation(@json[type])
collection = fetch_resource_without_id_validation(collection_uri)

total_items = collection.is_a?(Hash) && collection['totalItems'].present? && collection['totalItems'].is_a?(Numeric) ? collection['totalItems'] : nil
has_first_page = collection.is_a?(Hash) && collection['first'].present?
Expand Down
2 changes: 1 addition & 1 deletion app/services/delete_account_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class DeleteAccountService < BaseService
scheduled_statuses
status_pins
tag_follows
)
).freeze

ASSOCIATIONS_ON_DESTROY = %w(
reports
Expand Down
2 changes: 2 additions & 0 deletions config/locales/activerecord.de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ de:
models:
account:
attributes:
fields:
fields_with_values_missing_labels: enthält Werte, bei denen Beschriftungen fehlen
username:
invalid: nur Buchstaben, Ziffern und Unterstriche
reserved: ist bereits vergeben
Expand Down
7 changes: 7 additions & 0 deletions config/locales/eo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -936,17 +936,22 @@ eo:
generate: Uzi ŝablonon
generates:
action: Generi
chance_to_review_html: "<strong>La generataj kondiĉoj de uzado ne aŭtomate publikiĝos.</strong> Estos oportuni por vi kontroli la rezultojn. Bonvole entajpu la necesajn detalojn por daŭrigi."
explanation_html: La modelo por la kondiĉoj de la servo disponeblas sole por informi. Ĝi nepre ne estas leĝa konsilo pri iu ajn temo. Bonvole konsultu vian propran leĝan konsilanton pri via situacio kaj iuj leĝaj neklarecoj.
title: Agordo de kondiĉoj de uzado
history: Historio
live: Antaŭmontro
no_history: Ankoraŭ ne estas registritaj ŝanĝoj de la kondiĉoj de la servo.
no_terms_of_service_html: Vi nuntempe ne havas iujn ajn kondiĉojn de la servo agordita. La kondiĉoj de la servo celas doni klarecon kaj protekti vin kontraŭ eblaj respondecoj en disputoj kun viaj uzantoj.
notified_on_html: Uzantojn sciigis je %{date}
notify_users: Informu uzantojn
preview:
explanation_html: 'La retmesaĝo estos alsendata al <strong>%{display_count} uzantoj</strong>, kiuj kreis konton antaŭ %{date}. La sekvonta teksto inkluziviĝos en la retmesaĝo:'
send_preview: Sendu antaŭrigardon al %{email}
send_to_all:
one: Sendi %{display_count} retpoŝton
other: Sendi %{display_count} retpoŝtojn
title: Antaŭmontri sciigon pri la kondiĉoj de la servo
publish: Publikigi
published_on_html: Publikigita je %{date}
save_draft: Konservi malneton
Expand Down Expand Up @@ -1930,6 +1935,8 @@ eo:
subject: Via konto estas alirita de nova IP-adreso
title: Nova saluto
terms_of_service_changed:
agreement: Se vi daŭrige uzos %{domain}, vi aŭtomate interkonsentos pri ĉi tiuj kondiĉoj. Se vi malkonsentas pri la novaj kondiĉoj, vi ĉiutempe rajtas nuligi la interkonsenton kun %{domain} per forigi vian konton.
changelog: 'Facile dirite, la ŝanĝoj estas la jenaj:'
description: 'Vi ricevas ĉi tiun retmesaĝon ĉar ni faras iujn ŝanĝojn al niaj servokondiĉoj ĉe %{domain}. Ni instigas vin revizii la ĝisdatigitajn kondiĉojn tute ĉi tie:'
description_html: Vi ricevas ĉi tiun retmesaĝon ĉar ni faras iujn ŝanĝojn al niaj servokondiĉoj ĉe %{domain}. Ni instigas vin revizii la <a href="%{path}" target="_blank">ĝisdatigitajn kondiĉojn plene ĉi tie</a>.
sign_off: La teamo de %{domain}
Expand Down
1 change: 1 addition & 0 deletions config/locales/simple_form.de.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ de:
admin_email: Rechtliche Hinweise umfassen Gegendarstellungen, Gerichtsbeschlüsse, Anfragen zum Herunternehmen von Inhalten und Anfragen von Strafverfolgungsbehörden.
arbitration_address: Kann wie die Anschrift hierüber sein oder „N/A“, falls eine E-Mail verwendet wird
arbitration_website: Kann ein Webformular sein oder „N/A“, falls eine E-Mail verwendet wird
dmca_address: US-Betreiber sollten die im „DMCA Designated Agent Directory“ eingetragene Adresse verwenden. Eine Postfachadresse ist auf direkte Anfrage verfügbar. Verwenden Sie die „DMCA Designated Agent Post Box Waiver“-Anfrage, um per E-Mail die Urheberrechtsbehörde darüber zu unterrichten, dass Sie Inhalte per Heimarbeit moderieren, eventuelle Rache oder Vergeltung für Ihre Handlungen befürchten und deshalb eine Postfachadresse benötigen, um Ihre Privatadresse nicht preiszugeben.
dmca_email: Kann dieselbe E-Mail wie bei „E-Mail-Adresse für rechtliche Hinweise“ sein
domain: Einzigartige Identifizierung des angebotenen Online-Services.
jurisdiction: Gib das Land an, in dem die Person lebt, die alle Rechnungen bezahlt. Falls es sich dabei um ein Unternehmen oder eine andere Einrichtung handelt, gib das Land mit dem Sitz an, sowie die Stadt oder Region.
Expand Down
2 changes: 2 additions & 0 deletions config/locales/sk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ sk:
admin:
account_actions:
action: Vykonaj
already_silenced: Tento účet už bol obmedzený.
title: Vykonaj moderovací úkon voči %{acct}
account_moderation_notes:
create: Zanechaj poznámku
Expand Down Expand Up @@ -204,6 +205,7 @@ sk:
enable_user: Povoľ užívateľa
memorialize_account: Zmena na „in memoriam“
promote_user: Povýš užívateľskú rolu
publish_terms_of_service: Zverejni podmienky prevozu
reject_appeal: Zamietni námietku
reject_user: Zamietni užívateľa
remove_avatar_user: Vymaž avatar
Expand Down
Loading

0 comments on commit e87cb11

Please sign in to comment.