Skip to content

Commit

Permalink
Merge commit '496c10542bd39ca86a85d4de81778c134ea4383c' into glitch-s…
Browse files Browse the repository at this point in the history
…oc/merge-upstream
  • Loading branch information
ClearlyClaire committed Jun 7, 2024
2 parents b2e7af8 + 496c105 commit 7277d2f
Show file tree
Hide file tree
Showing 73 changed files with 195 additions and 124 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FROM mcr.microsoft.com/devcontainers/ruby:1-3.3-bookworm
# RUN gem install rails webdrivers

ARG NODE_VERSION="20"
RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"
RUN . /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1

# [Optional] Uncomment this section to install additional OS packages.
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
Expand All @@ -15,6 +15,6 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
RUN gem install foreman

# [Optional] Uncomment this line to install global node packages.
RUN su vscode -c "source /usr/local/share/nvm/nvm.sh && corepack enable" 2>&1
RUN . /usr/local/share/nvm/nvm.sh && corepack enable 2>&1

COPY welcome-message.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt
2 changes: 2 additions & 0 deletions .devcontainer/codespaces/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
}
},

"remoteUser": "root",

"otherPortsAttributes": {
"onAutoForward": "silent"
},
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ services:
context: .
dockerfile: Dockerfile
volumes:
- ../..:/workspaces:cached
- ..:/workspaces/mastodon:cached
environment:
RAILS_ENV: development
NODE_ENV: development
Expand Down
9 changes: 4 additions & 5 deletions .devcontainer/welcome-message.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
👋 Welcome to "Mastodon" in GitHub Codespaces!
👋 Welcome to your Mastodon Dev Container!

🛠️ Your environment is fully setup with all the required software.
🛠️ Your environment is fully setup with all the required software.

🔍 To explore VS Code to its fullest, search using the Command Palette (Cmd/Ctrl + Shift + P or F1).

📝 Edit away, run your app as usual, and we'll automatically make it available for you to access.
💥 Run `bin/dev` to start the application processes.

