Skip to content

Commit b28ce24

Browse files
committed
Merge commit 'c40ab43dc703be988c277d4ba6b7987a3a80e16c' into glitch-soc/merge-upstream
Conflicts: - `app/helpers/application_helper.rb`: Upstream added a helper where glitch-soc had its own, not really a conflict. Added upstream's helper. - `lib/sanitize_ext/sanitize_config.rb`: Upstream renamed a constant that was used slightly differently in glitch-soc. Renamed it as upstream did.
2 parents 88756ab + c40ab43 commit b28ce24

File tree

228 files changed

+2732
-1823
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

228 files changed

+2732
-1823
lines changed

.eslintrc.js

-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ module.exports = defineConfig({
6464
'indent': ['error', 2],
6565
'jsx-quotes': ['error', 'prefer-single'],
6666
'semi': ['error', 'always'],
67-
'no-case-declarations': 'off',
6867
'no-catch-shadow': 'error',
6968
'no-console': [
7069
'warn',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Crowdin / Download translations (stable branches)
2+
on:
3+
workflow_dispatch:
4+
5+
permissions:
6+
contents: write
7+
pull-requests: write
8+
9+
jobs:
10+
download-translations-stable:
11+
runs-on: ubuntu-latest
12+
if: github.repository == 'mastodon/mastodon'
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Increase Git http.postBuffer
19+
# This is needed due to a bug in Ubuntu's cURL version?
20+
# See https://github.com/orgs/community/discussions/55820
21+
run: |
22+
git config --global http.version HTTP/1.1
23+
git config --global http.postBuffer 157286400
24+
25+
# Download the translation files from Crowdin
26+
- name: crowdin action
27+
uses: crowdin/github-action@v2
28+
with:
29+
upload_sources: false
30+
upload_translations: false
31+
download_translations: true
32+
crowdin_branch_name: ${{ github.base_ref || github.ref_name }}
33+
push_translations: false
34+
create_pull_request: false
35+
env:
36+
CROWDIN_PROJECT_ID: ${{ vars.CROWDIN_PROJECT_ID }}
37+
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
38+
39+
# As the files are extracted from a Docker container, they belong to root:root
40+
# We need to fix this before the next steps
41+
- name: Fix file permissions
42+
run: sudo chown -R runner:docker .
43+
44+
# This is needed to run the normalize step
45+
- name: Set up Ruby environment
46+
uses: ./.github/actions/setup-ruby
47+
48+
- name: Run i18n normalize task
49+
run: bundle exec i18n-tasks normalize
50+
51+
# Create or update the pull request
52+
- name: Create Pull Request
53+
uses: peter-evans/[email protected]
54+
with:
55+
commit-message: 'New Crowdin translations'
56+
title: 'New Crowdin Translations for ${{ github.base_ref || github.ref_name }} (automated)'
57+
author: 'GitHub Actions <[email protected]>'
58+
body: |
59+
New Crowdin translations, automated with GitHub Actions
60+
61+
See `.github/workflows/crowdin-download.yml`
62+
63+
This PR will be updated every day with new translations.
64+
65+
Due to a limitation in GitHub Actions, checks are not running on this PR without manual action.
66+
If you want to run the checks, then close and re-open it.
67+
branch: i18n/crowdin/translations-${{ github.base_ref || github.ref_name }}
68+
base: ${{ github.base_ref || github.ref_name }}
69+
labels: i18n

.github/workflows/crowdin-download.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353

5454
# Create or update the pull request
5555
- name: Create Pull Request
56-
uses: peter-evans/[email protected].1
56+
uses: peter-evans/[email protected].5
5757
with:
5858
commit-message: 'New Crowdin translations'
5959
title: 'New Crowdin Translations (automated)'

.github/workflows/crowdin-upload.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
upload_sources: true
3333
upload_translations: false
3434
download_translations: false
35-
crowdin_branch_name: main
35+
crowdin_branch_name: ${{ github.base_ref || github.ref_name }}
3636

3737
env:
3838
CROWDIN_PROJECT_ID: ${{ vars.CROWDIN_PROJECT_ID }}

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20.17
1+
20.18

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# syntax=docker/dockerfile:1.9
1+
# syntax=docker/dockerfile:1.10
22

33
# This file is designed for production server deployment, not local development work
44
# For a containerized local dev environment, see: https://github.com/mastodon/mastodon/blob/main/README.md#docker
@@ -214,7 +214,7 @@ FROM build AS ffmpeg
214214

215215
# ffmpeg version to compile, change with [--build-arg FFMPEG_VERSION="7.0.x"]
216216
# renovate: datasource=repology depName=ffmpeg packageName=openpkg_current/ffmpeg
217-
ARG FFMPEG_VERSION=7.0.2
217+
ARG FFMPEG_VERSION=7.1
218218
# ffmpeg download URL, change with [--build-arg FFMPEG_URL="https://ffmpeg.org/releases"]
219219
ARG FFMPEG_URL=https://ffmpeg.org/releases
220220

Gemfile.lock

+14-14
Original file line numberDiff line numberDiff line change
@@ -100,16 +100,16 @@ GEM
100100
attr_required (1.0.2)
101101
awrence (1.2.1)
102102
aws-eventstream (1.3.0)
103-
aws-partitions (1.978.0)
104-
aws-sdk-core (3.209.0)
103+
aws-partitions (1.983.0)
104+
aws-sdk-core (3.209.1)
105105
aws-eventstream (~> 1, >= 1.3.0)
106106
aws-partitions (~> 1, >= 1.651.0)
107107
aws-sigv4 (~> 1.9)
108108
jmespath (~> 1, >= 1.6.1)
109109
aws-sdk-kms (1.94.0)
110110
aws-sdk-core (~> 3, >= 3.207.0)
111111
aws-sigv4 (~> 1.5)
112-
aws-sdk-s3 (1.166.0)
112+
aws-sdk-s3 (1.167.0)
113113
aws-sdk-core (~> 3, >= 3.207.0)
114114
aws-sdk-kms (~> 1)
115115
aws-sigv4 (~> 1.5)
@@ -301,7 +301,7 @@ GEM
301301
activesupport (>= 5.1)
302302
haml (>= 4.0.6)
303303
railties (>= 5.1)
304-
haml_lint (0.58.0)
304+
haml_lint (0.59.0)
305305
haml (>= 5.0)
306306
parallel (~> 1.10)
307307
rainbow
@@ -369,7 +369,7 @@ GEM
369369
json-ld-preloaded (3.3.0)
370370
json-ld (~> 3.3)
371371
rdf (~> 3.3)
372-
json-schema (5.0.0)
372+
json-schema (5.0.1)
373373
addressable (~> 2.8)
374374
jsonapi-renderer (0.2.2)
375375
jwt (2.7.1)
@@ -601,7 +601,7 @@ GEM
601601
actionmailer (>= 3)
602602
net-smtp
603603
premailer (~> 1.7, >= 1.7.9)
604-
propshaft (1.0.1)
604+
propshaft (1.1.0)
605605
actionpack (>= 7.0.0)
606606
activesupport (>= 7.0.0)
607607
rack
@@ -698,7 +698,7 @@ GEM
698698
responders (3.1.1)
699699
actionpack (>= 5.2)
700700
railties (>= 5.2)
701-
rexml (3.3.7)
701+
rexml (3.3.8)
702702
rotp (6.3.0)
703703
rouge (4.3.0)
704704
rpam2 (4.0.2)
@@ -748,15 +748,15 @@ GEM
748748
parser (>= 3.3.1.0)
749749
rubocop-capybara (2.21.0)
750750
rubocop (~> 1.41)
751-
rubocop-performance (1.21.1)
751+
rubocop-performance (1.22.1)
752752
rubocop (>= 1.48.1, < 2.0)
753753
rubocop-ast (>= 1.31.1, < 2.0)
754-
rubocop-rails (2.25.1)
754+
rubocop-rails (2.26.2)
755755
activesupport (>= 4.2.0)
756756
rack (>= 1.1)
757-
rubocop (>= 1.33.0, < 2.0)
757+
rubocop (>= 1.52.0, < 2.0)
758758
rubocop-ast (>= 1.31.1, < 2.0)
759-
rubocop-rspec (3.0.4)
759+
rubocop-rspec (3.1.0)
760760
rubocop (~> 1.61)
761761
rubocop-rspec_rails (2.30.0)
762762
rubocop (~> 1.61)
@@ -815,7 +815,7 @@ GEM
815815
docile (~> 1.1)
816816
simplecov-html (~> 0.11)
817817
simplecov_json_formatter (~> 0.1)
818-
simplecov-html (0.12.3)
818+
simplecov-html (0.13.1)
819819
simplecov-lcov (0.8.0)
820820
simplecov_json_formatter (0.1.4)
821821
stackprof (0.2.26)
@@ -862,7 +862,7 @@ GEM
862862
unf (0.1.4)
863863
unf_ext
864864
unf_ext (0.0.9.1)
865-
unicode-display_width (2.5.0)
865+
unicode-display_width (2.6.0)
866866
uri (0.13.1)
867867
validate_email (0.1.6)
868868
activemodel (>= 3.0)
@@ -884,7 +884,7 @@ GEM
884884
webfinger (1.2.0)
885885
activesupport
886886
httpclient (>= 2.4)
887-
webmock (3.23.1)
887+
webmock (3.24.0)
888888
addressable (>= 2.8.0)
889889
crack (>= 0.3.2)
890890
hashdiff (>= 0.4.0, < 2.0.0)

app/controllers/admin/announcements_controller.rb

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class Admin::AnnouncementsController < Admin::BaseController
66

77
def index
88
authorize :announcement, :index?
9+
@published_announcements_count = Announcement.published.async_count
910
end
1011

1112
def new

app/controllers/admin/disputes/appeals_controller.rb

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class Admin::Disputes::AppealsController < Admin::BaseController
66
def index
77
authorize :appeal, :index?
88

9+
@pending_appeals_count = Appeal.pending.async_count
910
@appeals = filtered_appeals.page(params[:page])
1011
end
1112

app/controllers/admin/trends/links/preview_card_providers_controller.rb

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ class Admin::Trends::Links::PreviewCardProvidersController < Admin::BaseControll
44
def index
55
authorize :preview_card_provider, :review?
66

7+
@pending_preview_card_providers_count = PreviewCardProvider.unreviewed.async_count
78
@preview_card_providers = filtered_preview_card_providers.page(params[:page])
89
@form = Trends::PreviewCardProviderBatch.new
910
end

app/controllers/admin/trends/tags_controller.rb

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ class Admin::Trends::TagsController < Admin::BaseController
44
def index
55
authorize :tag, :review?
66

7+
@pending_tags_count = Tag.pending_review.async_count
78
@tags = filtered_tags.page(params[:page])
89
@form = Trends::TagBatch.new
910
end

app/controllers/concerns/web_app_controller_concern.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ module WebAppControllerConcern
1313
policy = ContentSecurityPolicy.new
1414

1515
if policy.sso_host.present?
16-
p.form_action policy.sso_host
16+
p.form_action policy.sso_host, -> { "https://#{request.host}/auth/auth/" }
1717
else
1818
p.form_action :none
1919
end

app/controllers/settings/exports_controller.rb

+12-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ class Settings::ExportsController < Settings::BaseController
99
skip_before_action :require_functional!
1010

1111
def show
12-
@export = Export.new(current_account)
12+
@export_summary = ExportSummary.new(preloaded_account)
1313
@backups = current_user.backups
1414
end
1515

@@ -25,4 +25,15 @@ def create
2525

2626
redirect_to settings_export_path
2727
end
28+
29+
private
30+
31+
def preloaded_account
32+
current_account.tap do |account|
33+
ActiveRecord::Associations::Preloader.new(
34+
records: [account],
35+
associations: :account_stat
36+
).call
37+
end
38+
end
2839
end

app/controllers/settings/two_factor_authentication/otp_authentication_controller.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def show
1515
end
1616

1717
def create
18-
session[:new_otp_secret] = User.generate_otp_secret(32)
18+
session[:new_otp_secret] = User.generate_otp_secret
1919

2020
redirect_to new_settings_two_factor_authentication_confirmation_path
2121
end

app/controllers/well_known/host_meta_controller.rb

+17-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,23 @@ class HostMetaController < ActionController::Base # rubocop:disable Rails/Applic
77
def show
88
@webfinger_template = "#{webfinger_url}?resource={uri}"
99
expires_in 3.days, public: true
10-
render content_type: 'application/xrd+xml', formats: [:xml]
10+
11+
respond_to do |format|
12+
format.any do
13+
render content_type: 'application/xrd+xml', formats: [:xml]
14+
end
15+
16+
format.json do
17+
render json: {
18+
links: [
19+
{
20+
rel: 'lrdd',
21+
template: @webfinger_template,
22+
},
23+
],
24+
}
25+
end
26+
end
1127
end
1228
end
1329
end

app/helpers/admin/action_logs_helper.rb

+7
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,11 @@ def log_target(log)
3535
end
3636
end
3737
end
38+
39+
def sorted_action_log_types
40+
Admin::ActionLogFilter::ACTION_TYPE_MAP
41+
.keys
42+
.map { |key| [I18n.t("admin.action_logs.action_types.#{key}"), key] }
43+
.sort_by(&:first)
44+
end
3845
end

app/helpers/admin/dashboard_helper.rb

+7
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,20 @@ def relevant_account_ip(account, ip_query)
1818
end
1919
end
2020

21+
def date_range(range)
22+
[l(range.first), l(range.last)]
23+
.join(' - ')
24+
end
25+
2126
def relevant_account_timestamp(account)
2227
timestamp, exact = if account.user_current_sign_in_at && account.user_current_sign_in_at < 24.hours.ago
2328
[account.user_current_sign_in_at, true]
2429
elsif account.user_current_sign_in_at
2530
[account.user_current_sign_in_at, false]
2631
elsif account.user_pending?
2732
[account.user_created_at, true]
33+
elsif account.suspended_at.present? && account.local? && account.user.nil?
34+
[account.suspended_at, true]
2835
elsif account.last_status_at.present?
2936
[account.last_status_at, true]
3037
else

app/helpers/application_helper.rb

+9-8
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
# frozen_string_literal: true
22

33
module ApplicationHelper
4-
DANGEROUS_SCOPES = %w(
5-
read
6-
write
7-
follow
8-
).freeze
9-
104
RTL_LOCALES = %i(
115
ar
126
ckb
@@ -95,8 +89,11 @@ def title
9589
Rails.env.production? ? site_title : "#{site_title} (Dev)"
9690
end
9791

98-
def class_for_scope(scope)
99-
'scope-danger' if DANGEROUS_SCOPES.include?(scope.to_s)
92+
def label_for_scope(scope)
93+
safe_join [
94+
tag.samp(scope, class: { 'scope-danger' => SessionActivation::DEFAULT_SCOPES.include?(scope.to_s) }),
95+
tag.span(t("doorkeeper.scopes.#{scope}"), class: :hint),
96+
]
10097
end
10198

10299
def can?(action, record)
@@ -244,6 +241,10 @@ def mascot_url
244241
full_asset_url(instance_presenter.mascot&.file&.url || frontend_asset_path('images/elephant_ui_plane.svg'))
245242
end
246243

244+
def copyable_input(options = {})
245+
tag.input(type: :text, maxlength: 999, spellcheck: false, readonly: true, **options)
246+
end
247+
247248
# glitch-soc addition to handle the multiple flavors
248249
def preload_locale_pack
249250
supported_locales = Themes.instance.flavour(current_flavour)['locales']

app/helpers/webfinger_helper.rb

-7
This file was deleted.

0 commit comments

Comments
 (0)