Skip to content

Commit

Permalink
Merge pull request #14 from dftba-club/2024-06-08-2
Browse files Browse the repository at this point in the history
2024 06 08 2
  • Loading branch information
nomad-geek authored Jun 8, 2024
2 parents 438cefa + 64d8260 commit 7d1fd44
Show file tree
Hide file tree
Showing 79 changed files with 229 additions and 143 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.
14 changes: 7 additions & 7 deletions .github/workflows/crowdin-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ on:
branches:
- main
paths:
- crowdin.yml
- app/javascript/mastodon/locales/en.json
- config/locales/en.yml
- config/locales/simple_form.en.yml
- config/locales/activerecord.en.yml
- config/locales/devise.en.yml
- config/locales/doorkeeper.en.yml
- crowdin-glitch.yml
- app/javascript/flavours/glitch/locales/en.json
- config/locales-glitch/en.yml
- config/locales-glitch/simple_form.en.yml
- config/locales-glitch/activerecord.en.yml
- config/locales-glitch/devise.en.yml
- config/locales-glitch/doorkeeper.en.yml
- .github/workflows/crowdin-upload.yml

jobs:
Expand Down
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
11 changes: 11 additions & 0 deletions app/javascript/flavours/glitch/locales/fr-CA.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@
"column_subheading.lists": "Listes",
"column_subheading.navigation": "Navigation",
"community.column_settings.allow_local_only": "Afficher seulement les posts locaux",
"compose.attach.doodle": "Dessinez quelque chose",
"compose.change_federation": "Changer les paramètres de fédération",
"compose.content-type.change": "Changer les options de mise en forme avancée",
"compose.content-type.html": "HTML",
"compose.content-type.html_meta": "Formatez vos messages en HTML",
"compose.content-type.markdown": "Markdown",
"compose.content-type.markdown_meta": "Formatez vos messages en Markdown",
"compose.content-type.plain": "Text brut",
"compose.content-type.plain_meta": "Écrire sans formatage avancé",
"compose.disable_threaded_mode": "Désactiver le mode thread",
"compose.enable_threaded_mode": "Activer le mode thread",
"confirmation_modal.do_not_ask_again": "Ne plus demander confirmation",
Expand All @@ -32,6 +38,10 @@
"direct.group_by_conversations": "Grouper par conversation",
"endorsed_accounts_editor.endorsed_accounts": "Comptes mis en avant",
"favourite_modal.combo": "Vous pouvez appuyer sur {combo} pour passer ceci la prochaine fois",
"federation.federated.long": "Permettre à ce post d’atteindre d'autres serveurs",
"federation.federated.short": "Fédéré",
"federation.local_only.long": "Empêcher ce post d’atteindre d'autres serveurs",
"federation.local_only.short": "Local uniquement",
"firehose.column_settings.allow_local_only": "Afficher les messages locaux dans \"Tous\"",
"home.column_settings.advanced": "Avancé",
"home.column_settings.filter_regex": "Filtrer par expression régulière",
Expand Down Expand Up @@ -114,6 +124,7 @@
"settings.shared_settings_link": "préférences de l'utilisateur",
"settings.show_action_bar": "Afficher les boutons d'action dans les posts repliés",
"settings.show_content_type_choice": "Afficher le choix du type de contenu lors de la création des posts",
"settings.show_published_toast": "Afficher une notification quand un post est envoyé/sauvegardé",
"settings.show_reply_counter": "Afficher une estimation du nombre de réponses",
"settings.side_arm": "Bouton secondaire de publication :",
"settings.side_arm.none": "Aucun",
Expand Down
17 changes: 14 additions & 3 deletions app/javascript/flavours/glitch/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,15 @@
"column_subheading.lists": "Listes",
"column_subheading.navigation": "Navigation",
"community.column_settings.allow_local_only": "Afficher seulement les posts locaux",
"compose.attach.doodle": "Dessinez quelque chose",
"compose.change_federation": "Changer les paramètres de fédération",
"compose.content-type.change": "Changer les options de mise en forme avancée",
"compose.content-type.html": "HTML",
"compose.content-type.html_meta": "Formatez vos messages en HTML",
"compose.content-type.markdown": "Markdown",
"compose.content-type.markdown_meta": "Formatez vos messages en Markdown",
"compose.content-type.plain": "Text brut",
"compose.content-type.plain_meta": "Écrire sans formatage avancé",
"compose.disable_threaded_mode": "Désactiver le mode thread",
"compose.enable_threaded_mode": "Activer le mode thread",
"confirmation_modal.do_not_ask_again": "Ne plus demander confirmation",
Expand All @@ -32,6 +38,10 @@
"direct.group_by_conversations": "Grouper par conversation",
"endorsed_accounts_editor.endorsed_accounts": "Comptes mis en avant",
"favourite_modal.combo": "Vous pouvez appuyer sur {combo} pour passer ceci la prochaine fois",
"federation.federated.long": "Permettre à ce post d’atteindre d'autres serveurs",
"federation.federated.short": "Fédéré",
"federation.local_only.long": "Empêcher ce post d’atteindre d'autres serveurs",
"federation.local_only.short": "Local uniquement",
"firehose.column_settings.allow_local_only": "Afficher les messages locaux dans \"Tous\"",
"home.column_settings.advanced": "Avancé",
"home.column_settings.filter_regex": "Filtrer par expression régulière",
Expand Down Expand Up @@ -65,9 +75,9 @@
"settings.close": "Fermer",
"settings.collapsed_statuses": "Posts repliés",
"settings.compose_box_opts": "Zone de rédaction",
"settings.confirm_before_clearing_draft": "Afficher une fenêtre de confirmation avant d'écraser le message en cours de rédaction",
"settings.confirm_boost_missing_media_description": "Afficher une fenêtre de confirmation avant de partager des posts manquant de description des médias",
"settings.confirm_missing_media_description": "Afficher une fenêtre de confirmation avant de publier des posts manquant de description de média",
"settings.confirm_before_clearing_draft": "Demander confirmation avant d’effacer le message en cours de rédaction",
"settings.confirm_boost_missing_media_description": "Demander confirmation avant de partager des posts sans description des médias",
"settings.confirm_missing_media_description": "Demander confirmation avant de publier des posts sans description des médias",
"settings.content_warnings": "Content warnings",
"settings.content_warnings.regexp": "Expression rationnelle",
"settings.content_warnings_filter": "Avertissement de contenu à ne pas automatiquement déplier :",
Expand Down Expand Up @@ -114,6 +124,7 @@
"settings.shared_settings_link": "préférences de l'utilisateur",
"settings.show_action_bar": "Afficher les boutons d'action dans les posts repliés",
"settings.show_content_type_choice": "Afficher le choix du type de contenu lors de la création des posts",
"settings.show_published_toast": "Afficher une notification quand un post est envoyé/sauvegardé",
"settings.show_reply_counter": "Afficher une estimation du nombre de réponses",
"settings.side_arm": "Bouton secondaire de publication :",
"settings.side_arm.none": "Aucun",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,13 +513,6 @@ html {
}
}