🥼 Run `RAILS_ENV=test bin/rails assets:precompile && RAILS_ENV=test bin/rspec` to run the test suite.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ 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-exporter-otlp', '~> 0.27.0', require: false
gem 'opentelemetry-instrumentation-active_job', '~> 0.7.1', require: false
gem 'opentelemetry-instrumentation-active_model_serializers', '~> 0.20.1', require: false
gem 'opentelemetry-instrumentation-concurrent_ruby', '~> 0.21.2', require: false
Expand Down
18 changes: 9 additions & 9 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,17 @@ GEM
attr_required (1.0.2)
awrence (1.2.1)
aws-eventstream (1.3.0)
aws-partitions (1.929.0)
aws-sdk-core (3.196.1)
aws-partitions (1.940.0)
aws-sdk-core (3.197.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.81.0)
aws-sdk-core (~> 3, >= 3.193.0)
aws-sdk-kms (1.83.0)
aws-sdk-core (~> 3, >= 3.197.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.151.0)
aws-sdk-core (~> 3, >= 3.194.0)
aws-sdk-s3 (1.152.0)
aws-sdk-core (~> 3, >= 3.197.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.8)
aws-sigv4 (1.8.0)
Expand Down Expand Up @@ -489,7 +489,7 @@ GEM
opentelemetry-api (1.2.5)
opentelemetry-common (0.20.1)
opentelemetry-api (~> 1.0)
opentelemetry-exporter-otlp (0.26.3)
opentelemetry-exporter-otlp (0.27.0)
google-protobuf (~> 3.14)
googleapis-common-protos-types (~> 1.3)
opentelemetry-api (~> 1.1)
Expand Down Expand Up @@ -751,7 +751,7 @@ GEM
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
rubocop-ast (>= 1.31.1, < 2.0)
rubocop-rspec (2.30.0)
rubocop-rspec (2.31.0)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
Expand Down Expand Up @@ -978,7 +978,7 @@ DEPENDENCIES
omniauth-saml (~> 2.0)
omniauth_openid_connect (~> 0.6.1)
opentelemetry-api (~> 1.2.5)
opentelemetry-exporter-otlp (~> 0.26.3)
opentelemetry-exporter-otlp (~> 0.27.0)
opentelemetry-instrumentation-active_job (~> 0.7.1)
opentelemetry-instrumentation-active_model_serializers (~> 0.20.1)
opentelemetry-instrumentation-concurrent_ruby (~> 0.21.2)
Expand Down
4 changes: 4 additions & 0 deletions app/javascript/mastodon/locales/la.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"compose_form.direct_message_warning_learn_more": "Discere plura",
"compose_form.encryption_warning": "Posts on Mastodon are not end-to-end encrypted. Do not share any dangerous information over Mastodon.",
"compose_form.hashtag_warning": "This post won't be listed under any hashtag as it is unlisted. Only public posts can be searched by hashtag.",
"compose_form.lock_disclaimer": "Tua ratio non est {clausa}. Quisquis te sequi potest ut visum accipiat nuntios tuos tantum pro sectatoribus.",
"compose_form.lock_disclaimer.lock": "clausum",
"compose_form.placeholder": "What is on your mind?",
"compose_form.publish_form": "Barrire",
Expand Down Expand Up @@ -91,6 +92,7 @@
"lightbox.next": "Secundum",
"navigation_bar.domain_blocks": "Hidden domains",
"not_signed_in_indicator.not_signed_in": "You need to sign in to access this resource.",
"notification.moderation_warning.action_none": "Tua ratiō monitum moderātiōnis accēpit.",
"notification.reblog": "{name} boosted your status",
"notifications.filter.all": "Omnia",
"notifications.filter.polls": "Eventus electionis",
Expand All @@ -107,6 +109,8 @@
"onboarding.steps.setup_profile.title": "Customize your profile",
"onboarding.steps.share_profile.body": "Let your friends know how to find you on Mastodon!",
"onboarding.steps.share_profile.title": "Share your profile",
"onboarding.tips.accounts_from_other_servers": "<strong>Scisne?</strong> Quoniam Mastodon dēcentālis est, nōnnulla profīlia quae invenīs in servīs aliīs quam tuōrum erunt hospitāta. Tamen cum eīs sine impedīmentō interāgere potes! Servus eōrum in alterā parte nōminis eōrum est!",
"onboarding.tips.migration": "<strong>Scisne?</strong> Sī sentīs {domain} tibi in futūrō nōn esse optimam servī ēlēctiōnem, ad alium servum Mastodon sine amittendō sectātōribus tuīs migrāre potes. Etiam tuum servum hospitārī potes!",
"poll.closed": "Clausum",
"poll.vote": "Eligere",
"poll.voted": "Elegisti hoc responsum",
Expand Down
10 changes: 8 additions & 2 deletions app/lib/video_metadata_extractor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def parse_metadata
@colorspace = video_stream[:pix_fmt]
@width = video_stream[:width]
@height = video_stream[:height]
@frame_rate = video_stream[:avg_frame_rate] == '0/0' ? nil : Rational(video_stream[:avg_frame_rate])
@r_frame_rate = video_stream[:r_frame_rate] == '0/0' ? nil : Rational(video_stream[:r_frame_rate])
@frame_rate = parse_framerate(video_stream[:avg_frame_rate])
@r_frame_rate = parse_framerate(video_stream[:r_frame_rate])
# For some video streams the frame_rate reported by `ffprobe` will be 0/0, but for these streams we
# should use `r_frame_rate` instead. Video screencast generated by Gnome Screencast have this issue.
@frame_rate ||= @r_frame_rate
Expand All @@ -55,4 +55,10 @@ def parse_metadata

@invalid = true if @metadata.key?(:error)
end

def parse_framerate(raw)
Rational(raw)
rescue ZeroDivisionError
nil
end
end
2 changes: 1 addition & 1 deletion app/models/custom_emoji.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class CustomEmoji < ApplicationRecord

has_one :local_counterpart, -> { where(domain: nil) }, class_name: 'CustomEmoji', primary_key: :shortcode, foreign_key: :shortcode, inverse_of: false, dependent: nil

has_attached_file :image, styles: { static: { format: 'png', convert_options: '-coalesce +profile "!icc,*" +set date:modify +set date:create +set date:timestamp' } }, validate_media_type: false
has_attached_file :image, styles: { static: { format: 'png', convert_options: '-coalesce +profile "!icc,*" +set date:modify +set date:create +set date:timestamp', file_geometry_parser: FastGeometryParser } }, validate_media_type: false, processors: [:lazy_thumbnail]

normalizes :domain, with: ->(domain) { domain.downcase }

Expand Down
4 changes: 2 additions & 2 deletions app/models/mention.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
# Table name: mentions
#
# id :bigint(8) not null, primary key
# status_id :bigint(8)
# status_id :bigint(8) not null
# created_at :datetime not null
# updated_at :datetime not null
# account_id :bigint(8)
# account_id :bigint(8) not null
# silent :boolean default(FALSE), not null
#

Expand Down
5 changes: 5 additions & 0 deletions app/serializers/rest/notification_group_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class REST::NotificationGroupSerializer < ActiveModel::Serializer
belongs_to :target_status, key: :status, if: :status_type?, serializer: REST::StatusSerializer
belongs_to :report, if: :report_type?, serializer: REST::ReportSerializer
belongs_to :account_relationship_severance_event, key: :event, if: :relationship_severance_event?, serializer: REST::AccountRelationshipSeveranceEventSerializer
belongs_to :account_warning, key: :moderation_warning, if: :moderation_warning_event?, serializer: REST::AccountWarningSerializer

