diff --git a/.rubocop.yml b/.rubocop.yml index 542e90b5e3..cbc0afd281 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -211,6 +211,11 @@ Style/PercentLiteralDelimiters: Style/RedundantBegin: Enabled: false +# Reason: Prevailing style choice +# https://docs.rubocop.org/rubocop/cops_style.html#styleredundantfetchblock +Style/RedundantFetchBlock: + Enabled: false + # Reason: Overridden to reduce implicit StandardError rescues # https://docs.rubocop.org/rubocop/cops_style.html#stylerescuestandarderror Style/RescueStandardError: diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 955a37b781..cdd0c5452d 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -169,16 +169,6 @@ Style/RedundantConstantBase: - 'config/environments/production.rb' - 'config/initializers/sidekiq.rb' -# This cop supports unsafe autocorrection (--autocorrect-all). -# Configuration parameters: SafeForConstants. -Style/RedundantFetchBlock: - Exclude: - - 'config/initializers/1_hosts.rb' - - 'config/initializers/chewy.rb' - - 'config/initializers/devise.rb' - - 'config/initializers/paperclip.rb' - - 'config/puma.rb' - # This cop supports unsafe autocorrection (--autocorrect-all). # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength. # AllowedMethods: present?, blank?, presence, try, try! diff --git a/.simplecov b/.simplecov deleted file mode 100644 index fbd0207bec..0000000000 --- a/.simplecov +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -if ENV['CI'] - require 'simplecov-lcov' - SimpleCov::Formatter::LcovFormatter.config.report_with_single_file = true - SimpleCov.formatter = SimpleCov::Formatter::LcovFormatter -else - SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter -end - -SimpleCov.start 'rails' do - enable_coverage :branch - - add_filter 'lib/linter' - - add_group 'Libraries', 'lib' - add_group 'Policies', 'app/policies' - add_group 'Presenters', 'app/presenters' - add_group 'Serializers', 'app/serializers' - add_group 'Services', 'app/services' - add_group 'Validators', 'app/validators' -end diff --git a/Gemfile b/Gemfile index 247865aacf..240dcce95a 100644 --- a/Gemfile +++ b/Gemfile @@ -132,7 +132,7 @@ group :test do gem 'email_spec' # Extra RSpec extension methods and helpers for sidekiq - gem 'rspec-sidekiq', '~> 4.0' + gem 'rspec-sidekiq', '~> 5.0' # Browser integration testing gem 'capybara', '~> 3.39' @@ -178,7 +178,7 @@ group :development do # Preview mail in the browser gem 'letter_opener', '~> 1.8' - gem 'letter_opener_web', '~> 2.0' + gem 'letter_opener_web', '~> 3.0' # Security analysis CLI tools gem 'brakeman', '~> 6.0', require: false diff --git a/Gemfile.lock b/Gemfile.lock index efc99eb23d..6001c73db4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -100,16 +100,16 @@ GEM attr_required (1.0.2) awrence (1.2.1) aws-eventstream (1.3.0) - aws-partitions (1.922.0) - aws-sdk-core (3.194.1) + aws-partitions (1.929.0) + aws-sdk-core (3.196.1) 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.80.0) + aws-sdk-kms (1.81.0) aws-sdk-core (~> 3, >= 3.193.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.149.1) + aws-sdk-s3 (1.151.0) aws-sdk-core (~> 3, >= 3.194.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.8) @@ -272,7 +272,7 @@ GEM fog-json (1.2.0) fog-core multi_json (~> 1.10) - fog-openstack (1.1.0) + fog-openstack (1.1.1) fog-core (~> 2.1) fog-json (>= 1.0) formatador (1.1.0) @@ -389,10 +389,10 @@ GEM addressable (~> 2.8) letter_opener (1.10.0) launchy (>= 2.2, < 4) - letter_opener_web (2.0.0) - actionmailer (>= 5.2) - letter_opener (~> 1.7) - railties (>= 5.2) + letter_opener_web (3.0.0) + actionmailer (>= 6.1) + letter_opener (~> 1.9) + railties (>= 6.1) rexml link_header (0.0.8) llhttp-ffi (0.5.0) @@ -422,7 +422,7 @@ GEM memory_profiler (1.0.1) mime-types (3.5.2) mime-types-data (~> 3.2015) - mime-types-data (3.2024.0305) + mime-types-data (3.2024.0507) mini_mime (1.1.5) mini_portile2 (2.8.6) minitest (5.22.3) @@ -434,7 +434,7 @@ GEM uri net-http-persistent (4.0.2) connection_pool (~> 2.2) - net-imap (0.4.10) + net-imap (0.4.11) date net-protocol net-ldap (0.19.0) @@ -445,7 +445,7 @@ GEM net-smtp (0.5.0) net-protocol nio4r (2.7.1) - nokogiri (1.16.4) + nokogiri (1.16.5) mini_portile2 (~> 2.8.2) racc (~> 1.4) nsa (0.3.0) @@ -686,14 +686,15 @@ GEM redlock (1.3.2) redis (>= 3.0.0, < 6.0) regexp_parser (2.9.0) - reline (0.5.6) + reline (0.5.7) io-console (~> 0.5) request_store (1.6.0) rack (>= 1.4) responders (3.1.1) actionpack (>= 5.2) railties (>= 5.2) - rexml (3.2.6) + rexml (3.2.8) + strscan (>= 3.0.9) rotp (6.3.0) rouge (4.2.1) rpam2 (4.0.2) @@ -708,7 +709,7 @@ GEM rspec-support (~> 3.13.0) rspec-github (2.4.0) rspec-core (~> 3.0) - rspec-mocks (3.13.0) + rspec-mocks (3.13.1) diff-lcs (>= 1.2.0, < 2.0) rspec-support (~> 3.13.0) rspec-rails (6.1.2) @@ -719,7 +720,7 @@ GEM rspec-expectations (~> 3.13) rspec-mocks (~> 3.13) rspec-support (~> 3.13) - rspec-sidekiq (4.2.0) + rspec-sidekiq (5.0.0) rspec-core (~> 3.0) rspec-expectations (~> 3.0) rspec-mocks (~> 3.0) @@ -774,7 +775,7 @@ GEM scenic (1.8.0) activerecord (>= 4.0.0) railties (>= 4.0.0) - selenium-webdriver (4.20.1) + selenium-webdriver (4.21.0) base64 (~> 0.2) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) @@ -815,6 +816,7 @@ GEM stringio (3.1.0) strong_migrations (1.8.0) activerecord (>= 5.2) + strscan (3.1.0) swd (1.3.0) activesupport (>= 3) attr_required (>= 0.0.5) @@ -893,7 +895,7 @@ GEM xorcist (1.1.3) xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.13) + zeitwerk (2.6.14) PLATFORMS ruby @@ -955,7 +957,7 @@ DEPENDENCIES kaminari (~> 1.2) kt-paperclip (~> 7.2) letter_opener (~> 1.8) - letter_opener_web (~> 2.0) + letter_opener_web (~> 3.0) link_header (~> 0.0) lograge (~> 0.12) mail (~> 2.8) @@ -1012,7 +1014,7 @@ DEPENDENCIES rqrcode (~> 2.2) rspec-github (~> 2.4) rspec-rails (~> 6.0) - rspec-sidekiq (~> 4.0) + rspec-sidekiq (~> 5.0) rubocop rubocop-capybara rubocop-performance diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index af00038eae..685b02ae6d 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -25,7 +25,7 @@ class AccountsController < ApplicationController limit = params[:limit].present? ? [params[:limit].to_i, PAGE_SIZE_MAX].min : PAGE_SIZE @statuses = filtered_statuses.without_reblogs.limit(limit) - @statuses = cache_collection(@statuses, Status) + @statuses = preload_collection(@statuses, Status) end format.json do diff --git a/app/controllers/activitypub/collections_controller.rb b/app/controllers/activitypub/collections_controller.rb index 57480db8d8..15985c7f65 100644 --- a/app/controllers/activitypub/collections_controller.rb +++ b/app/controllers/activitypub/collections_controller.rb @@ -18,7 +18,7 @@ class ActivityPub::CollectionsController < ActivityPub::BaseController def set_items case params[:id] when 'featured' - @items = for_signed_account { cache_collection(@account.pinned_statuses.not_local_only, Status) } + @items = for_signed_account { preload_collection(@account.pinned_statuses.not_local_only, Status) } @items = @items.map { |item| item.distributable? ? item : ActivityPub::TagManager.instance.uri_for(item) } when 'tags' @items = for_signed_account { @account.featured_tags } diff --git a/app/controllers/activitypub/outboxes_controller.rb b/app/controllers/activitypub/outboxes_controller.rb index 8079e011dd..b8baf64e1a 100644 --- a/app/controllers/activitypub/outboxes_controller.rb +++ b/app/controllers/activitypub/outboxes_controller.rb @@ -60,7 +60,7 @@ class ActivityPub::OutboxesController < ActivityPub::BaseController def set_statuses return unless page_requested? - @statuses = cache_collection_paginated_by_id( + @statuses = preload_collection_paginated_by_id( AccountStatusesFilter.new(@account, signed_request_account).results, Status, LIMIT, diff --git a/app/controllers/api/v1/accounts/statuses_controller.rb b/app/controllers/api/v1/accounts/statuses_controller.rb index 35ea9c8ec1..c42f27776c 100644 --- a/app/controllers/api/v1/accounts/statuses_controller.rb +++ b/app/controllers/api/v1/accounts/statuses_controller.rb @@ -19,11 +19,11 @@ class Api::V1::Accounts::StatusesController < Api::BaseController end def load_statuses - @account.unavailable? ? [] : cached_account_statuses + @account.unavailable? ? [] : preloaded_account_statuses end - def cached_account_statuses - cache_collection_paginated_by_id( + def preloaded_account_statuses + preload_collection_paginated_by_id( AccountStatusesFilter.new(@account, current_account, params).results, Status, limit_param(DEFAULT_STATUSES_LIMIT), diff --git a/app/controllers/api/v1/bookmarks_controller.rb b/app/controllers/api/v1/bookmarks_controller.rb index b6bb987b6b..f7671a9032 100644 --- a/app/controllers/api/v1/bookmarks_controller.rb +++ b/app/controllers/api/v1/bookmarks_controller.rb @@ -13,11 +13,11 @@ class Api::V1::BookmarksController < Api::BaseController private def load_statuses - cached_bookmarks + preloaded_bookmarks end - def cached_bookmarks - cache_collection(results.map(&:status), Status) + def preloaded_bookmarks + preload_collection(results.map(&:status), Status) end def results diff --git a/app/controllers/api/v1/favourites_controller.rb b/app/controllers/api/v1/favourites_controller.rb index 73da538f5c..18ca9ab866 100644 --- a/app/controllers/api/v1/favourites_controller.rb +++ b/app/controllers/api/v1/favourites_controller.rb @@ -13,11 +13,11 @@ class Api::V1::FavouritesController < Api::BaseController private def load_statuses - cached_favourites + preloaded_favourites end - def cached_favourites - cache_collection(results.map(&:status), Status) + def preloaded_favourites + preload_collection(results.map(&:status), Status) end def results diff --git a/app/controllers/api/v1/notifications/requests_controller.rb b/app/controllers/api/v1/notifications/requests_controller.rb index 6a26cc0e8a..0e58379a38 100644 --- a/app/controllers/api/v1/notifications/requests_controller.rb +++ b/app/controllers/api/v1/notifications/requests_controller.rb @@ -41,7 +41,7 @@ class Api::V1::Notifications::RequestsController < Api::BaseController ) NotificationRequest.preload_cache_collection(requests) do |statuses| - cache_collection(statuses, Status) + preload_collection(statuses, Status) end end diff --git a/app/controllers/api/v1/notifications_controller.rb b/app/controllers/api/v1/notifications_controller.rb index 9c75516159..c82900ef66 100644 --- a/app/controllers/api/v1/notifications_controller.rb +++ b/app/controllers/api/v1/notifications_controller.rb @@ -50,7 +50,7 @@ class Api::V1::NotificationsController < Api::BaseController ) Notification.preload_cache_collection_target_statuses(notifications) do |target_statuses| - cache_collection(target_statuses, Status) + preload_collection(target_statuses, Status) end end diff --git a/app/controllers/api/v1/statuses_controller.rb b/app/controllers/api/v1/statuses_controller.rb index 6444f87a01..3f138d28ba 100644 --- a/app/controllers/api/v1/statuses_controller.rb +++ b/app/controllers/api/v1/statuses_controller.rb @@ -26,13 +26,13 @@ class Api::V1::StatusesController < Api::BaseController DESCENDANTS_DEPTH_LIMIT = 20 def index - @statuses = cache_collection(@statuses, Status) + @statuses = preload_collection(@statuses, Status) render json: @statuses, each_serializer: REST::StatusSerializer end def show cache_if_unauthenticated! - @status = cache_collection([@status], Status).first + @status = preload_collection([@status], Status).first render json: @status, serializer: REST::StatusSerializer end @@ -51,8 +51,8 @@ class Api::V1::StatusesController < Api::BaseController ancestors_results = @status.in_reply_to_id.nil? ? [] : @status.ancestors(ancestors_limit, current_account) descendants_results = @status.descendants(descendants_limit, current_account, descendants_depth_limit) - loaded_ancestors = cache_collection(ancestors_results, Status) - loaded_descendants = cache_collection(descendants_results, Status) + loaded_ancestors = preload_collection(ancestors_results, Status) + loaded_descendants = preload_collection(descendants_results, Status) @context = Context.new(ancestors: loaded_ancestors, descendants: loaded_descendants) statuses = [@status] + @context.ancestors + @context.descendants diff --git a/app/controllers/api/v1/timelines/direct_controller.rb b/app/controllers/api/v1/timelines/direct_controller.rb index 6e98e9cacb..f295cee608 100644 --- a/app/controllers/api/v1/timelines/direct_controller.rb +++ b/app/controllers/api/v1/timelines/direct_controller.rb @@ -15,11 +15,11 @@ class Api::V1::Timelines::DirectController < Api::BaseController private def load_statuses - cached_direct_statuses + preloaded_direct_statuses end - def cached_direct_statuses - cache_collection direct_statuses, Status + def preloaded_direct_statuses + preload_collection direct_statuses, Status end def direct_statuses diff --git a/app/controllers/api/v1/timelines/home_controller.rb b/app/controllers/api/v1/timelines/home_controller.rb index 36fdbea647..d5d1828666 100644 --- a/app/controllers/api/v1/timelines/home_controller.rb +++ b/app/controllers/api/v1/timelines/home_controller.rb @@ -21,11 +21,11 @@ class Api::V1::Timelines::HomeController < Api::V1::Timelines::BaseController private def load_statuses - cached_home_statuses + preloaded_home_statuses end - def cached_home_statuses - cache_collection home_statuses, Status + def preloaded_home_statuses + preload_collection home_statuses, Status end def home_statuses diff --git a/app/controllers/api/v1/timelines/list_controller.rb b/app/controllers/api/v1/timelines/list_controller.rb index 14b884ecd9..d8cdbdb74c 100644 --- a/app/controllers/api/v1/timelines/list_controller.rb +++ b/app/controllers/api/v1/timelines/list_controller.rb @@ -21,11 +21,11 @@ class Api::V1::Timelines::ListController < Api::V1::Timelines::BaseController end def set_statuses - @statuses = cached_list_statuses + @statuses = preloaded_list_statuses end - def cached_list_statuses - cache_collection list_statuses, Status + def preloaded_list_statuses + preload_collection list_statuses, Status end def list_statuses diff --git a/app/controllers/api/v1/timelines/public_controller.rb b/app/controllers/api/v1/timelines/public_controller.rb index 5bc8de8334..5a6b4d0e98 100644 --- a/app/controllers/api/v1/timelines/public_controller.rb +++ b/app/controllers/api/v1/timelines/public_controller.rb @@ -18,11 +18,11 @@ class Api::V1::Timelines::PublicController < Api::V1::Timelines::BaseController end def load_statuses - cached_public_statuses_page + preloaded_public_statuses_page end - def cached_public_statuses_page - cache_collection(public_statuses, Status) + def preloaded_public_statuses_page + preload_collection(public_statuses, Status) end def public_statuses diff --git a/app/controllers/api/v1/timelines/tag_controller.rb b/app/controllers/api/v1/timelines/tag_controller.rb index 4ba439dbb2..3bf8f374e1 100644 --- a/app/controllers/api/v1/timelines/tag_controller.rb +++ b/app/controllers/api/v1/timelines/tag_controller.rb @@ -23,11 +23,11 @@ class Api::V1::Timelines::TagController < Api::V1::Timelines::BaseController end def load_statuses - cached_tagged_statuses + preloaded_tagged_statuses end - def cached_tagged_statuses - @tag.nil? ? [] : cache_collection(tag_timeline_statuses, Status) + def preloaded_tagged_statuses + @tag.nil? ? [] : preload_collection(tag_timeline_statuses, Status) end def tag_timeline_statuses diff --git a/app/controllers/api/v1/trends/statuses_controller.rb b/app/controllers/api/v1/trends/statuses_controller.rb index 48bfe11991..c6fbbce167 100644 --- a/app/controllers/api/v1/trends/statuses_controller.rb +++ b/app/controllers/api/v1/trends/statuses_controller.rb @@ -20,7 +20,7 @@ class Api::V1::Trends::StatusesController < Api::BaseController def set_statuses @statuses = if enabled? - cache_collection(statuses_from_trends.offset(offset_param).limit(limit_param(DEFAULT_STATUSES_LIMIT)), Status) + preload_collection(statuses_from_trends.offset(offset_param).limit(limit_param(DEFAULT_STATUSES_LIMIT)), Status) else [] end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index bd152dbb66..1d700fa282 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -9,6 +9,7 @@ class ApplicationController < ActionController::Base include UserTrackingConcern include SessionTrackingConcern include CacheConcern + include PreloadingConcern include DomainControlHelper include ThemingConcern include DatabaseHelper diff --git a/app/controllers/concerns/cache_concern.rb b/app/controllers/concerns/cache_concern.rb index 4656539f85..1823b5b8ed 100644 --- a/app/controllers/concerns/cache_concern.rb +++ b/app/controllers/concerns/cache_concern.rb @@ -45,20 +45,4 @@ module CacheConcern Rails.cache.write(key, response.body, expires_in: expires_in, raw: true) end end - - # TODO: Rename this method, as it does not perform any caching anymore. - def cache_collection(raw, klass) - return raw unless klass.respond_to?(:preload_cacheable_associations) - - records = raw.to_a - - klass.preload_cacheable_associations(records) - - records - end - - # TODO: Rename this method, as it does not perform any caching anymore. - def cache_collection_paginated_by_id(raw, klass, limit, options) - cache_collection raw.to_a_paginated_by_id(limit, options), klass - end end diff --git a/app/controllers/concerns/preloading_concern.rb b/app/controllers/concerns/preloading_concern.rb new file mode 100644 index 0000000000..61e2213649 --- /dev/null +++ b/app/controllers/concerns/preloading_concern.rb @@ -0,0 +1,17 @@ +# frozen_string_literal: true + +module PreloadingConcern + extend ActiveSupport::Concern + + def preload_collection(scope, klass) + return scope unless klass.respond_to?(:preload_cacheable_associations) + + scope.to_a.tap do |records| + klass.preload_cacheable_associations(records) + end + end + + def preload_collection_paginated_by_id(scope, klass, limit, options) + preload_collection scope.to_a_paginated_by_id(limit, options), klass + end +end diff --git a/app/controllers/settings/applications_controller.rb b/app/controllers/settings/applications_controller.rb index d4b7205681..6849979b11 100644 --- a/app/controllers/settings/applications_controller.rb +++ b/app/controllers/settings/applications_controller.rb @@ -13,7 +13,7 @@ class Settings::ApplicationsController < Settings::BaseController def new @application = Doorkeeper::Application.new( redirect_uri: Doorkeeper.configuration.native_redirect_uri, - scopes: 'read write follow' + scopes: 'read:me' ) end diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb index b0bdbde956..d6c0d872c8 100644 --- a/app/controllers/tags_controller.rb +++ b/app/controllers/tags_controller.rb @@ -45,7 +45,7 @@ class TagsController < ApplicationController end def set_statuses - @statuses = cache_collection(TagFeed.new(@tag, nil, local: @local).get(limit_param), Status) + @statuses = preload_collection(TagFeed.new(@tag, nil, local: @local).get(limit_param), Status) end def limit_param diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index c52bbb846e..8cf1014f4d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -241,11 +241,16 @@ module ApplicationHelper EmojiFormatter.new(html, custom_emojis, other_options.merge(animate: prefers_autoplay?)).to_s end - def site_icon_path(type, size = '48') - icon = SiteUpload.find_by(var: type) - return nil unless icon + def instance_presenter + @instance_presenter ||= InstancePresenter.new + end - icon.file.url(size) + def favicon_path(size = '48') + instance_presenter.favicon&.file&.url(size) + end + + def app_icon_path(size = '48') + instance_presenter.app_icon&.file&.url(size) end # glitch-soc addition to handle the multiple flavors diff --git a/app/javascript/mastodon/actions/settings.js b/app/javascript/mastodon/actions/settings.js index 3685b0684e..fbd89f9d4b 100644 --- a/app/javascript/mastodon/actions/settings.js +++ b/app/javascript/mastodon/actions/settings.js @@ -20,7 +20,7 @@ export function changeSetting(path, value) { } const debouncedSave = debounce((dispatch, getState) => { - if (getState().getIn(['settings', 'saved'])) { + if (getState().getIn(['settings', 'saved']) || !getState().getIn(['meta', 'me'])) { return; } diff --git a/app/javascript/mastodon/locales/cy.json b/app/javascript/mastodon/locales/cy.json index 925b7710e0..2c59769959 100644 --- a/app/javascript/mastodon/locales/cy.json +++ b/app/javascript/mastodon/locales/cy.json @@ -474,6 +474,7 @@ "notification.follow_request": "Mae {name} wedi gwneud cais i'ch dilyn", "notification.mention": "Crybwyllodd {name} amdanoch chi", "notification.moderation-warning.learn_more": "Dysgu mwy", + "notification.moderation_warning": "Rydych wedi derbyn rhybudd gan gymedrolwr", "notification.moderation_warning.action_delete_statuses": "Mae rhai o'ch postiadau wedi'u dileu.", "notification.moderation_warning.action_disable": "Mae eich cyfrif wedi'i analluogi.", "notification.moderation_warning.action_mark_statuses_as_sensitive": "Mae rhai o'ch postiadau wedi'u marcio'n sensitif.", diff --git a/app/javascript/mastodon/locales/en-GB.json b/app/javascript/mastodon/locales/en-GB.json index 6c24d5a261..e70348e0b2 100644 --- a/app/javascript/mastodon/locales/en-GB.json +++ b/app/javascript/mastodon/locales/en-GB.json @@ -308,6 +308,8 @@ "follow_requests.unlocked_explanation": "Even though your account is not locked, the {domain} staff thought you might want to review follow requests from these accounts manually.", "follow_suggestions.curated_suggestion": "Staff pick", "follow_suggestions.dismiss": "Don't show again", + "follow_suggestions.featured_longer": "Hand-picked by the {domain} team", + "follow_suggestions.friends_of_friends_longer": "Popular among people you follow", "follow_suggestions.hints.featured": "This profile has been hand-picked by the {domain} team.", "follow_suggestions.hints.friends_of_friends": "This profile is popular among the people you follow.", "follow_suggestions.hints.most_followed": "This profile is one of the most followed on {domain}.", @@ -315,6 +317,8 @@ "follow_suggestions.hints.similar_to_recently_followed": "This profile is similar to the profiles you have most recently followed.", "follow_suggestions.personalized_suggestion": "Personalised suggestion", "follow_suggestions.popular_suggestion": "Popular suggestion", + "follow_suggestions.popular_suggestion_longer": "Popular on {domain}", + "follow_suggestions.similar_to_recently_followed_longer": "Similar to profiles you recently followed", "follow_suggestions.view_all": "View all", "follow_suggestions.who_to_follow": "Who to follow", "followed_tags": "Followed hashtags", @@ -469,6 +473,15 @@ "notification.follow": "{name} followed you", "notification.follow_request": "{name} has requested to follow you", "notification.mention": "{name} mentioned you", + "notification.moderation-warning.learn_more": "Learn more", + "notification.moderation_warning": "You have received a moderation warning", + "notification.moderation_warning.action_delete_statuses": "Some of your posts have been removed.", + "notification.moderation_warning.action_disable": "Your account has been disabled.", + "notification.moderation_warning.action_mark_statuses_as_sensitive": "Some of your posts have been marked as sensitive.", + "notification.moderation_warning.action_none": "Your account has received a moderation warning.", + "notification.moderation_warning.action_sensitive": "Your posts will be marked as sensitive from now on.", + "notification.moderation_warning.action_silence": "Your account has been limited.", + "notification.moderation_warning.action_suspend": "Your account has been suspended.", "notification.own_poll": "Your poll has ended", "notification.poll": "A poll you have voted in has ended", "notification.reblog": "{name} boosted your status", diff --git a/app/javascript/mastodon/locales/gl.json b/app/javascript/mastodon/locales/gl.json index b2a50ebb81..98cc313948 100644 --- a/app/javascript/mastodon/locales/gl.json +++ b/app/javascript/mastodon/locales/gl.json @@ -92,7 +92,7 @@ "block_modal.remote_users_caveat": "Ímoslle pedir ao servidor {domain} que respecte a túa decisión. Emporiso, non hai garantía de que atenda a petición xa que os servidores xestionan os bloqueos de formas diferentes. As publicacións públicas poderían aínda ser visibles para usuarias que non iniciaron sesión.", "block_modal.show_less": "Mostrar menos", "block_modal.show_more": "Mostrar máis", - "block_modal.they_cant_mention": "Non te pode seguir nin mencionar.", + "block_modal.they_cant_mention": "Non te poden seguir nin mencionar.", "block_modal.they_cant_see_posts": "Non pode ver as túas publicacións nin ti as de ela.", "block_modal.they_will_know": "Pode ver que a bloqueaches.", "block_modal.title": "Bloquear usuaria?", @@ -474,6 +474,7 @@ "notification.follow_request": "{name} solicitou seguirte", "notification.mention": "{name} mencionoute", "notification.moderation-warning.learn_more": "Saber máis", + "notification.moderation_warning": "Recibiches unha advertencia da moderación", "notification.moderation_warning.action_delete_statuses": "Algunha das túas publicacións foron eliminadas.", "notification.moderation_warning.action_disable": "A túa conta foi desactivada.", "notification.moderation_warning.action_mark_statuses_as_sensitive": "Algunha das túas publicacións foron marcadas como sensibles.", diff --git a/app/javascript/mastodon/locales/sk.json b/app/javascript/mastodon/locales/sk.json index 2863442415..c583b58220 100644 --- a/app/javascript/mastodon/locales/sk.json +++ b/app/javascript/mastodon/locales/sk.json @@ -295,6 +295,7 @@ "follow_suggestions.personalized_suggestion": "Prispôsobený návrh", "follow_suggestions.popular_suggestion": "Obľúbený návrh", "follow_suggestions.popular_suggestion_longer": "Populárne na {domain}", + "follow_suggestions.similar_to_recently_followed_longer": "Podobné profilom, ktoré si nedávno nasledoval/a", "follow_suggestions.view_all": "Zobraziť všetky", "follow_suggestions.who_to_follow": "Koho sledovať", "followed_tags": "Sledované hashtagy", @@ -445,10 +446,14 @@ "notification.follow_request": "{name} vás žiada sledovať", "notification.mention": "{name} vás spomína", "notification.moderation-warning.learn_more": "Zisti viac", + "notification.moderation_warning.action_disable": "Tvoj účet bol vypnutý.", + "notification.moderation_warning.action_silence": "Tvoj účet bol obmedzený.", + "notification.moderation_warning.action_suspend": "Tvoj účet bol pozastavený.", "notification.own_poll": "Vaša anketa sa skončila", "notification.poll": "Anketa, v ktorej ste hlasovali, sa skončila", "notification.reblog": "{name} zdieľa váš príspevok", "notification.relationships_severance_event": "Stratené prepojenia s {name}", + "notification.relationships_severance_event.account_suspension": "Správca z {from} pozastavil/a {target}, čo znamená, že od nich viac nemôžeš dostávať aktualizácie, alebo s nimi interaktovať.", "notification.relationships_severance_event.learn_more": "Zisti viac", "notification.status": "{name} uverejňuje niečo nové", "notification.update": "{name} upravuje príspevok", diff --git a/app/javascript/mastodon/locales/tr.json b/app/javascript/mastodon/locales/tr.json index c46080cfb2..6c01106593 100644 --- a/app/javascript/mastodon/locales/tr.json +++ b/app/javascript/mastodon/locales/tr.json @@ -474,7 +474,7 @@ "notification.follow_request": "{name} size takip isteği gönderdi", "notification.mention": "{name} senden bahsetti", "notification.moderation-warning.learn_more": "Daha fazlası", - "notification.moderation_warning": "Bir denetim uyarısı aldınız", + "notification.moderation_warning": "Hesabınız bir denetim uyarısı aldı", "notification.moderation_warning.action_delete_statuses": "Bazı gönderileriniz kaldırıldı.", "notification.moderation_warning.action_disable": "Hesabınız devre dışı bırakıldı.", "notification.moderation_warning.action_mark_statuses_as_sensitive": "Bazı gönderileriniz hassas olarak işaretlendi.", diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss index 27482c20c1..72df3ce6cb 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -4365,10 +4365,6 @@ a.status-card { outline: $ui-button-focus-outline; } - .no-reduce-motion .icon { - transition: transform 0.15s ease-in-out; - } - &.active { color: $primary-text-color; @@ -4387,6 +4383,10 @@ a.status-card { } } +.no-reduce-motion .column-header__button .icon { + transition: transform 150ms ease-in-out; +} + .column-header__collapsible { max-height: 70vh; overflow: hidden; diff --git a/app/lib/admin/metrics/dimension/software_versions_dimension.rb b/app/lib/admin/metrics/dimension/software_versions_dimension.rb index ccf556eae0..97cdaf589e 100644 --- a/app/lib/admin/metrics/dimension/software_versions_dimension.rb +++ b/app/lib/admin/metrics/dimension/software_versions_dimension.rb @@ -25,14 +25,11 @@ class Admin::Metrics::Dimension::SoftwareVersionsDimension < Admin::Metrics::Dim end def ruby_version - yjit = defined?(RubyVM::YJIT) && RubyVM::YJIT.enabled? - value = "#{RUBY_VERSION}p#{RUBY_PATCHLEVEL}#{yjit ? ' +YJIT' : ''}" - { key: 'ruby', human_key: 'Ruby', - value: value, - human_value: value, + value: "#{RUBY_VERSION}p#{RUBY_PATCHLEVEL}", + human_value: RUBY_DESCRIPTION, } end diff --git a/app/models/account_moderation_note.rb b/app/models/account_moderation_note.rb index ad49b24229..79b8b4d25e 100644 --- a/app/models/account_moderation_note.rb +++ b/app/models/account_moderation_note.rb @@ -13,7 +13,7 @@ # class AccountModerationNote < ApplicationRecord - CONTENT_SIZE_LIMIT = 500 + CONTENT_SIZE_LIMIT = 2_000 belongs_to :account belongs_to :target_account, class_name: 'Account' diff --git a/app/models/report_note.rb b/app/models/report_note.rb index b5c40a18b1..7361c97e67 100644 --- a/app/models/report_note.rb +++ b/app/models/report_note.rb @@ -13,7 +13,7 @@ # class ReportNote < ApplicationRecord - CONTENT_SIZE_LIMIT = 500 + CONTENT_SIZE_LIMIT = 2_000 belongs_to :account belongs_to :report, inverse_of: :notes, touch: true diff --git a/app/presenters/instance_presenter.rb b/app/presenters/instance_presenter.rb index 25df4d85aa..92415a6903 100644 --- a/app/presenters/instance_presenter.rb +++ b/app/presenters/instance_presenter.rb @@ -81,4 +81,16 @@ class InstancePresenter < ActiveModelSerializers::Model def mascot @mascot ||= Rails.cache.fetch('site_uploads/mascot') { SiteUpload.find_by(var: 'mascot') } end + + def favicon + return @favicon if defined?(@favicon) + + @favicon ||= Rails.cache.fetch('site_uploads/favicon') { SiteUpload.find_by(var: 'favicon') } + end + + def app_icon + return @app_icon if defined?(@app_icon) + + @app_icon ||= Rails.cache.fetch('site_uploads/app_icon') { SiteUpload.find_by(var: 'app_icon') } + end end diff --git a/app/serializers/manifest_serializer.rb b/app/serializers/manifest_serializer.rb index 759490228c..a39fb5ef54 100644 --- a/app/serializers/manifest_serializer.rb +++ b/app/serializers/manifest_serializer.rb @@ -27,7 +27,7 @@ class ManifestSerializer < ActiveModel::Serializer def icons SiteUpload::ANDROID_ICON_SIZES.map do |size| - src = site_icon_path('app_icon', size.to_i) + src = app_icon_path(size.to_i) src = URI.join(root_url, src).to_s if src.present? { diff --git a/app/views/admin/accounts/show.html.haml b/app/views/admin/accounts/show.html.haml index 41fcafa29d..bcf7c07314 100644 --- a/app/views/admin/accounts/show.html.haml +++ b/app/views/admin/accounts/show.html.haml @@ -62,14 +62,16 @@ .report-notes = render partial: 'admin/report_notes/report_note', collection: @moderation_notes - = simple_form_for @account_moderation_note, url: admin_account_moderation_notes_path do |f| - = f.hidden_field :target_account_id + = simple_form_for @account_moderation_note, url: admin_account_moderation_notes_path do |form| + = form.hidden_field :target_account_id + + = render 'shared/error_messages', object: @account_moderation_note .field-group - = f.input :content, placeholder: t('admin.reports.notes.placeholder'), rows: 6 + = form.input :content, input_html: { placeholder: t('admin.reports.notes.placeholder'), maxlength: AccountModerationNote::CONTENT_SIZE_LIMIT, rows: 6, autofocus: @account_moderation_note.errors.any? } .actions - = f.button :button, t('admin.account_moderation_notes.create'), type: :submit + = form.button :button, t('admin.account_moderation_notes.create'), type: :submit %hr.spacer/ diff --git a/app/views/admin/reports/show.html.haml b/app/views/admin/reports/show.html.haml index c880021cff..842aa51597 100644 --- a/app/views/admin/reports/show.html.haml +++ b/app/views/admin/reports/show.html.haml @@ -83,15 +83,17 @@ .report-notes = render @report_notes -= simple_form_for @report_note, url: admin_report_notes_path do |f| - = f.input :report_id, as: :hidden += simple_form_for @report_note, url: admin_report_notes_path do |form| + = form.input :report_id, as: :hidden + + = render 'shared/error_messages', object: @report_note .field-group - = f.input :content, placeholder: t('admin.reports.notes.placeholder'), rows: 6 + = form.input :content, input_html: { placeholder: t('admin.reports.notes.placeholder'), maxlength: ReportNote::CONTENT_SIZE_LIMIT, rows: 6, autofocus: @report_note.errors.any? } .actions - if @report.unresolved? - = f.button :button, t('admin.reports.notes.create_and_resolve'), name: :create_and_resolve, type: :submit + = form.button :button, t('admin.reports.notes.create_and_resolve'), name: :create_and_resolve, type: :submit - else - = f.button :button, t('admin.reports.notes.create_and_unresolve'), name: :create_and_unresolve, type: :submit - = f.button :button, t('admin.reports.notes.create'), type: :submit + = form.button :button, t('admin.reports.notes.create_and_unresolve'), name: :create_and_unresolve, type: :submit + = form.button :button, t('admin.reports.notes.create'), type: :submit diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index ed436b729f..3a4335622a 100755 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -11,13 +11,13 @@ - if storage_host? %link{ rel: 'dns-prefetch', href: storage_host }/ - %link{ rel: 'icon', href: site_icon_path('favicon', 'ico') || '/favicon.ico', type: 'image/x-icon' }/ + %link{ rel: 'icon', href: favicon_path('ico') || '/favicon.ico', type: 'image/x-icon' }/ - SiteUpload::FAVICON_SIZES.each do |size| - %link{ rel: 'icon', sizes: "#{size}x#{size}", href: site_icon_path('favicon', size.to_i) || frontend_asset_path("icons/favicon-#{size}x#{size}.png"), type: 'image/png' }/ + %link{ rel: 'icon', sizes: "#{size}x#{size}", href: favicon_path(size.to_i) || frontend_asset_path("icons/favicon-#{size}x#{size}.png"), type: 'image/png' }/ - SiteUpload::APPLE_ICON_SIZES.each do |size| - %link{ rel: 'apple-touch-icon', sizes: "#{size}x#{size}", href: site_icon_path('app_icon', size.to_i) || frontend_asset_path("icons/apple-touch-icon-#{size}x#{size}.png") }/ + %link{ rel: 'apple-touch-icon', sizes: "#{size}x#{size}", href: app_icon_path(size.to_i) || frontend_asset_path("icons/apple-touch-icon-#{size}x#{size}.png") }/ %link{ rel: 'mask-icon', href: frontend_asset_path('images/logo-symbol-icon.svg'), color: '#6364FF' }/ %link{ rel: 'manifest', href: manifest_path(format: :json) }/ diff --git a/app/views/settings/applications/_fields.html.haml b/app/views/settings/applications/_fields.html.haml index ed97e880fc..d539848952 100644 --- a/app/views/settings/applications/_fields.html.haml +++ b/app/views/settings/applications/_fields.html.haml @@ -11,6 +11,7 @@ .fields-group = f.input :redirect_uri, label: t('activerecord.attributes.doorkeeper/application.redirect_uri'), hint: t('doorkeeper.applications.help.redirect_uri'), + required: true, wrapper: :with_block_label %p.hint= t('doorkeeper.applications.help.native_redirect_uri', native_redirect_uri: content_tag(:code, Doorkeeper.configuration.native_redirect_uri)).html_safe diff --git a/app/workers/scheduler/user_cleanup_scheduler.rb b/app/workers/scheduler/user_cleanup_scheduler.rb index 2d2efc731a..63ea876e50 100644 --- a/app/workers/scheduler/user_cleanup_scheduler.rb +++ b/app/workers/scheduler/user_cleanup_scheduler.rb @@ -3,6 +3,9 @@ class Scheduler::UserCleanupScheduler include Sidekiq::Worker + UNCONFIRMED_ACCOUNTS_MAX_AGE_DAYS = 7 + DISCARDED_STATUSES_MAX_AGE_DAYS = 30 + sidekiq_options retry: 0, lock: :until_executed, lock_ttl: 1.day.to_i def perform @@ -13,7 +16,7 @@ class Scheduler::UserCleanupScheduler private def clean_unconfirmed_accounts! - User.where('confirmed_at is NULL AND confirmation_sent_at <= ?', 2.days.ago).reorder(nil).find_in_batches do |batch| + User.where('confirmed_at is NULL AND confirmation_sent_at <= ?', UNCONFIRMED_ACCOUNTS_MAX_AGE_DAYS.days.ago).reorder(nil).find_in_batches do |batch| # We have to do it separately because of missing database constraints AccountModerationNote.where(target_account_id: batch.map(&:account_id)).delete_all Account.where(id: batch.map(&:account_id)).delete_all @@ -22,7 +25,7 @@ class Scheduler::UserCleanupScheduler end def clean_discarded_statuses! - Status.unscoped.discarded.where('deleted_at <= ?', 30.days.ago).find_in_batches do |statuses| + Status.unscoped.discarded.where('deleted_at <= ?', DISCARDED_STATUSES_MAX_AGE_DAYS.days.ago).find_in_batches do |statuses| RemovalWorker.push_bulk(statuses) do |status| [status.id, { 'immediate' => true, 'skip_streaming' => true }] end diff --git a/config/initializers/enable_yjit.rb b/config/initializers/enable_yjit.rb new file mode 100644 index 0000000000..7b1053ec11 --- /dev/null +++ b/config/initializers/enable_yjit.rb @@ -0,0 +1,13 @@ +# frozen_string_literal: true + +# Automatically enable YJIT as of Ruby 3.3, as it brings very +# sizeable performance improvements. + +# If you are deploying to a memory constrained environment +# you may want to delete this file, but otherwise it's free +# performance. +if defined?(RubyVM::YJIT.enable) + Rails.application.config.after_initialize do + RubyVM::YJIT.enable + end +end diff --git a/config/initializers/opentelemetry.rb b/config/initializers/opentelemetry.rb index e50132d461..9af0ab89c8 100644 --- a/config/initializers/opentelemetry.rb +++ b/config/initializers/opentelemetry.rb @@ -53,10 +53,12 @@ if ENV.keys.any? { |name| name.match?(/OTEL_.*_ENDPOINT/) } }, }) + prefix = ENV.fetch('OTEL_SERVICE_NAME_PREFIX', 'mastodon') + c.service_name = case $PROGRAM_NAME - when /puma/ then 'mastodon/web' + when /puma/ then "#{prefix}/web" else - "mastodon/#{$PROGRAM_NAME.split('/').last}" + "#{prefix}/#{$PROGRAM_NAME.split('/').last}" end c.service_version = Mastodon::Version.to_s end diff --git a/config/initializers/simple_cov_source_file.rb b/config/initializers/simple_cov_source_file.rb new file mode 100644 index 0000000000..c6b3586c82 --- /dev/null +++ b/config/initializers/simple_cov_source_file.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +# TODO: https://github.com/simplecov-ruby/simplecov/pull/1084 +# Patches this missing condition, monitor for upstream fix + +module SimpleCov + module SourceFileExtensions + def build_branches + coverage_branch_data = coverage_data.fetch('branches', {}) || {} # Add the final empty hash in case where 'branches' is present, but returns nil + branches = coverage_branch_data.flat_map do |condition, coverage_branches| + build_branches_from(condition, coverage_branches) + end + + process_skipped_branches(branches) + end + end +end + +SimpleCov::SourceFile.prepend(SimpleCov::SourceFileExtensions) if defined?(SimpleCov::SourceFile) diff --git a/config/locales/devise.ia.yml b/config/locales/devise.ia.yml index d83c708647..c68efddd07 100644 --- a/config/locales/devise.ia.yml +++ b/config/locales/devise.ia.yml @@ -86,9 +86,13 @@ ia: destroyed: A revider! Tu conto esseva cancellate con successo. Nos spera vider te novemente tosto. signed_up_but_pending: Un message con un ligamine de confirmation esseva inviate a tu conto de email. Post que tu clicca le ligamine, nos revidera tu application. Tu essera notificate si illo es approbate. updated: Tu conto ha essite actualisate con successo. + sessions: + signed_in: Connexe con successo. + signed_out: Disconnexe con successo. unlocks: unlocked: Tu conto ha essite disblocate con successo. Initia session a continuar. errors: messages: already_confirmed: jam esseva confirmate, tenta initiar session not_found: non trovate + not_locked: non era blocate diff --git a/config/locales/doorkeeper.en-GB.yml b/config/locales/doorkeeper.en-GB.yml index b3ceffb13f..2e537c5301 100644 --- a/config/locales/doorkeeper.en-GB.yml +++ b/config/locales/doorkeeper.en-GB.yml @@ -174,6 +174,7 @@ en-GB: read:filters: see your filters read:follows: see your follows read:lists: see your lists + read:me: read only your account's basic information read:mutes: see your mutes read:notifications: see your notifications read:reports: see your reports diff --git a/config/locales/doorkeeper.ia.yml b/config/locales/doorkeeper.ia.yml index b5bd6cc536..dc96599681 100644 --- a/config/locales/doorkeeper.ia.yml +++ b/config/locales/doorkeeper.ia.yml @@ -4,6 +4,7 @@ ia: attributes: doorkeeper/application: name: Nomine de application + scopes: Ambitos website: Sito web de application errors: models: @@ -28,12 +29,14 @@ ia: empty: Tu non ha applicationes. name: Nomine new: Nove application + scopes: Ambitos show: Monstrar title: Tu applicationes new: title: Nove application show: actions: Actiones + application_id: Clave del cliente scopes: Ambitos title: 'Application: %{name}' authorizations: @@ -42,13 +45,20 @@ ia: deny: Negar error: title: Ocurreva un error + new: + review_permissions: Revisionar le permissos + title: Autorisation necessari authorized_applications: + buttons: + revoke: Revocar confirmations: revoke: Es tu secur? index: + authorized_at: Autorisate le %{date} last_used_at: Ultime uso in %{date} never_used: Nunquam usate scopes: Permissiones + superapp: Interne title: Tu applicationes autorisate flash: applications: @@ -58,12 +68,21 @@ ia: notice: Application delite. update: notice: Application actualisate. + authorized_applications: + destroy: + notice: Application revocate. grouped_scopes: + access: + read: Accesso de sol lectura + read/write: Accesso de lectura e scriptura + write: Accesso de sol scriptura title: accounts: Contos admin/accounts: Gestion de contos + admin/all: Tote le functiones administrative admin/reports: Gestion de reportos all: Accesso plen a tu conto de Mastodon + blocks: Blocadas bookmarks: Marcapaginas conversations: Conversationes favourites: Favoritos @@ -84,7 +103,9 @@ ia: oauth2_provider: Fornitor OAuth2 scopes: admin:read: leger tote le datos in le servitor + admin:read:accounts: leger information sensibile de tote le contos admin:write: modificar tote le datos in le servitor + follow: modificar relationes del contos read: leger tote le datos de tu conto read:accounts: vider informationes de conto read:bookmarks: vider tu marcapaginas diff --git a/config/locales/en-GB.yml b/config/locales/en-GB.yml index df956902a6..7e31080dfa 100644 --- a/config/locales/en-GB.yml +++ b/config/locales/en-GB.yml @@ -751,6 +751,7 @@ en-GB: desc_html: This relies on external scripts from hCaptcha, which may be a security and privacy concern. In addition, this can make the registration process significantly less accessible to some (especially disabled) people. For these reasons, please consider alternative measures such as approval-based or invite-based registration. title: Require new users to solve a CAPTCHA to confirm their account content_retention: + danger_zone: Danger zone preamble: Control how user-generated content is stored in Mastodon. title: Content retention default_noindex: diff --git a/config/locales/ia.yml b/config/locales/ia.yml index 46cdcd3c68..68676a09f7 100644 --- a/config/locales/ia.yml +++ b/config/locales/ia.yml @@ -997,6 +997,7 @@ ia: body_remote: Alcuno de %{domain} ha reportate %{target} subject: Nove reporto pro %{instance} (#%{id}) new_software_updates: + body: Nove versiones de Mastodon ha essite publicate, tu poterea voler actualisar! subject: Nove versiones de Mastodon es disponibile pro %{instance}! new_trends: body: 'Le sequente elementos besoniar de un recension ante que illos pote esser monstrate publicamente:' @@ -1048,6 +1049,7 @@ ia: hint_html: Justo un altere cosa! Nos debe confirmar que tu es un human (isto es assi proque nos pote mantener foras le spam!). Solve le CAPTCHA infra e clicca "Continuar". title: Controlo de securitate confirmations: + awaiting_review: Tu adresse email es confirmate! Le personal de %{domain} ora revide tu registration. Tu recipera un email si illes approba tu conto! awaiting_review_title: Tu registration es revidite clicking_this_link: cliccante iste ligamine login_link: acceder @@ -1066,6 +1068,7 @@ ia: logout: Clauder le session migrate_account: Move a un conto differente or_log_in_with: O accede con + privacy_policy_agreement_html: Io ha legite e acceptar le politica de confidentialitate progress: confirm: Confirma le email details: Tu detalios @@ -1075,29 +1078,69 @@ ia: cas: CAS saml: SAML register: Inscribe te + registration_closed: "%{instance} non accepta nove membros" resend_confirmation: Reinviar ligamine de confirmation reset_password: Remontar le contrasigno rules: accept: Acceptar back: Retro + invited_by: 'Tu pote junger te a %{domain} gratias al invitation que tu ha recipite de:' + preamble: Illos es predefinite e fortiarte per le moderatores de %{domain}. + preamble_invited: Ante que tu continua, considera le regulas base definite per le moderatores de %{domain}. title: Alcun regulas base. + title_invited: Tu ha essite invitate. security: Securitate set_new_password: Definir un nove contrasigno + setup: + email_below_hint_html: Verifica tu plica de spam, o pete un altero. Tu pote corriger tu adresse email si illo es errate. + email_settings_hint_html: Clicca le ligamine que nos te inviava pro verificar %{email}. + link_not_received: Non obteneva tu un ligamine? + new_confirmation_instructions_sent: Tu recipera un nove email con le ligamine de confirmation in alcun minutas! + title: Verifica tu cassa de ingresso + sign_in: + preamble_html: Accede con tu %{domain} credentiales. Si tu conto es hospite sur un differente servitor, tu non potera authenticar te ci. + title: Acceder a %{domain} + sign_up: + manual_review: Le inscriptiones sur %{domain} passa per revision manual de nostre moderatores. Pro adjutar nos a processar tu registration, scribe un poco re te mesme e perque tu vole un conto sur %{domain}. + preamble: Con un conto sur iste servitor de Mastodon, tu potera sequer ulle altere persona in rete, sin reguardo de ubi lor conto es hospite. + title: Lassa que nos te configura sur %{domain}. status: account_status: Stato del conto + confirming: Attendente esser completate email de confirmation. + functional: Tu conto es plenmente operative. + pending: Tu application es pendente de revision per nostre personal. Isto pote prender alcun tempore. Tu recipera un email si tu application es approbate. + redirecting_to: Tu conto es inactive perque illo es actualmente re-adressa a %{acct}. + self_destruct: Dum %{domain} va clauder, tu solo habera accesso limitate a tu conto. view_strikes: Examinar le admonitiones passate contra tu conto + too_fast: Formulario inviate troppo velocemente, retenta. use_security_key: Usar clave de securitate challenge: confirm: Continuar + hint_html: "Consilio: Nos non te demandara tu contrasigno ancora pro le proxime hora." invalid_password: Contrasigno non valide prompt: Confirma le contrasigno pro continuar + crypto: + errors: + invalid_key: non es un clave Ed25519 o Curve25519 valide + invalid_signature: non es un valide firma Ed25519 + date: + formats: + default: "%b %d, %Y" + with_month_name: "%B %d, %Y" datetime: distance_in_words: + about_x_hours: "%{count}h" + about_x_months: "%{count}me" + about_x_years: "%{count}a" + almost_x_years: "%{count}a" half_a_minute: Justo ora + less_than_x_minutes: "%{count} m" less_than_x_seconds: Justo ora over_x_years: "%{count}a" x_days: "%{count}d" x_minutes: "%{count} m" + x_months: "%{count}me" + x_seconds: "%{count}s" deletes: challenge_not_passed: Le informationes que tu ha inserite non era correcte confirm_password: Insere tu contrasigno actual pro verificar tu identitate @@ -1174,6 +1217,7 @@ ia: download: Discargar tu archivo hint_html: Tu pote requirer un archivo de tu messages e medios cargate. Le datos exportate sera in le formato ActivityPub, legibile per ulle software conforme. in_progress: Compilante tu archivo... + request: Pete tu archivo size: Dimension blocks: Tu ha blocate bookmarks: Marcapaginas @@ -1184,6 +1228,8 @@ ia: storage: Immagazinage de medios featured_tags: add_new: Adder nove + errors: + limit: Tu ha jam consiliate le maxime numero de hashtags filters: contexts: account: Profilos @@ -1196,17 +1242,33 @@ ia: keywords: Parolas clave statuses: Messages individual title: Modificar filtro + errors: + invalid_context: Nulle o non valide contexto supplite index: + contexts: Filtros in %{contexts} delete: Deler + empty: Tu non ha filtros. + expires_in: Expira in %{distance} + expires_on: Expira le %{date} + keywords: + one: "%{count} parola clave" + other: "%{count} parolas clave" statuses: one: "%{count} message" other: "%{count} messages" + statuses_long: + one: "%{count} singule message celate" + other: "%{count} singule messages celate" title: Filtros new: save: Salveguardar nove filtro title: Adder nove filtro statuses: + back_to_filter: Retro al filtro + batch: + remove: Remover ab filtro index: + hint: Iste filtro se applica pro seliger messages singule sin reguardo de altere criterios. Tu pote adder altere messages a iste filtro ab le interfacie web. title: Messages filtrate generic: all: Toto @@ -1215,16 +1277,27 @@ ia: confirm: Confirmar copy: Copiar delete: Deler + deselect: Deseliger toto none: Nemo order_by: Ordinar per save_changes: Salvar le cambios + select_all_matching_items: + one: Selige %{count} elemento concordante tu recerca. + other: Selige %{count} elementos concordante tu recerca. today: hodie + validation_errors: + one: Alco non es multo bon ancora! Controla le error infra + other: Alco non es multo bon ancora! Controla %{count} errores infra imports: errors: empty: File CSV vacue + incompatible_type: Incompatibile con le typo de importation seligite invalid_csv_file: 'File CSV non valide. Error: %{error}' + over_rows_processing_limit: contine plus que %{count} rangos too_large: Le file es troppo longe failures: Fallimentos + imported: Importate + mismatched_types_warning: Il appare que tu pote haber seligite le typo errate pro iste importation, controla duo vices. modes: overwrite_long: Reimplaciar registros actual con le noves overwrite_preambles: @@ -1278,6 +1351,8 @@ ia: max_uses: one: un uso other: "%{count} usos" + table: + expires_at: Expira title: Invitar personas login_activities: authentication_methods: @@ -1316,32 +1391,84 @@ ia: title: Nove requesta de sequimento mention: action: Responder + title: Nove mention poll: subject: Un inquesta de %{name} ha finite otp_authentication: enable: Activar + setup: Configurar pagination: next: Sequente + prev: Previe + truncate: "…" + polls: + errors: + already_voted: Tu jam ha votate in iste sondage + duplicate_options: contine elementos duplicate + duration_too_long: il es troppo lontan in le futuro + duration_too_short: il es troppo tosto + expired: Le sondage ha jam finite + invalid_choice: Le option de voto eligite non existe + over_character_limit: non pote esser plus longe que %{max} characteres cata un + self_vote: Tu non pote vota in tu proprie sondages + too_few_options: debe haber plus que un elemento + too_many_options: non pote continer plus que %{max} elementos preferences: other: Altere + posting_defaults: Publicationes predefinite public_timelines: Chronologias public privacy: privacy: Confidentialitate + reach: Portata search: Cercar + title: Confidentialitate e portata privacy_policy: title: Politica de confidentialitate + reactions: + errors: + limit_reached: Limite de reactiones differente attingite + unrecognized_emoji: non es un emoticone recognoscite + redirects: + prompt: Si tu te fide de iste ligamine, clicca lo pro continuar. + title: Tu va lassar %{instance}. relationships: activity: Activitate del conto + confirm_follow_selected_followers: Desira tu vermente remover le sequaces seligite? + confirm_remove_selected_followers: Desira tu vermente remover le sequaces seligite? + confirm_remove_selected_follows: Desira tu vermente remover le sequaces seligite? + dormant: Dormiente + follow_failure: Impossibile sequer alcun del contos seligite. + follow_selected_followers: Sequer le sequaces seligite + followers: Sequaces + following: Sequente invited: Invitate + last_active: Ultimo active most_recent: Plus recente moved: Movite mutual: Mutue primary: Primari + relationship: Relation + remove_selected_domains: Remover tote le sequaces ab le dominios seligite + remove_selected_followers: Remover le sequaces seligite + remove_selected_follows: Non plus sequer le usatores seligite status: Stato del conto + remote_follow: + missing_resource: Impossibile trovar le requirite re-adresse URL pro tu conto + reports: + errors: + invalid_rules: non referentia regulas valide rss: content_warning: 'Advertimento de contento:' descriptions: account: Messages public de @%{acct} + tag: 'Messages public plachettate #%{hashtag}' + scheduled_statuses: + over_daily_limit: Tu ha excedite le limite de %{limit} messages programmate pro hodie + over_total_limit: Tu ha excedite le limite de %{limit} messages programmate + too_soon: Le data programmate debe esser in le futuro + self_destruct: + lead_html: Infortunatemente, %{domain} va clauder permanentemente. Si tu habeva un conto illac, tu non potera continuar a usar lo, ma tu pote ancora peter un salveguarda de tu datos. + title: Iste servitor va clauder sessions: activity: Ultime activitate browser: Navigator @@ -1368,6 +1495,7 @@ ia: current_session: Session actual date: Data description: "%{browser} sur %{platform}" + explanation: Il ha navigatores del web actualmente connexe a tu conto Mastodon. ip: IP platforms: adobe_air: Adobe Air @@ -1383,11 +1511,16 @@ ia: windows: Windows windows_mobile: Windows Mobile windows_phone: Windows Phone + revoke: Revocar + revoke_success: Session revocate con successo title: Sessiones + view_authentication_history: Vider chronologia de authentication de tu conto settings: account: Conto account_settings: Parametros de conto + aliases: Aliases de conto appearance: Apparentia + authorized_apps: Apps autorisate delete: Deletion de conto development: Disveloppamento edit_profile: Modificar profilo @@ -1417,6 +1550,13 @@ ia: private_long: Solmente monstrar a sequitores public: Public statuses_cleanup: + keep_pinned_hint: Non dele alcuno de tu messages appunctate + keep_polls: Mantener sondages + keep_polls_hint: Non dele ulle de tu sondages + keep_self_bookmark: Mantener messages que tu marcava con marcapaginas + keep_self_bookmark_hint: Non dele tu proprie messages si tu los ha marcate con marcapaginas + keep_self_fav: Mantene messages que tu favoriva + keep_self_fav_hint: Non dele tu proprie messages si tu los ha favorite min_age: '1209600': 2 septimanas '15778476': 6 menses @@ -1426,6 +1566,7 @@ ia: '604800': 1 septimana '63113904': 2 annos '7889238': 3 menses + min_age_label: Limine de etate stream_entries: sensitive_content: Contento sensibile strikes: diff --git a/config/locales/simple_form.cy.yml b/config/locales/simple_form.cy.yml index 51a3aac273..5e8fd85293 100644 --- a/config/locales/simple_form.cy.yml +++ b/config/locales/simple_form.cy.yml @@ -77,11 +77,13 @@ cy: warn: Cuddiwch y cynnwys wedi'i hidlo y tu ôl i rybudd sy'n sôn am deitl yr hidlydd form_admin_settings: activity_api_enabled: Cyfrif o bostiadau a gyhoeddir yn lleol, defnyddwyr gweithredol, a chofrestriadau newydd mewn bwcedi wythnosol + app_icon: WEBP, PNG, GIF neu JPG. Yn diystyru'r eicon ap rhagosodedig ar ddyfeisiau symudol gydag eicon cyfaddas. backups_retention_period: Mae gan ddefnyddwyr y gallu i gynhyrchu archifau o'u postiadau i'w llwytho i lawr yn ddiweddarach. Pan gânt eu gosod i werth positif, bydd yr archifau hyn yn cael eu dileu'n awtomatig o'ch storfa ar ôl y nifer penodedig o ddyddiau. bootstrap_timeline_accounts: Bydd y cyfrifon hyn yn cael eu pinio i frig argymhellion dilynol defnyddwyr newydd. closed_registrations_message: Yn cael eu dangos pan fydd cofrestriadau wedi cau content_cache_retention_period: Bydd yr holl bostiadau gan weinyddion eraill (gan gynnwys hwb ac atebion) yn cael eu dileu ar ôl y nifer penodedig o ddyddiau, heb ystyried unrhyw ryngweithio defnyddiwr lleol â'r postiadau hynny. Mae hyn yn cynnwys postiadau lle mae defnyddiwr lleol wedi ei farcio fel nodau tudalen neu ffefrynnau. Bydd cyfeiriadau preifat rhwng defnyddwyr o wahanol achosion hefyd yn cael eu colli ac yn amhosibl eu hadfer. Mae'r defnydd o'r gosodiad hwn wedi'i fwriadu ar gyfer achosion pwrpas arbennig ac mae'n torri llawer o ddisgwyliadau defnyddwyr pan gaiff ei weithredu at ddibenion cyffredinol. custom_css: Gallwch gymhwyso arddulliau cyfaddas ar fersiwn gwe Mastodon. + favicon: WEBP, PNG, GIF neu JPG. Yn diystyru'r favicon Mastodon rhagosodedig gydag eicon cyfaddas. mascot: Yn diystyru'r darlun yn y rhyngwyneb gwe uwch. media_cache_retention_period: Mae ffeiliau cyfryngau o bostiadau a wneir gan ddefnyddwyr o bell yn cael eu storio ar eich gweinydd. Pan gaiff ei osod i werth positif, bydd y cyfryngau yn cael eu dileu ar ôl y nifer penodedig o ddyddiau. Os gofynnir am y data cyfryngau ar ôl iddo gael ei ddileu, caiff ei ail-lwytho i lawr, os yw'r cynnwys ffynhonnell yn dal i fod ar gael. Oherwydd cyfyngiadau ar ba mor aml y mae cardiau rhagolwg cyswllt yn pleidleisio i wefannau trydydd parti, argymhellir gosod y gwerth hwn i o leiaf 14 diwrnod, neu ni fydd cardiau rhagolwg cyswllt yn cael eu diweddaru ar alw cyn yr amser hwnnw. peers_api_enabled: Rhestr o enwau parth y mae'r gweinydd hwn wedi dod ar eu traws yn y ffediws. Nid oes unrhyw ddata wedi'i gynnwys yma ynghylch a ydych chi'n ffedereiddio â gweinydd penodol, dim ond bod eich gweinydd yn gwybod amdano. Defnyddir hwn gan wasanaethau sy'n casglu ystadegau ar ffedereiddio mewn ystyr cyffredinol. diff --git a/config/locales/simple_form.en-GB.yml b/config/locales/simple_form.en-GB.yml index f4668ccada..eaf0501a27 100644 --- a/config/locales/simple_form.en-GB.yml +++ b/config/locales/simple_form.en-GB.yml @@ -77,10 +77,15 @@ en-GB: warn: Hide the filtered content behind a warning mentioning the filter's title form_admin_settings: activity_api_enabled: Counts of locally published posts, active users, and new registrations in weekly buckets + app_icon: WEBP, PNG, GIF or JPG. Overrides the default app icon on mobile devices with a custom icon. + backups_retention_period: Users have the ability to generate archives of their posts to download later. When set to a positive value, these archives will be automatically deleted from your storage after the specified number of days. bootstrap_timeline_accounts: These accounts will be pinned to the top of new users' follow recommendations. closed_registrations_message: Displayed when sign-ups are closed + content_cache_retention_period: All posts from other servers (including boosts and replies) will be deleted after the specified number of days, without regard to any local user interaction with those posts. This includes posts where a local user has marked it as bookmarks or favorites. Private mentions between users from different instances will also be lost and impossible to restore. Use of this setting is intended for special purpose instances and breaks many user expectations when implemented for general purpose use. custom_css: You can apply custom styles on the web version of Mastodon. + favicon: WEBP, PNG, GIF or JPG. Overrides the default Mastodon favicon with a custom icon. mascot: Overrides the illustration in the advanced web interface. + media_cache_retention_period: Media files from posts made by remote users are cached on your server. When set to a positive value, media will be deleted after the specified number of days. If the media data is requested after it is deleted, it will be re-downloaded, if the source content is still available. Due to restrictions on how often link preview cards poll third-party sites, it is recommended to set this value to at least 14 days, or link preview cards will not be updated on demand before that time. peers_api_enabled: A list of domain names this server has encountered in the fediverse. No data is included here about whether you federate with a given server, just that your server knows about it. This is used by services that collect statistics on federation in a general sense. profile_directory: The profile directory lists all users who have opted-in to be discoverable. require_invite_text: When sign-ups require manual approval, make the “Why do you want to join?” text input mandatory rather than optional @@ -240,6 +245,7 @@ en-GB: backups_retention_period: User archive retention period bootstrap_timeline_accounts: Always recommend these accounts to new users closed_registrations_message: Custom message when sign-ups are not available + content_cache_retention_period: Remote content retention period custom_css: Custom CSS mascot: Custom mascot (legacy) media_cache_retention_period: Media cache retention period diff --git a/config/locales/sk.yml b/config/locales/sk.yml index 78e7bdb25e..f05887dc33 100644 --- a/config/locales/sk.yml +++ b/config/locales/sk.yml @@ -254,9 +254,12 @@ sk: destroy_status_html: "%{name} zmazal/a príspevok od %{target}" destroy_unavailable_domain_html: "%{name} znova spustil/a doručovanie pre doménu %{target}" destroy_user_role_html: "%{name} vymazal/a rolu pre %{target}" + enable_custom_emoji_html: "%{name} povolil/a emotikonu %{target}" enable_user_html: "%{name} povolil/a prihlásenie pre používateľa %{target}" memorialize_account_html: "%{name} zmenil/a účet %{target} na pamätnú stránku" + promote_user_html: "%{name} povýšil/a užívateľa %{target}" reject_appeal_html: "%{name} zamietol/la námietku moderovacieho rozhodnutia od %{target}" + reject_user_html: "%{name} odmietol/la registráciu od %{target}" remove_avatar_user_html: "%{name} vymazal/a %{target}/ov/in avatar" reopen_report_html: "%{name} znovu otvoril/a nahlásenie %{target}" resend_user_html: "%{name} znovu odoslal/a potvrdzovací email pre %{target}" @@ -266,7 +269,9 @@ sk: silence_account_html: "%{name} obmedzil/a účet %{target}" suspend_account_html: "%{name} zablokoval/a účet používateľa %{target}" unassigned_report_html: "%{name} odobral/a report od %{target}" + unblock_email_account_html: "%{name} odblokoval/a %{target}ovu/inu emailovú adresu" unsensitive_account_html: "%{name} odznačil/a médium od %{target} ako chúlostivé" + unsilence_account_html: "%{name} zrušil/a obmedzenie %{target}ovho/inho účtu" unsuspend_account_html: "%{name} spojazdnil/a účet %{target}" update_announcement_html: "%{name} aktualizoval/a oboznámenie %{target}" update_custom_emoji_html: "%{name} aktualizoval/a emotikonu %{target}" @@ -529,6 +534,9 @@ sk: actions: suspend_description_html: Tento účet a všetok jeho obsah bude nedostupný a nakoniec zmazaný, interaktovať s ním bude nemožné. Zvrátiteľné v rámci 30 dní. Uzatvára všetky hlásenia voči tomuto účtu. add_to_report: Pridaj viac do hlásenia + already_suspended_badges: + local: Na tomto serveri už vylúčený/á + remote: Už vylúčený/á na ich serveri are_you_sure: Si si istý/á? assign_to_self: Priraď sebe assigned: Priradený moderátor @@ -538,6 +546,7 @@ sk: comment: none: Žiadne confirm: Potvrď + confirm_action: Potvrď moderovací úkon proti @%{acct} created_at: Nahlásené delete_and_resolve: Vymaž príspevky forwarded: Preposlané @@ -592,8 +601,14 @@ sk: delete: Vymaž edit: Uprav postavenie %{name} everyone: Východzie oprávnenia + permissions_count: + few: "%{count} povolení" + many: "%{count} povolení" + one: "%{count} povolenie" + other: "%{count} povolenia" privileges: administrator: Správca + administrator_description: Užívatelia s týmto povolením, obídu všetky povolenia delete_user_data: Vymaž užívateľské dáta invite_users: Pozvi užívateľov manage_announcements: Spravuj oboznámenia diff --git a/config/navigation.rb b/config/navigation.rb index de5f28ce96..4d41b357ce 100644 --- a/config/navigation.rb +++ b/config/navigation.rb @@ -42,7 +42,7 @@ SimpleNavigation::Configuration.run do |navigation| end n.item :invites, safe_join([fa_icon('user-plus fw'), t('invites.title')]), invites_path, if: -> { current_user.can?(:invite_users) && current_user.functional? && !self_destruct } - n.item :development, safe_join([fa_icon('code fw'), t('settings.development')]), settings_applications_path, if: -> { current_user.functional? && !self_destruct } + n.item :development, safe_join([fa_icon('code fw'), t('settings.development')]), settings_applications_path, highlights_on: %r{/settings/applications}, if: -> { current_user.functional? && !self_destruct } n.item :trends, safe_join([fa_icon('fire fw'), t('admin.trends.title')]), admin_trends_statuses_path, if: -> { current_user.can?(:manage_taxonomies) && !self_destruct } do |s| s.item :statuses, safe_join([fa_icon('comments-o fw'), t('admin.trends.statuses.title')]), admin_trends_statuses_path, highlights_on: %r{/admin/trends/statuses} @@ -51,8 +51,8 @@ SimpleNavigation::Configuration.run do |navigation| end n.item :moderation, safe_join([fa_icon('gavel fw'), t('moderation.title')]), nil, if: -> { current_user.can?(:manage_reports, :view_audit_log, :manage_users, :manage_invites, :manage_taxonomies, :manage_federation, :manage_blocks) && !self_destruct } do |s| - s.item :reports, safe_join([fa_icon('flag fw'), t('admin.reports.title')]), admin_reports_path, highlights_on: %r{/admin/reports}, if: -> { current_user.can?(:manage_reports) } - s.item :accounts, safe_join([fa_icon('users fw'), t('admin.accounts.title')]), admin_accounts_path(origin: 'local'), highlights_on: %r{/admin/accounts|/admin/pending_accounts|/admin/disputes|/admin/users}, if: -> { current_user.can?(:manage_users) } + s.item :reports, safe_join([fa_icon('flag fw'), t('admin.reports.title')]), admin_reports_path, highlights_on: %r{/admin/reports|admin/report_notes}, if: -> { current_user.can?(:manage_reports) } + s.item :accounts, safe_join([fa_icon('users fw'), t('admin.accounts.title')]), admin_accounts_path(origin: 'local'), highlights_on: %r{/admin/accounts|admin/account_moderation_notes|/admin/pending_accounts|/admin/disputes|/admin/users}, if: -> { current_user.can?(:manage_users) } s.item :invites, safe_join([fa_icon('user-plus fw'), t('admin.invites.title')]), admin_invites_path, if: -> { current_user.can?(:manage_invites) } s.item :follow_recommendations, safe_join([fa_icon('user-plus fw'), t('admin.follow_recommendations.title')]), admin_follow_recommendations_path, highlights_on: %r{/admin/follow_recommendations}, if: -> { current_user.can?(:manage_taxonomies) } s.item :instances, safe_join([fa_icon('cloud fw'), t('admin.instances.title')]), admin_instances_path(limited: limited_federation_mode? ? nil : '1'), highlights_on: %r{/admin/instances|/admin/domain_blocks|/admin/domain_allows}, if: -> { current_user.can?(:manage_federation) } diff --git a/lib/mastodon/cli/media.rb b/lib/mastodon/cli/media.rb index e26b4f24af..509d11a819 100644 --- a/lib/mastodon/cli/media.rb +++ b/lib/mastodon/cli/media.rb @@ -128,7 +128,7 @@ module Mastodon::CLI model_name = path_segments.first.classify attachment_name = path_segments[1].singularize - record_id = path_segments[2..-2].join.to_i + record_id = path_segments[2...-2].join.to_i file_name = path_segments.last record = record_map.dig(model_name, record_id) attachment = record&.public_send(attachment_name) @@ -172,7 +172,7 @@ module Mastodon::CLI end model_name = path_segments.first.classify - record_id = path_segments[2..-2].join.to_i + record_id = path_segments[2...-2].join.to_i attachment_name = path_segments[1].singularize file_name = path_segments.last @@ -297,7 +297,7 @@ module Mastodon::CLI fail_with_message 'Not a media URL' unless VALID_PATH_SEGMENTS_SIZE.include?(path_segments.size) model_name = path_segments.first.classify - record_id = path_segments[2..-2].join.to_i + record_id = path_segments[2...-2].join.to_i fail_with_message "Cannot find corresponding model: #{model_name}" unless PRELOAD_MODEL_WHITELIST.include?(model_name) @@ -353,7 +353,7 @@ module Mastodon::CLI next unless VALID_PATH_SEGMENTS_SIZE.include?(segments.size) model_name = segments.first.classify - record_id = segments[2..-2].join.to_i + record_id = segments[2...-2].join.to_i next unless PRELOAD_MODEL_WHITELIST.include?(model_name) diff --git a/spec/controllers/admin/account_moderation_notes_controller_spec.rb b/spec/controllers/admin/account_moderation_notes_controller_spec.rb index 8d24a7af37..5ea546f418 100644 --- a/spec/controllers/admin/account_moderation_notes_controller_spec.rb +++ b/spec/controllers/admin/account_moderation_notes_controller_spec.rb @@ -24,10 +24,19 @@ RSpec.describe Admin::AccountModerationNotesController do end end - context 'when parameters are invalid' do + context 'when the content is too short' do let(:params) { { account_moderation_note: { target_account_id: target_account.id, content: '' } } } - it 'falls to create a note' do + it 'fails to create a note' do + expect { subject }.to_not change(AccountModerationNote, :count) + expect(response).to render_template 'admin/accounts/show' + end + end + + context 'when the content is too long' do + let(:params) { { account_moderation_note: { target_account_id: target_account.id, content: 'test' * AccountModerationNote::CONTENT_SIZE_LIMIT } } } + + it 'fails to create a note' do expect { subject }.to_not change(AccountModerationNote, :count) expect(response).to render_template 'admin/accounts/show' end diff --git a/spec/controllers/admin/report_notes_controller_spec.rb b/spec/controllers/admin/report_notes_controller_spec.rb index 4ddf4a4e24..8d5b5c7aec 100644 --- a/spec/controllers/admin/report_notes_controller_spec.rb +++ b/spec/controllers/admin/report_notes_controller_spec.rb @@ -22,7 +22,7 @@ describe Admin::ReportNotesController do let(:account_id) { nil } context 'when create_and_resolve flag is on' do - let(:params) { { report_note: { content: 'test content', report_id: report.id }, create_and_resolve: nil } } + let(:params) { { report_note: { report_id: report.id, content: 'test content' }, create_and_resolve: nil } } it 'creates a report note and resolves report' do expect { subject }.to change(ReportNote, :count).by(1) @@ -32,7 +32,7 @@ describe Admin::ReportNotesController do end context 'when create_and_resolve flag is false' do - let(:params) { { report_note: { content: 'test content', report_id: report.id } } } + let(:params) { { report_note: { report_id: report.id, content: 'test content' } } } it 'creates a report note and does not resolve report' do expect { subject }.to change(ReportNote, :count).by(1) @@ -47,7 +47,7 @@ describe Admin::ReportNotesController do let(:account_id) { user.account.id } context 'when create_and_unresolve flag is on' do - let(:params) { { report_note: { content: 'test content', report_id: report.id }, create_and_unresolve: nil } } + let(:params) { { report_note: { report_id: report.id, content: 'test content' }, create_and_unresolve: nil } } it 'creates a report note and unresolves report' do expect { subject }.to change(ReportNote, :count).by(1) @@ -57,7 +57,7 @@ describe Admin::ReportNotesController do end context 'when create_and_unresolve flag is false' do - let(:params) { { report_note: { content: 'test content', report_id: report.id } } } + let(:params) { { report_note: { report_id: report.id, content: 'test content' } } } it 'creates a report note and does not unresolve report' do expect { subject }.to change(ReportNote, :count).by(1) @@ -68,12 +68,24 @@ describe Admin::ReportNotesController do end end - context 'when parameter is invalid' do - let(:params) { { report_note: { content: '', report_id: report.id } } } + context 'when content is too short' do + let(:params) { { report_note: { report_id: report.id, content: '' } } } let(:action_taken) { nil } let(:account_id) { nil } it 'renders admin/reports/show' do + expect { subject }.to_not change(ReportNote, :count) + expect(subject).to render_template 'admin/reports/show' + end + end + + context 'when content is too long' do + let(:params) { { report_note: { report_id: report.id, content: 'test' * ReportNote::CONTENT_SIZE_LIMIT } } } + let(:action_taken) { nil } + let(:account_id) { nil } + + it 'renders admin/reports/show' do + expect { subject }.to_not change(ReportNote, :count) expect(subject).to render_template 'admin/reports/show' end end diff --git a/spec/controllers/concerns/cache_concern_spec.rb b/spec/controllers/concerns/preloading_concern_spec.rb similarity index 79% rename from spec/controllers/concerns/cache_concern_spec.rb rename to spec/controllers/concerns/preloading_concern_spec.rb index fffd2b266e..795afbc45e 100644 --- a/spec/controllers/concerns/cache_concern_spec.rb +++ b/spec/controllers/concerns/preloading_concern_spec.rb @@ -2,20 +2,20 @@ require 'rails_helper' -RSpec.describe CacheConcern do +RSpec.describe PreloadingConcern do controller(ApplicationController) do - include CacheConcern + include PreloadingConcern def empty_array - render plain: cache_collection([], Status).size + render plain: preload_collection([], Status).size end def empty_relation - render plain: cache_collection(Status.none, Status).size + render plain: preload_collection(Status.none, Status).size end def account_statuses_favourites - render plain: cache_collection(Status.where(account_id: params[:id]), Status).map(&:favourites_count) + render plain: preload_collection(Status.where(account_id: params[:id]), Status).map(&:favourites_count) end end @@ -27,7 +27,7 @@ RSpec.describe CacheConcern do end end - describe '#cache_collection' do + describe '#preload_collection' do context 'when given an empty array' do it 'returns an empty array' do get :empty_array diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 0c378a4bf2..2a472d75a6 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -288,26 +288,31 @@ describe ApplicationHelper do end end - describe '#site_icon_path' do + describe 'favicon' do context 'when an icon exists' do let!(:favicon) { Fabricate(:site_upload, var: 'favicon') } + let!(:app_icon) { Fabricate(:site_upload, var: 'app_icon') } it 'returns the URL of the icon' do - expect(helper.site_icon_path('favicon')).to eq(favicon.file.url('48')) + expect(helper.favicon_path).to eq(favicon.file.url('48')) + expect(helper.app_icon_path).to eq(app_icon.file.url('48')) end it 'returns the URL of the icon with size parameter' do - expect(helper.site_icon_path('favicon', 16)).to eq(favicon.file.url('16')) + expect(helper.favicon_path(16)).to eq(favicon.file.url('16')) + expect(helper.app_icon_path(16)).to eq(app_icon.file.url('16')) end end context 'when an icon does not exist' do it 'returns nil' do - expect(helper.site_icon_path('favicon')).to be_nil + expect(helper.favicon_path).to be_nil + expect(helper.app_icon_path).to be_nil end it 'returns nil with size parameter' do - expect(helper.site_icon_path('favicon', 16)).to be_nil + expect(helper.favicon_path(16)).to be_nil + expect(helper.app_icon_path(16)).to be_nil end end end diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index d8eb561d42..38aa711089 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -2,6 +2,31 @@ ENV['RAILS_ENV'] ||= 'test' +unless ENV['DISABLE_SIMPLECOV'] == 'true' + require 'simplecov' + + SimpleCov.start 'rails' do + if ENV['CI'] + require 'simplecov-lcov' + formatter SimpleCov::Formatter::LcovFormatter + formatter.config.report_with_single_file = true + else + formatter SimpleCov::Formatter::HTMLFormatter + end + + enable_coverage :branch + + add_filter 'lib/linter' + + add_group 'Libraries', 'lib' + add_group 'Policies', 'app/policies' + add_group 'Presenters', 'app/presenters' + add_group 'Serializers', 'app/serializers' + add_group 'Services', 'app/services' + add_group 'Validators', 'app/validators' + end +end + # This needs to be defined before Rails is initialized STREAMING_PORT = ENV.fetch('TEST_STREAMING_PORT', '4020') ENV['STREAMING_API_BASE_URL'] = "http://localhost:#{STREAMING_PORT}" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 8a01792a19..1f9cc40f12 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,9 +1,5 @@ # frozen_string_literal: true -unless ENV['DISABLE_SIMPLECOV'] == 'true' - require 'simplecov' # Configuration details loaded from .simplecov -end - RSpec.configure do |config| config.example_status_persistence_file_path = 'tmp/rspec/examples.txt' config.expect_with :rspec do |expectations| diff --git a/spec/workers/scheduler/user_cleanup_scheduler_spec.rb b/spec/workers/scheduler/user_cleanup_scheduler_spec.rb index 8fda246ba8..c3940901d4 100644 --- a/spec/workers/scheduler/user_cleanup_scheduler_spec.rb +++ b/spec/workers/scheduler/user_cleanup_scheduler_spec.rb @@ -14,7 +14,7 @@ describe Scheduler::UserCleanupScheduler do before do # Need to update the already-existing users because their initialization overrides confirmation_sent_at new_unconfirmed_user.update!(confirmed_at: nil, confirmation_sent_at: Time.now.utc) - old_unconfirmed_user.update!(confirmed_at: nil, confirmation_sent_at: 1.week.ago) + old_unconfirmed_user.update!(confirmed_at: nil, confirmation_sent_at: 10.days.ago) confirmed_user.update!(confirmed_at: 1.day.ago) end diff --git a/yarn.lock b/yarn.lock index 8338e3855a..9247666a48 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1617,15 +1617,15 @@ __metadata: languageName: node linkType: hard -"@csstools/postcss-cascade-layers@npm:^4.0.5": - version: 4.0.5 - resolution: "@csstools/postcss-cascade-layers@npm:4.0.5" +"@csstools/postcss-cascade-layers@npm:^4.0.6": + version: 4.0.6 + resolution: "@csstools/postcss-cascade-layers@npm:4.0.6" dependencies: - "@csstools/selector-specificity": "npm:^3.1.0" + "@csstools/selector-specificity": "npm:^3.1.1" postcss-selector-parser: "npm:^6.0.13" peerDependencies: postcss: ^8.4 - checksum: 10c0/2b6dd33b51df349dd89b12ebe3240d65accb0ba03e40288a72e26cf2307a7bdd742c42d9ff7a3f886cab19b2f8813978075f6ee61a985b0b7ceac7e2cbb29e04 + checksum: 10c0/134019e9b3f71de39034658e2a284f549883745a309f774d8d272871f9e65680e0981c893766537a8a56ed7f41dba2d0f9fc3cb4fa4057c227bc193976a2ec79 languageName: node linkType: hard @@ -1749,15 +1749,15 @@ __metadata: languageName: node linkType: hard -"@csstools/postcss-is-pseudo-class@npm:^4.0.7": - version: 4.0.7 - resolution: "@csstools/postcss-is-pseudo-class@npm:4.0.7" +"@csstools/postcss-is-pseudo-class@npm:^4.0.8": + version: 4.0.8 + resolution: "@csstools/postcss-is-pseudo-class@npm:4.0.8" dependencies: - "@csstools/selector-specificity": "npm:^3.1.0" + "@csstools/selector-specificity": "npm:^3.1.1" postcss-selector-parser: "npm:^6.0.13" peerDependencies: postcss: ^8.4 - checksum: 10c0/43668987df4608f822dbc323d3ac567fa7c192235b55933fd5d1855977ead80184512eb64a3f45a020fdd93711952ba8e9f9a280f4e981625b68a9ff074f9a01 + checksum: 10c0/82f191571c3e0973354a54ef15feeb17f9408b4abbefad19fc0f087683b1212fc854cdf09a47324267dd47be4c5cb47d63b8d083695a67c3f8f3e53df3d561f6 languageName: node linkType: hard @@ -1983,12 +1983,12 @@ __metadata: languageName: node linkType: hard -"@csstools/selector-specificity@npm:^3.0.3, @csstools/selector-specificity@npm:^3.1.0": - version: 3.1.0 - resolution: "@csstools/selector-specificity@npm:3.1.0" +"@csstools/selector-specificity@npm:^3.0.3, @csstools/selector-specificity@npm:^3.1.1": + version: 3.1.1 + resolution: "@csstools/selector-specificity@npm:3.1.1" peerDependencies: postcss-selector-parser: ^6.0.13 - checksum: 10c0/7f77f8377b637dcca7f7a9d6ace3329cf60f02cbd75f14241de30b1f5d00c961ec167572bc93517cdb2f106405a91119f026389a0f96dabae8dd67d1c7710e60 + checksum: 10c0/1d4a3f8015904d6aeb3203afe0e1f6db09b191d9c1557520e3e960c9204ad852df9db4cbde848643f78a26f6ea09101b4e528dbb9193052db28258dbcc8a6e1d languageName: node linkType: hard @@ -3053,8 +3053,8 @@ __metadata: linkType: hard "@reduxjs/toolkit@npm:^2.0.1": - version: 2.2.4 - resolution: "@reduxjs/toolkit@npm:2.2.4" + version: 2.2.5 + resolution: "@reduxjs/toolkit@npm:2.2.5" dependencies: immer: "npm:^10.0.3" redux: "npm:^5.0.1" @@ -3068,7 +3068,7 @@ __metadata: optional: true react-redux: optional: true - checksum: 10c0/fdbf510210a5aa4864432397e1a9469367e297cd1d9c09a82e68638df7555672c2f8511fe76f933b00efbbb233c534831591772a44e8c41233e34f3cd0f54569 + checksum: 10c0/be0593bf26852482fb8716b9248531466c6e8782a3114b823ae680fce90267d8c5512a3231cfecc30b17eff81a4604112772b49ad7ca6a3366ddd4f2a838e53c languageName: node linkType: hard @@ -6391,9 +6391,9 @@ __metadata: linkType: hard "core-js@npm:^3.30.2": - version: 3.37.0 - resolution: "core-js@npm:3.37.0" - checksum: 10c0/7e00331f346318ca3f595c08ce9e74ddae744715aef137486c1399163afd79792fb94c3161280863adfdc3e30f8026912d56bd3036f93cacfc689d33e185f2ee + version: 3.37.1 + resolution: "core-js@npm:3.37.1" + checksum: 10c0/440eb51a7a39128a320225fe349f870a3641b96c9ecd26470227db730ef8c161ea298eaea621db66ec0ff622a85299efb4e23afebf889c0a1748616102307675 languageName: node linkType: hard @@ -6587,16 +6587,16 @@ __metadata: languageName: node linkType: hard -"css-has-pseudo@npm:^6.0.4": - version: 6.0.4 - resolution: "css-has-pseudo@npm:6.0.4" +"css-has-pseudo@npm:^6.0.5": + version: 6.0.5 + resolution: "css-has-pseudo@npm:6.0.5" dependencies: - "@csstools/selector-specificity": "npm:^3.1.0" + "@csstools/selector-specificity": "npm:^3.1.1" postcss-selector-parser: "npm:^6.0.13" postcss-value-parser: "npm:^4.2.0" peerDependencies: postcss: ^8.4 - checksum: 10c0/e9d440de483e15092ebaadb483502243f43e0457d4214c8012ebdba7a959e74d40714254bf97247780e65735512f248a55feda0b3975d9a5eaea9c746f7518f0 + checksum: 10c0/946930b7e699d6dbcb8426ebcd593228ee0e2143a148fb2399111ea4c9ed8d6eb3447e944251f1be44ae987d5ab16e450b0b006ca197f318c2a3760ba431fbb9 languageName: node linkType: hard @@ -13066,13 +13066,6 @@ __metadata: languageName: node linkType: hard -"pino-std-serializers@npm:^6.0.0": - version: 6.2.2 - resolution: "pino-std-serializers@npm:6.2.2" - checksum: 10c0/8f1c7f0f0d8f91e6c6b5b2a6bfb48f06441abeb85f1c2288319f736f9c6d814fbeebe928d2314efc2ba6018fa7db9357a105eca9fc99fc1f28945a8a8b28d3d5 - languageName: node - linkType: hard - "pino-std-serializers@npm:^7.0.0": version: 7.0.0 resolution: "pino-std-serializers@npm:7.0.0" @@ -13081,23 +13074,23 @@ __metadata: linkType: hard "pino@npm:^9.0.0": - version: 9.0.0 - resolution: "pino@npm:9.0.0" + version: 9.1.0 + resolution: "pino@npm:9.1.0" dependencies: atomic-sleep: "npm:^1.0.0" fast-redact: "npm:^3.1.1" on-exit-leak-free: "npm:^2.1.0" pino-abstract-transport: "npm:^1.2.0" - pino-std-serializers: "npm:^6.0.0" + pino-std-serializers: "npm:^7.0.0" process-warning: "npm:^3.0.0" quick-format-unescaped: "npm:^4.0.3" real-require: "npm:^0.2.0" safe-stable-stringify: "npm:^2.3.1" - sonic-boom: "npm:^3.7.0" - thread-stream: "npm:^2.6.0" + sonic-boom: "npm:^4.0.1" + thread-stream: "npm:^3.0.0" bin: pino: bin.js - checksum: 10c0/10ef10aee0cf80af8ed83468cff2e29d642b6794b53cf641e1abcaf9e9958d8bcbc6e09d62757054aef3b4415c45d66a5018da11d43b81a23ba299ef5dc4e8b1 + checksum: 10c0/d060530ae2e4e8f21d04bb0f44f009f94d207d7f4337f508f618416514214ddaf1b29f8c5c265153a19ce3b6480b451461f40020f916ace9d53a5aa07624b79c languageName: node linkType: hard @@ -13572,16 +13565,16 @@ __metadata: languageName: node linkType: hard -"postcss-nesting@npm:^12.1.3": - version: 12.1.3 - resolution: "postcss-nesting@npm:12.1.3" +"postcss-nesting@npm:^12.1.4": + version: 12.1.4 + resolution: "postcss-nesting@npm:12.1.4" dependencies: "@csstools/selector-resolve-nested": "npm:^1.1.0" - "@csstools/selector-specificity": "npm:^3.1.0" + "@csstools/selector-specificity": "npm:^3.1.1" postcss-selector-parser: "npm:^6.0.13" peerDependencies: postcss: ^8.4 - checksum: 10c0/6b2d3a4823e85592965c6c11f749c5357703256e7334388147d6a3bb72a3abbe47789afaa8535bdd7a9bd6d0099eb12ffec6c154050d8e8b8286b1adbed5b397 + checksum: 10c0/b3408de4c04b58a88a56fa81aeff59b12615c78d4f5a57e09c1ee47e74cff51f8c9cad1684da0059067303cf65b4b688f85f0c5ca8d54af8c4ab998f727ab9fd languageName: node linkType: hard @@ -13736,10 +13729,10 @@ __metadata: linkType: hard "postcss-preset-env@npm:^9.5.2": - version: 9.5.12 - resolution: "postcss-preset-env@npm:9.5.12" + version: 9.5.13 + resolution: "postcss-preset-env@npm:9.5.13" dependencies: - "@csstools/postcss-cascade-layers": "npm:^4.0.5" + "@csstools/postcss-cascade-layers": "npm:^4.0.6" "@csstools/postcss-color-function": "npm:^3.0.16" "@csstools/postcss-color-mix-function": "npm:^2.0.16" "@csstools/postcss-exponential-functions": "npm:^1.0.7" @@ -13749,7 +13742,7 @@ __metadata: "@csstools/postcss-hwb-function": "npm:^3.0.15" "@csstools/postcss-ic-unit": "npm:^3.0.6" "@csstools/postcss-initial": "npm:^1.0.1" - "@csstools/postcss-is-pseudo-class": "npm:^4.0.7" + "@csstools/postcss-is-pseudo-class": "npm:^4.0.8" "@csstools/postcss-light-dark-function": "npm:^1.0.5" "@csstools/postcss-logical-float-and-clear": "npm:^2.0.1" "@csstools/postcss-logical-overflow": "npm:^1.0.1" @@ -13771,7 +13764,7 @@ __metadata: autoprefixer: "npm:^10.4.19" browserslist: "npm:^4.22.3" css-blank-pseudo: "npm:^6.0.2" - css-has-pseudo: "npm:^6.0.4" + css-has-pseudo: "npm:^6.0.5" css-prefers-color-scheme: "npm:^9.0.1" cssdb: "npm:^8.0.0" postcss-attribute-case-insensitive: "npm:^6.0.3" @@ -13791,7 +13784,7 @@ __metadata: postcss-image-set-function: "npm:^6.0.3" postcss-lab-function: "npm:^6.0.16" postcss-logical: "npm:^7.0.1" - postcss-nesting: "npm:^12.1.3" + postcss-nesting: "npm:^12.1.4" postcss-opacity-percentage: "npm:^2.0.0" postcss-overflow-shorthand: "npm:^5.0.1" postcss-page-break: "npm:^3.0.4" @@ -13801,7 +13794,7 @@ __metadata: postcss-selector-not: "npm:^7.0.2" peerDependencies: postcss: ^8.4 - checksum: 10c0/3e0276b2061baa396547f9c0090fcb0c6149d3735c7aefa99a8e520701aae0b7265578b59d5e4efa9f5e61659c161e39590a5d63bac49469b99da1c549b63231 + checksum: 10c0/5bbb6e87b1b3acc816ef445836f85df5f50ac96bdc3d571952a83794c80863c652d27ab14c66f6b88f86f5664119d49b357e4184162022cc3436676f3fbe833b languageName: node linkType: hard @@ -15846,7 +15839,7 @@ __metadata: languageName: node linkType: hard -"sonic-boom@npm:^3.0.0, sonic-boom@npm:^3.7.0": +"sonic-boom@npm:^3.0.0": version: 3.7.0 resolution: "sonic-boom@npm:3.7.0" dependencies: @@ -15855,6 +15848,15 @@ __metadata: languageName: node linkType: hard +"sonic-boom@npm:^4.0.1": + version: 4.0.1 + resolution: "sonic-boom@npm:4.0.1" + dependencies: + atomic-sleep: "npm:^1.0.0" + checksum: 10c0/7b467f2bc8af7ff60bf210382f21c59728cc4b769af9b62c31dd88723f5cc472752d2320736cc366acc7c765ddd5bec3072c033b0faf249923f576a7453ba9d3 + languageName: node + linkType: hard + "source-list-map@npm:^2.0.0": version: 2.0.1 resolution: "source-list-map@npm:2.0.1" @@ -16800,12 +16802,12 @@ __metadata: languageName: node linkType: hard -"thread-stream@npm:^2.6.0": - version: 2.6.0 - resolution: "thread-stream@npm:2.6.0" +"thread-stream@npm:^3.0.0": + version: 3.0.0 + resolution: "thread-stream@npm:3.0.0" dependencies: real-require: "npm:^0.2.0" - checksum: 10c0/276e2545b33273232eb2c22c53fc11844951c1322f8a78c522477af716ebcfe0d106ccf1fbc455f6e48d928e93231fed6377ce91fdcb3885086e8ffa1f011c88 + checksum: 10c0/1f4da5a8c93b170cdc7c1ad774af49bb2af43f73cfd9a7f8fb02b766255b483eb6d0b734502c880397baa95c0ce3490088b9a487cff32d4e481aab6fe76560f5 languageName: node linkType: hard