.status.collapsed .status__content::after {
background: linear-gradient(
rgba(darken($ui-base-color, 13%), 0),
rgba(darken($ui-base-color, 13%), 1)
);
}

.drawer__inner__mastodon {
background: $white
url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 234.80078 31.757813" width="234.80078" height="31.757812"><path d="M19.599609 0c-1.05 0-2.10039.375-2.90039 1.125L0 16.925781v14.832031h234.80078V17.025391l-16.5-15.900391c-1.6-1.5-4.20078-1.5-5.80078 0l-13.80078 13.099609c-1.6 1.5-4.19883 1.5-5.79883 0L179.09961 1.125c-1.6-1.5-4.19883-1.5-5.79883 0L159.5 14.224609c-1.6 1.5-4.20078 1.5-5.80078 0L139.90039 1.125c-1.6-1.5-4.20078-1.5-5.80078 0l-13.79883 13.099609c-1.6 1.5-4.20078 1.5-5.80078 0L100.69922 1.125c-1.600001-1.5-4.198829-1.5-5.798829 0l-13.59961 13.099609c-1.6 1.5-4.200781 1.5-5.800781 0L61.699219 1.125c-1.6-1.5-4.198828-1.5-5.798828 0L42.099609 14.224609c-1.6 1.5-4.198828 1.5-5.798828 0L22.5 1.125C21.7.375 20.649609 0 19.599609 0z" fill="#{hex-color($ui-base-color)}"/></svg>')
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
Loading

0 comments on commit 7d1fd44

Please sign in to comment.