def status_type?
[:favourite, :reblog, :status, :mention, :poll, :update].include?(object.type)
Expand All @@ -24,6 +25,10 @@ def relationship_severance_event?
object.type == :severed_relationships
end

def moderation_warning_event?
object.type == :moderation_warning
end

def page_min_id
range = instance_options[:group_metadata][object.group_key]
range.present? ? range[:min_id].to_s : object.notification.id.to_s
Expand Down
14 changes: 5 additions & 9 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,21 @@ require "fileutils"
APP_ROOT = File.expand_path('..', __dir__)

def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
system(*args, exception: true)
end

FileUtils.chdir APP_ROOT do
# This script is a way to set up or update your development environment automatically.
# This script is idempotent, so that you can run it at any time and get an expectable outcome.
# Add necessary setup steps to this file.

puts '== Installing dependencies =='
puts "\n== Installing Ruby dependencies =="
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')

# Install JavaScript dependencies
system! 'bin/yarn'

# puts "\n== Copying sample files =="
# unless File.exist?('config/database.yml')
# FileUtils.cp 'config/database.yml.sample', 'config/database.yml'
# end
puts "\n== Installing JS dependencies =="
system! 'corepack prepare'
system! 'bin/yarn install --immutable'

puts "\n== Preparing database =="
system! 'bin/rails db:prepare'
Expand Down
2 changes: 1 addition & 1 deletion config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# In the development environment your application's code is reloaded any time
# it changes. This slows down response time but is perfect for development
# since you don't have to restart the web server when you make code changes.
config.cache_classes = false
config.enable_reloading = true

# Do not eager load code on boot.
config.eager_load = false
Expand Down
6 changes: 0 additions & 6 deletions config/environments/test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,6 @@
config.i18n.default_locale = :en
config.i18n.fallbacks = true

config.to_prepare do
# Force Status to always be SHAPE_TOO_COMPLEX
# Ref: https://github.com/mastodon/mastodon/issues/23644
10.times { |i| Status.allocate.instance_variable_set(:"@ivar_#{i}", nil) }
end

# Tell Active Support which deprecation messages to disallow.
config.active_support.disallowed_deprecation_warnings = []

Expand Down
10 changes: 7 additions & 3 deletions config/initializers/paperclip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Paperclip::DataUriAdapter.register
Paperclip::ResponseWithLimitAdapter.register

PATH = ':prefix_url:class/:attachment/:id_partition/:style/:filename'

Paperclip.interpolates :filename do |attachment, style|
if style == :original
attachment.original_filename
Expand All @@ -29,7 +31,7 @@

Paperclip::Attachment.default_options.merge!(
use_timestamp: false,
path: ':prefix_url:class/:attachment/:id_partition/:style/:filename',
path: PATH,
storage: :fog
)

Expand All @@ -40,6 +42,8 @@
s3_protocol = ENV.fetch('S3_PROTOCOL') { 'https' }
s3_hostname = ENV.fetch('S3_HOSTNAME') { "s3-#{s3_region}.amazonaws.com" }

Paperclip::Attachment.default_options[:path] = ENV.fetch('S3_KEY_PREFIX') + "/#{PATH}" if ENV.has_key?('S3_KEY_PREFIX')

Paperclip::Attachment.default_options.merge!(
storage: :s3,
s3_protocol: s3_protocol,
Expand All @@ -64,7 +68,7 @@
http_open_timeout: ENV.fetch('S3_OPEN_TIMEOUT') { '5' }.to_i,
http_read_timeout: ENV.fetch('S3_READ_TIMEOUT') { '5' }.to_i,
http_idle_timeout: 5,
retry_limit: 0,
retry_limit: ENV.fetch('S3_RETRY_LIMIT') { '0' }.to_i,
}
)

Expand Down Expand Up @@ -159,7 +163,7 @@ def copy_to_local_file(style, local_dest_path)
Paperclip::Attachment.default_options.merge!(
storage: :filesystem,
path: File.join(ENV.fetch('PAPERCLIP_ROOT_PATH', File.join(':rails_root', 'public', 'system')), ':prefix_path:class', ':attachment', ':id_partition', ':style', ':filename'),
url: "#{ENV.fetch('PAPERCLIP_ROOT_URL', '/system')}/:prefix_url:class/:attachment/:id_partition/:style/:filename"
url: ENV.fetch('PAPERCLIP_ROOT_URL', '/system') + "/#{PATH}"
)
end

Expand Down
1 change: 0 additions & 1 deletion config/locales/doorkeeper.be.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ be:
read:filters: бачыць свае фільтры
read:follows: бачыць свае падпіскі
read:lists: бачыць свае спісы
read:me: чытайце толькі базавую інфармацыю аб сваім уліковым запісе
read:mutes: бачыць свае ігнараванні
read:notifications: бачыць свае абвесткі
read:reports: бачыць свае скаргі
Expand Down
3 changes: 2 additions & 1 deletion config/locales/doorkeeper.bg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ bg:
media: Прикачена мултимедия
mutes: Заглушения
notifications: Известия
profile: Вашият профил в Mastodon
push: Изскачащи известия
reports: Доклади
search: Търсене
Expand Down Expand Up @@ -165,6 +166,7 @@ bg:
admin:write:reports: извършване на действия за модериране на докладвания
crypto: употреба на цялостно шифроване
follow: промяна на взаимоотношенията на акаунта
profile: само за четене на сведенията ви за профила на акаунта
push: получаване на вашите изскачащи известия
read: четене на всички данни от акаунта ви
read:accounts: преглед на информация за акаунти
Expand All @@ -174,7 +176,6 @@ bg:
read:filters: преглед на вашите филтри
read:follows: преглед на вашите последвания
read:lists: преглед на вашите списъци
read:me: четене само на основните сведения за акаунта ви
read:mutes: преглед на вашите заглушавания
read:notifications: преглед на вашите известия
read:reports: преглед на вашите докладвания
Expand Down
1 change: 1 addition & 0 deletions config/locales/doorkeeper.br.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ br:
lists: Listennoù
media: Restroù media stag
mutes: Kuzhet
profile: Ho profil Mastodon
search: Klask
statuses: Toudoù
layouts:
Expand Down
3 changes: 2 additions & 1 deletion config/locales/doorkeeper.ca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ ca:
media: Adjunts multimèdia
mutes: Silenciats
notifications: Notificacions
profile: El vostre perfil de Mastodon
push: Notificacions push
reports: Informes
search: Cerca
Expand Down Expand Up @@ -165,6 +166,7 @@ ca:
admin:write:reports: fer l'acció de moderació en els informes
crypto: usa xifrat d'extrem a extrem
follow: modifica les relacions del compte
profile: només llegir la informació del perfil del vostre compte
push: rebre notificacions push del teu compte
read: llegir les dades del teu compte
read:accounts: mira informació dels comptes
Expand All @@ -174,7 +176,6 @@ ca:
read:filters: mira els teus filtres
read:follows: mira els teus seguiments
read:lists: mira les teves llistes
read:me: llegir només la informació bàsica del vostre compte
read:mutes: mira els teus silenciats
read:notifications: mira les teves notificacions
read:reports: mira els teus informes
Expand Down
1 change: 0 additions & 1 deletion config/locales/doorkeeper.cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ cs:
read:filters: vidět vaše filtry
read:follows: vidět vaše sledování
read:lists: vidět vaše seznamy
read:me: číst pouze základní informace vašeho účtu
read:mutes: vidět vaše skrytí
read:notifications: vidět vaše oznámení
read:reports: vidět vaše hlášení
Expand Down
1 change: 0 additions & 1 deletion config/locales/doorkeeper.cy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ cy:
read:filters: gweld eich hidlwyr
read:follows: gweld eich dilynwyr
read:lists: gweld eich rhestrau
read:me: darllen dim ond manylion elfennol eich cyfrif
read:mutes: gweld eich anwybyddiadau
read:notifications: gweld eich hysbysiadau
read:reports: gweld eich adroddiadau
Expand Down
3 changes: 2 additions & 1 deletion config/locales/doorkeeper.da.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ da:
media: Medievedhæftninger
mutes: Tavsgørelser
notifications: Notifikationer
profile: Din Mastodon-profil
push: Push-notifikationer
reports: Anmeldelser
search: Søgning
Expand Down Expand Up @@ -165,6 +166,7 @@ da:
admin:write:reports: udfør modereringshandlinger på anmeldelser
crypto: benyt ende-til-ende kryptering
follow: ændre kontorelationer
profile: læs kun kontoprofiloplysningerne
push: modtag dine push-notifikationer
read: læs alle dine kontodata
read:accounts: se kontooplysninger
Expand All @@ -174,7 +176,6 @@ da:
read:filters: se dine filtre
read:follows: se dine følger
read:lists: se dine lister
read:me: læs kun kontoens basisoplysninger
read:mutes: se dine tavsgørelser
read:notifications: se dine notifikationer
read:reports: se dine anmeldelser
Expand Down
Loading

0 comments on commit 7277d2f

Please sign in to comment.