diff --git a/.dockerignore b/.dockerignore index fedbea236df0fb..41da718049b691 100644 --- a/.dockerignore +++ b/.dockerignore @@ -8,6 +8,7 @@ public/system public/assets public/packs +public/packs-test node_modules neo4j vendor/bundle diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 566663f0052632..27c0d10ba84016 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -1,6 +1,6 @@ # This configuration was generated by # `rubocop --auto-gen-config --auto-gen-only-exclude --no-exclude-limit --no-offense-counts --no-auto-gen-timestamp` -# using RuboCop version 1.57.1. +# using RuboCop version 1.57.2. # The point is for the user to remove these configuration records # one by one as the offenses are removed from the code base. # Note that changes in the inspected code, or installation of new @@ -20,25 +20,10 @@ Layout/LineLength: Exclude: - 'app/models/account.rb' -# Configuration parameters: AllowComments, AllowEmptyLambdas. -Lint/EmptyBlock: - Exclude: - - 'spec/controllers/api/v2/search_controller_spec.rb' - - 'spec/fabricators/access_token_fabricator.rb' - - 'spec/fabricators/conversation_fabricator.rb' - - 'spec/fabricators/system_key_fabricator.rb' - - 'spec/lib/activitypub/adapter_spec.rb' - - 'spec/models/user_role_spec.rb' - Lint/NonLocalExitFromIterator: Exclude: - 'app/helpers/jsonld_helper.rb' -# This cop supports unsafe autocorrection (--autocorrect-all). -Lint/OrAssignmentToConstant: - Exclude: - - 'lib/sanitize_ext/sanitize_config.rb' - # This cop supports safe autocorrection (--autocorrect). # Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments. Lint/UnusedBlockArgument: @@ -65,19 +50,11 @@ Metrics/CyclomaticComplexity: Metrics/PerceivedComplexity: Max: 27 -Performance/MapMethodChain: - Exclude: - - 'app/models/feed.rb' - - 'lib/mastodon/cli/maintenance.rb' - - 'spec/services/bulk_import_service_spec.rb' - - 'spec/services/import_service_spec.rb' - RSpec/AnyInstance: Exclude: - 'spec/controllers/activitypub/inboxes_controller_spec.rb' - 'spec/controllers/admin/accounts_controller_spec.rb' - 'spec/controllers/admin/resets_controller_spec.rb' - - 'spec/controllers/admin/settings/branding_controller_spec.rb' - 'spec/controllers/auth/sessions_controller_spec.rb' - 'spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb' - 'spec/controllers/settings/two_factor_authentication/recovery_codes_controller_spec.rb' @@ -94,20 +71,6 @@ RSpec/AnyInstance: RSpec/ExampleLength: Max: 22 -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: EnforcedStyle. -# SupportedStyles: implicit, each, example -RSpec/HookArgument: - Exclude: - - 'spec/controllers/api/v1/streaming_controller_spec.rb' - - 'spec/controllers/well_known/webfinger_controller_spec.rb' - - 'spec/helpers/instance_helper_spec.rb' - - 'spec/models/user_spec.rb' - - 'spec/rails_helper.rb' - - 'spec/serializers/activitypub/note_serializer_spec.rb' - - 'spec/serializers/activitypub/update_poll_serializer_spec.rb' - - 'spec/services/import_service_spec.rb' - # Configuration parameters: AssignmentOnly. RSpec/InstanceVariable: Exclude: @@ -176,24 +139,6 @@ RSpec/MessageChain: - 'spec/models/session_activation_spec.rb' - 'spec/models/setting_spec.rb' -# Configuration parameters: EnforcedStyle. -# SupportedStyles: have_received, receive -RSpec/MessageSpies: - Exclude: - - 'spec/controllers/admin/accounts_controller_spec.rb' - - 'spec/helpers/admin/account_moderation_notes_helper_spec.rb' - - 'spec/lib/webfinger_resource_spec.rb' - - 'spec/models/admin/account_action_spec.rb' - - 'spec/models/concerns/remotable_spec.rb' - - 'spec/models/follow_request_spec.rb' - - 'spec/models/identity_spec.rb' - - 'spec/models/session_activation_spec.rb' - - 'spec/models/setting_spec.rb' - - 'spec/services/activitypub/fetch_replies_service_spec.rb' - - 'spec/services/activitypub/process_collection_service_spec.rb' - - 'spec/spec_helper.rb' - - 'spec/validators/status_length_validator_spec.rb' - RSpec/MultipleExpectations: Max: 8 @@ -210,13 +155,6 @@ Rails/ApplicationController: Exclude: - 'app/controllers/health_controller.rb' -# This cop supports safe autocorrection (--autocorrect). -# Configuration parameters: Severity. -Rails/DuplicateAssociation: - Exclude: - - 'app/serializers/activitypub/collection_serializer.rb' - - 'app/serializers/activitypub/note_serializer.rb' - # Configuration parameters: Include. # Include: app/models/**/*.rb Rails/HasAndBelongsToMany: @@ -331,7 +269,6 @@ Rails/SkipsModelValidations: - 'db/post_migrate/20221101190723_backfill_admin_action_logs.rb' - 'db/post_migrate/20221206114142_backfill_admin_action_logs_again.rb' - 'lib/mastodon/cli/accounts.rb' - - 'lib/mastodon/cli/main.rb' - 'lib/mastodon/cli/maintenance.rb' - 'spec/lib/activitypub/activity/follow_spec.rb' - 'spec/services/follow_service_spec.rb' @@ -424,7 +361,6 @@ Style/FetchEnvVar: - 'config/initializers/3_omniauth.rb' - 'config/initializers/blacklists.rb' - 'config/initializers/cache_buster.rb' - - 'config/initializers/content_security_policy.rb' - 'config/initializers/devise.rb' - 'config/initializers/paperclip.rb' - 'config/initializers/vapid.rb' diff --git a/Gemfile b/Gemfile index d75288d74c982a..1d5663e624e27b 100644 --- a/Gemfile +++ b/Gemfile @@ -88,7 +88,7 @@ gem 'simple-navigation', '~> 4.4' gem 'simple_form', '~> 5.2' gem 'sprockets-rails', '~> 3.4', require: 'sprockets/railtie' gem 'stoplight', '~> 3.0.1' -gem 'strong_migrations', '1.3.0' +gem 'strong_migrations', '1.6.4' gem 'tty-prompt', '~> 0.23', require: false gem 'twitter-text', '~> 3.1.0' gem 'tzinfo-data', '~> 1.2023' @@ -196,7 +196,7 @@ gem 'connection_pool', require: false gem 'xorcist', '~> 1.1' gem 'cocoon', '~> 1.2' -gem 'net-http', '~> 0.3.2' +gem 'net-http', '~> 0.4.0' gem 'rubyzip', '~> 2.3' gem 'hcaptcha', '~> 7.1' diff --git a/Gemfile.lock b/Gemfile.lock index 3fb5e30c323766..030584cc356af4 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -130,8 +130,8 @@ GEM attr_required (1.0.1) awrence (1.2.1) aws-eventstream (1.2.0) - aws-partitions (1.809.0) - aws-sdk-core (3.181.0) + aws-partitions (1.828.0) + aws-sdk-core (3.183.1) aws-eventstream (~> 1, >= 1.0.2) aws-partitions (~> 1, >= 1.651.0) aws-sigv4 (~> 1.5) @@ -139,7 +139,7 @@ GEM aws-sdk-kms (1.71.0) aws-sdk-core (~> 3, >= 3.177.0) aws-sigv4 (~> 1.1) - aws-sdk-s3 (1.133.0) + aws-sdk-s3 (1.136.0) aws-sdk-core (~> 3, >= 3.181.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.6) @@ -154,6 +154,7 @@ GEM net-http-persistent (~> 4.0) nokogiri (~> 1, >= 1.10.8) base64 (0.1.1) + bcp47_spec (0.2.1) bcrypt (3.1.19) better_errors (2.10.1) erubi (>= 1.0.0) @@ -381,17 +382,17 @@ GEM aes_key_wrap bindata httpclient - json-ld (3.2.5) + json-ld (3.3.0) htmlentities (~> 4.3) json-canonicalization (~> 0.3, >= 0.3.2) link_header (~> 0.0, >= 0.0.8) multi_json (~> 1.15) rack (>= 2.2, < 4) - rdf (~> 3.2, >= 3.2.10) - json-ld-preloaded (3.2.2) - json-ld (~> 3.2) - rdf (~> 3.2) - json-schema (4.0.0) + rdf (~> 3.3) + json-ld-preloaded (3.3.0) + json-ld (~> 3.3) + rdf (~> 3.3) + json-schema (4.1.1) addressable (>= 2.8) jsonapi-renderer (0.2.2) jwt (2.7.1) @@ -453,13 +454,13 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2023.0808) mini_mime (1.1.5) - mini_portile2 (2.8.4) + mini_portile2 (2.8.5) minitest (5.20.0) msgpack (1.7.2) multi_json (1.15.0) multipart-post (2.3.0) mutex_m (0.1.2) - net-http (0.3.2) + net-http (0.4.0) uri net-http-persistent (4.0.2) connection_pool (~> 2.2) @@ -596,7 +597,8 @@ GEM zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.0.6) - rdf (3.2.11) + rdf (3.3.1) + bcp47_spec (~> 0.2) link_header (~> 0.0, >= 0.0.8) rdf-normalize (0.6.1) rdf (~> 3.2) @@ -670,7 +672,7 @@ GEM rubocop-performance (1.19.1) rubocop (>= 1.7.0, < 2.0) rubocop-ast (>= 0.4.0) - rubocop-rails (2.20.2) + rubocop-rails (2.22.1) activesupport (>= 4.2.0) rack (>= 1.1) rubocop (>= 1.33.0, < 2.0) @@ -689,13 +691,13 @@ GEM fugit (~> 1.1, >= 1.1.6) safety_net_attestation (0.4.0) jwt (~> 2.0) - sanitize (6.0.2) + sanitize (6.1.0) crass (~> 1.0.2) nokogiri (>= 1.12.0) scenic (1.7.0) activerecord (>= 4.0.0) railties (>= 4.0.0) - selenium-webdriver (4.13.1) + selenium-webdriver (4.15.0) rexml (~> 3.2, >= 3.2.5) rubyzip (>= 1.2.2, < 3.0) websocket (~> 1.0) @@ -710,7 +712,7 @@ GEM rufus-scheduler (~> 3.2) sidekiq (>= 6, < 8) tilt (>= 1.4.0) - sidekiq-unique-jobs (7.1.29) + sidekiq-unique-jobs (7.1.30) brpoplpush-redis_script (> 0.1.1, <= 2.0.0) concurrent-ruby (~> 1.0, >= 1.0.5) redis (< 5.0) @@ -718,7 +720,7 @@ GEM thor (>= 0.20, < 3.0) simple-navigation (4.4.0) activesupport (>= 2.3.2) - simple_form (5.2.0) + simple_form (5.3.0) actionpack (>= 5.2) activemodel (>= 5.2) simplecov (0.22.0) @@ -740,7 +742,7 @@ GEM stoplight (3.0.2) redlock (~> 1.0) stringio (3.0.8) - strong_migrations (1.3.0) + strong_migrations (1.6.4) activerecord (>= 5.2) swd (1.3.0) activesupport (>= 3) @@ -753,7 +755,7 @@ GEM terrapin (0.6.0) climate_control (>= 0.0.3, < 1.0) test-prof (1.2.3) - thor (1.2.2) + thor (1.3.0) tilt (2.3.0) timeout (0.4.0) tpm-key_attestation (0.12.0) @@ -883,7 +885,7 @@ DEPENDENCIES md-paperclip-azure (~> 2.2) memory_profiler mime-types (~> 3.5.0) - net-http (~> 0.3.2) + net-http (~> 0.4.0) net-ldap (~> 0.18) nokogiri (~> 1.15) nsa! @@ -942,7 +944,7 @@ DEPENDENCIES sprockets-rails (~> 3.4) stackprof stoplight (~> 3.0.1) - strong_migrations (= 1.3.0) + strong_migrations (= 1.6.4) test-prof thor (~> 1.2) tty-prompt (~> 0.23) diff --git a/app/helpers/admin/account_moderation_notes_helper.rb b/app/helpers/admin/account_moderation_notes_helper.rb index 2f08538ca68e4d..3b9d580499fe82 100644 --- a/app/helpers/admin/account_moderation_notes_helper.rb +++ b/app/helpers/admin/account_moderation_notes_helper.rb @@ -6,7 +6,7 @@ def admin_account_link_to(account, path: nil) link_to path || admin_account_path(account.id), class: name_tag_classes(account), title: account.acct do safe_join([ - image_tag(account.avatar.url, width: 15, height: 15, alt: display_name(account), class: 'avatar'), + image_tag(account.avatar.url, width: 15, height: 15, alt: '', class: 'avatar'), content_tag(:span, account.acct, class: 'username'), ], ' ') end diff --git a/app/helpers/settings_helper.rb b/app/helpers/settings_helper.rb index fce36bf43e99d0..3c72b22c666b9b 100644 --- a/app/helpers/settings_helper.rb +++ b/app/helpers/settings_helper.rb @@ -25,7 +25,7 @@ def compact_account_link_to(account) return if account.nil? link_to ActivityPub::TagManager.instance.url_for(account), class: 'name-tag', title: account.acct do - safe_join([image_tag(account.avatar.url, width: 15, height: 15, alt: display_name(account), class: 'avatar'), content_tag(:span, account.acct, class: 'username')], ' ') + safe_join([image_tag(account.avatar.url, width: 15, height: 15, alt: '', class: 'avatar'), content_tag(:span, account.acct, class: 'username')], ' ') end end end diff --git a/app/javascript/mastodon/actions/notifications.js b/app/javascript/mastodon/actions/notifications.js index 677fa1115ffd6b..2674405d2e8e4f 100644 --- a/app/javascript/mastodon/actions/notifications.js +++ b/app/javascript/mastodon/actions/notifications.js @@ -107,8 +107,8 @@ export function updateNotifications(notification, intlMessages, intlLocale) { dispatch(importFetchedAccount(notification.report.target_account)); } - - dispatch(notificationsUpdate({ notification }, preferPendingItems, playSound && !filtered)); + + dispatch(notificationsUpdate({ notification, preferPendingItems, playSound: playSound && !filtered})); fetchRelatedRelationships(dispatch, [notification]); } else if (playSound && !filtered) { diff --git a/app/javascript/mastodon/components/__tests__/__snapshots__/avatar-test.jsx.snap b/app/javascript/mastodon/components/__tests__/__snapshots__/avatar-test.jsx.snap index 7fbdedeb23f11f..2f0a2de324b551 100644 --- a/app/javascript/mastodon/components/__tests__/__snapshots__/avatar-test.jsx.snap +++ b/app/javascript/mastodon/components/__tests__/__snapshots__/avatar-test.jsx.snap @@ -13,7 +13,7 @@ exports[` Autoplay renders a animated avatar 1`] = ` } > alice @@ -32,7 +32,7 @@ exports[` Still renders a still avatar 1`] = ` } > alice diff --git a/app/javascript/mastodon/components/avatar.tsx b/app/javascript/mastodon/components/avatar.tsx index 77bd4234094766..8f866a3c65645e 100644 --- a/app/javascript/mastodon/components/avatar.tsx +++ b/app/javascript/mastodon/components/avatar.tsx @@ -42,7 +42,7 @@ export const Avatar: React.FC = ({ onMouseLeave={handleMouseLeave} style={style} > - {src && {account?.get('acct')}} + {src && } ); }; diff --git a/app/javascript/mastodon/features/account_timeline/containers/header_container.jsx b/app/javascript/mastodon/features/account_timeline/containers/header_container.jsx index 92bcd167fb8199..ecc2e6e7918c5d 100644 --- a/app/javascript/mastodon/features/account_timeline/containers/header_container.jsx +++ b/app/javascript/mastodon/features/account_timeline/containers/header_container.jsx @@ -207,7 +207,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({ modalType: 'IMAGE', modalProps: { src: account.get('avatar'), - alt: account.get('acct'), + alt: '', }, })); }, diff --git a/app/javascript/mastodon/features/video/index.jsx b/app/javascript/mastodon/features/video/index.jsx index 05b1316fd06b48..0097537d57c63d 100644 --- a/app/javascript/mastodon/features/video/index.jsx +++ b/app/javascript/mastodon/features/video/index.jsx @@ -19,6 +19,7 @@ import { throttle } from 'lodash'; import { Blurhash } from 'mastodon/components/blurhash'; import { Icon } from 'mastodon/components/icon'; +import { playerSettings } from 'mastodon/settings'; import { displayMedia, useBlurhash } from '../../initial_state'; import { isFullscreen, requestFullscreen, exitFullscreen } from '../ui/util/fullscreen'; @@ -226,8 +227,8 @@ class Video extends PureComponent { if(!isNaN(x)) { this.setState((state) => ({ volume: x, muted: state.muted && x === 0 }), () => { - this.video.volume = x; - this.video.muted = this.state.muted; + this._syncVideoToVolumeState(x); + this._saveVolumeState(x); }); } }, 15); @@ -365,6 +366,8 @@ class Video extends PureComponent { document.addEventListener('MSFullscreenChange', this.handleFullscreenChange, true); window.addEventListener('scroll', this.handleScroll); + + this._syncVideoFromLocalStorage(); } componentWillUnmount () { @@ -437,8 +440,24 @@ class Video extends PureComponent { const muted = !(this.video.muted || this.state.volume === 0); this.setState((state) => ({ muted, volume: Math.max(state.volume || 0.5, 0.05) }), () => { - this.video.volume = this.state.volume; - this.video.muted = this.state.muted; + this._syncVideoToVolumeState(); + this._saveVolumeState(); + }); + }; + + _syncVideoToVolumeState = (volume = null, muted = null) => { + this.video.volume = volume ?? this.state.volume; + this.video.muted = muted ?? this.state.muted; + }; + + _saveVolumeState = (volume = null, muted = null) => { + playerSettings.set('volume', volume ?? this.state.volume); + playerSettings.set('muted', muted ?? this.state.muted); + }; + + _syncVideoFromLocalStorage = () => { + this.setState({ volume: playerSettings.get('volume') ?? 0.5, muted: playerSettings.get('muted') ?? false }, () => { + this._syncVideoToVolumeState(); }); }; @@ -480,6 +499,7 @@ class Video extends PureComponent { handleVolumeChange = () => { this.setState({ volume: this.video.volume, muted: this.video.muted }); + this._saveVolumeState(this.video.volume, this.video.muted); }; handleOpenVideo = () => { diff --git a/app/javascript/mastodon/locales/fi.json b/app/javascript/mastodon/locales/fi.json index c4dbbc5f0310bc..cc4a9391a34a05 100644 --- a/app/javascript/mastodon/locales/fi.json +++ b/app/javascript/mastodon/locales/fi.json @@ -1,6 +1,6 @@ { "about.blocks": "Moderoidut palvelimet", - "about.contact": "Ota yhteyttä:", + "about.contact": "Ota yhteys:", "about.disclaimer": "Mastodon on vapaa avoimen lähdekoodin ohjelmisto ja Mastodon gGmbH:n tavaramerkki.", "about.domain_blocks.no_reason_available": "Syytä ei ole ilmoitettu", "about.domain_blocks.preamble": "Mastodonin avulla voidaan yleensä tarkastella minkä tahansa fediversumiin kuuluvan palvelimen sisältöä ja vuorovaikuttaa eri palvelinten käyttäjien kanssa. Nämä ovat tälle palvelimelle määritetyt poikkeukset.", diff --git a/app/javascript/mastodon/locales/gl.json b/app/javascript/mastodon/locales/gl.json index 8431d12acc1d0b..14ff22b287f4f5 100644 --- a/app/javascript/mastodon/locales/gl.json +++ b/app/javascript/mastodon/locales/gl.json @@ -39,7 +39,7 @@ "account.follows.empty": "Esta usuaria aínda non segue a ninguén.", "account.follows_you": "Séguete", "account.go_to_profile": "Ir ao perfil", - "account.hide_reblogs": "Agochar repeticións de @{name}", + "account.hide_reblogs": "Agochar promocións de @{name}", "account.in_memoriam": "Lembranzas.", "account.joined_short": "Uniuse", "account.languages": "Modificar os idiomas subscritos", @@ -518,7 +518,7 @@ "privacy.public.long": "Visible por todas", "privacy.public.short": "Público", "privacy.unlisted.long": "Visible por todas, pero excluída da sección descubrir", - "privacy.unlisted.short": "Non listado", + "privacy.unlisted.short": "Sen listar", "privacy_policy.last_updated": "Actualizado por última vez no {date}", "privacy_policy.title": "Política de Privacidade", "refresh": "Actualizar", diff --git a/app/javascript/mastodon/locales/he.json b/app/javascript/mastodon/locales/he.json index a8cb2ec27663b3..ff7e864e5e99e8 100644 --- a/app/javascript/mastodon/locales/he.json +++ b/app/javascript/mastodon/locales/he.json @@ -143,7 +143,7 @@ "compose_form.hashtag_warning": "הודעה זו לא תרשם תחת תגיות הקבצה היות והנראות שלה איננה 'ציבורית'. רק הודעות ציבוריות ימצאו בחיפוש תגיות הקבצה.", "compose_form.lock_disclaimer": "חשבונך אינו {locked}. כל אחד יוכל לעקוב אחריך כדי לקרוא את הודעותיך המיועדות לעוקבים בלבד.", "compose_form.lock_disclaimer.lock": "נעול", - "compose_form.placeholder": "על מה את/ה חושב/ת ?", + "compose_form.placeholder": "על מה את.ה חושב.ת?", "compose_form.poll.add_option": "הוסיפו בחירה", "compose_form.poll.duration": "משך הסקר", "compose_form.poll.option_placeholder": "אפשרות מספר {number}", @@ -235,7 +235,7 @@ "empty_column.favourites": "עוד לא חיבבו את ההודעה הזו. כאשר זה יקרה, החיבובים יופיעו כאן.", "empty_column.follow_requests": "אין לך שום בקשות מעקב עדיין. לכשיתקבלו כאלה, הן תופענה כאן.", "empty_column.followed_tags": "עוד לא עקבת אחרי תגיות. כשיהיו לך תגיות נעקבות, ההודעות יופיעו פה.", - "empty_column.hashtag": "אין כלום בהאשתג הזה עדיין.", + "empty_column.hashtag": "אין כלום בתגית הזאת עדיין.", "empty_column.home": "פיד הבית ריק ! אפשר לבקר ב{public} או להשתמש בחיפוש כדי להתחיל ולהכיר משתמשים/ות אחרים/ות. {suggestions}", "empty_column.list": "אין עדיין פריטים ברשימה. כאשר חברים ברשימה הזאת יפרסמו הודעות חדשות, הן יופיעו פה.", "empty_column.lists": "אין לך שום רשימות עדיין. לכשיהיו, הן תופענה כאן.", @@ -278,7 +278,7 @@ "follow_requests.unlocked_explanation": "למרות שחשבונך אינו נעול, צוות {domain} חושב שאולי כדאי לוודא את בקשות המעקב האלה ידנית.", "followed_tags": "התגיות שהחשבון שלך עוקב אחריהן", "footer.about": "אודות", - "footer.directory": "מדריך פרופילים", + "footer.directory": "ספריית פרופילים", "footer.get_app": "להתקנת היישומון", "footer.invite": "להזמין אנשים", "footer.keyboard_shortcuts": "קיצורי מקלדת", diff --git a/app/javascript/mastodon/locales/hr.json b/app/javascript/mastodon/locales/hr.json index cb1b201a123f61..16d25e784693de 100644 --- a/app/javascript/mastodon/locales/hr.json +++ b/app/javascript/mastodon/locales/hr.json @@ -1,12 +1,16 @@ { + "about.blocks": "Moderirani poslužitelji", "about.contact": "Kontakt:", "about.domain_blocks.no_reason_available": "Razlog nije dostupan", + "about.domain_blocks.suspended.title": "Suspendiran", + "about.rules": "Pravila servera", "account.account_note_header": "Bilješka", "account.add_or_remove_from_list": "Dodaj ili ukloni s liste", "account.badges.bot": "Bot", "account.badges.group": "Grupa", "account.block": "Blokiraj @{name}", "account.block_domain": "Blokiraj domenu {domain}", + "account.block_short": "Blokiraj", "account.blocked": "Blokirano", "account.browse_more_on_origin_server": "Pogledajte više na izvornom profilu", "account.cancel_follow_request": "Withdraw follow request", @@ -15,17 +19,20 @@ "account.edit_profile": "Uredi profil", "account.enable_notifications": "Obavjesti me kada @{name} napravi objavu", "account.endorse": "Istakni na profilu", + "account.featured_tags.last_status_at": "Zadnji post {date}", "account.featured_tags.last_status_never": "Nema postova", "account.follow": "Prati", "account.followers": "Pratitelji", "account.followers.empty": "Nitko još ne prati korisnika/cu.", "account.followers_counter": "{count, plural, one {{counter} pratitelj} other {{counter} pratitelja}}", + "account.following": "Pratim", "account.following_counter": "{count, plural, one {{counter} praćeni} few{{counter} praćena} other {{counter} praćenih}}", "account.follows.empty": "Korisnik/ca još ne prati nikoga.", "account.follows_you": "Prati te", "account.go_to_profile": "Idi na profil", "account.hide_reblogs": "Sakrij boostove od @{name}", "account.in_memoriam": "U sjećanje.", + "account.joined_short": "Pridružen", "account.link_verified_on": "Vlasništvo ove poveznice provjereno je {date}", "account.locked_info": "Status privatnosti ovog računa postavljen je na zaključano. Vlasnik ručno pregledava tko ih može pratiti.", "account.media": "Medijski sadržaj", @@ -65,13 +72,17 @@ "bundle_column_error.error.title": "Oh, ne!", "bundle_column_error.network.title": "Greška mreže", "bundle_column_error.retry": "Pokušajte ponovno", + "bundle_column_error.return": "Na glavnu", "bundle_column_error.routing.title": "404", "bundle_modal_error.close": "Zatvori", "bundle_modal_error.message": "Nešto je pošlo po zlu tijekom učitavanja ove komponente.", "bundle_modal_error.retry": "Pokušajte ponovno", + "closed_registrations_modal.find_another_server": "Nađi drugi server", + "column.about": "O aplikaciji", "column.blocks": "Blokirani korisnici", "column.bookmarks": "Knjižne oznake", "column.community": "Lokalna vremenska crta", + "column.direct": "Privatna spominjanja", "column.directory": "Pregledavanje profila", "column.domain_blocks": "Blokirane domene", "column.favourites": "Favoriti", @@ -95,6 +106,7 @@ "community.column_settings.remote_only": "Samo udaljeno", "compose.language.change": "Promijeni jezik", "compose.language.search": "Pretraži jezike...", + "compose.published.body": "Post je objavljen.", "compose.published.open": "Otvori", "compose.saved.body": "Post spremljen.", "compose_form.direct_message_warning_learn_more": "Saznajte više", @@ -132,6 +144,7 @@ "confirmations.discard_edit_media.message": "Postoje nespremljene promjene u opisu medija ili u pretpregledu, svejedno ih odbaciti?", "confirmations.domain_block.confirm": "Blokiraj cijelu domenu", "confirmations.domain_block.message": "Jeste li zaista, zaista sigurni da želite blokirati cijelu domenu {domain}? U većini slučajeva dovoljno je i preferirano nekoliko ciljanih blokiranja ili utišavanja. Nećete vidjeti sadržaj s te domene ni u kojim javnim vremenskim crtama ili Vašim obavijestima. Vaši pratitelji s te domene bit će uklonjeni.", + "confirmations.edit.confirm": "Uredi", "confirmations.logout.confirm": "Odjavi se", "confirmations.logout.message": "Jeste li sigurni da se želite odjaviti?", "confirmations.mute.confirm": "Utišaj", @@ -146,10 +159,14 @@ "conversation.mark_as_read": "Označi kao pročitano", "conversation.open": "Prikaži razgovor", "conversation.with": "S {names}", + "copypaste.copied": "Kopirano", + "copypaste.copy_to_clipboard": "Kopiraj u međuspremnik", "directory.federated": "Iz znanog fediversa", "directory.local": "Samo iz {domain}", "directory.new_arrivals": "Novi korisnici", "directory.recently_active": "Nedavno aktivni", + "disabled_account_banner.account_settings": "Postavke računa", + "disabled_account_banner.text": "Tvoj račun {disabledAccount} je trenutno onemogućen.", "dismissable_banner.explore_links": "These news stories are being talked about by people on this and other servers of the decentralized network right now.", "dismissable_banner.explore_tags": "These hashtags are gaining traction among people on this and other servers of the decentralized network right now.", "embed.instructions": "Embed this status on your website by copying the code below.", @@ -172,7 +189,7 @@ "empty_column.account_timeline": "Ovdje nema tootova!", "empty_column.account_unavailable": "Profil nije dostupan", "empty_column.blocks": "Još niste blokirali nikoga.", - "empty_column.bookmarked_statuses": "Još nemaš niti jedan označeni toot. Kada označiš jedan, prikazad će se ovdje.", + "empty_column.bookmarked_statuses": "Još nemaš niti jedan označeni toot. Kada označiš jedan, prikazat će se ovdje.", "empty_column.community": "Lokalna vremenska crta je prazna. Napišite nešto javno da biste pokrenuli stvari!", "empty_column.domain_blocks": "Još nema blokiranih domena.", "empty_column.follow_requests": "Nemaš niti jedan zahtjev za praćenjem. Ako ga dobiješ, prikazat će se ovdje.", @@ -204,6 +221,7 @@ "filter_modal.title.status": "Filtriraj objavu", "firehose.all": "Sve", "firehose.local": "Ovaj server", + "firehose.remote": "Drugi serveri", "follow_request.authorize": "Autoriziraj", "follow_request.reject": "Odbij", "footer.about": "O aplikaciji", @@ -235,6 +253,7 @@ "interaction_modal.login.action": "Odvedi me kući", "interaction_modal.no_account_yet": "Nisi na Mastodonu?", "interaction_modal.on_this_server": "Na ovom serveru", + "interaction_modal.title.follow": "Prati {name}", "intervals.full.days": "{number, plural, one {# dan} other {# dana}}", "intervals.full.hours": "{number, plural, one {# sat} few {# sata} other {# sati}}", "intervals.full.minutes": "{number, plural, one {# minuta} few {# minute} other {# minuta}}", @@ -247,6 +266,7 @@ "keyboard_shortcuts.direct": "to open direct messages column", "keyboard_shortcuts.down": "za pomak dolje na listi", "keyboard_shortcuts.enter": "za otvaranje toota", + "keyboard_shortcuts.favourites": "Otvori listu omiljenih", "keyboard_shortcuts.federated": "za otvaranje federalne vremenske crte", "keyboard_shortcuts.heading": "Tipkovnički prečaci", "keyboard_shortcuts.home": "za otvaranje početne vremenske crte", @@ -273,6 +293,7 @@ "lightbox.close": "Zatvori", "lightbox.next": "Sljedeće", "lightbox.previous": "Prethodno", + "limited_account_hint.action": "Svejedno prikaži profil", "lists.account.add": "Dodaj na listu", "lists.account.remove": "Ukloni s liste", "lists.delete": "Izbriši listu", @@ -289,12 +310,16 @@ "media_gallery.toggle_visible": "Sakrij {number, plural, one {sliku} other {slike}}", "mute_modal.duration": "Trajanje", "mute_modal.hide_notifications": "Sakrij obavijesti ovog korisnika?", + "navigation_bar.about": "O aplikaciji", "navigation_bar.blocks": "Blokirani korisnici", "navigation_bar.community_timeline": "Lokalna vremenska crta", "navigation_bar.compose": "Compose new toot", + "navigation_bar.direct": "Privatna spominjanja", "navigation_bar.discover": "Istraživanje", "navigation_bar.domain_blocks": "Blokirane domene", "navigation_bar.edit_profile": "Uredi profil", + "navigation_bar.explore": "Istraži", + "navigation_bar.favourites": "Favoriti", "navigation_bar.filters": "Utišane riječi", "navigation_bar.follow_requests": "Zahtjevi za praćenje", "navigation_bar.follows_and_followers": "Praćeni i pratitelji", @@ -305,6 +330,7 @@ "navigation_bar.pins": "Prikvačeni tootovi", "navigation_bar.preferences": "Postavke", "navigation_bar.public_timeline": "Federalna vremenska crta", + "navigation_bar.search": "Traži", "navigation_bar.security": "Sigurnost", "not_signed_in_indicator.not_signed_in": "You need to sign in to access this resource.", "notification.follow": "{name} Vas je počeo/la pratiti", @@ -332,6 +358,7 @@ "notifications.filter.follows": "Praćenja", "notifications.filter.mentions": "Spominjanja", "notifications.filter.polls": "Rezultati anketa", + "notifications.grant_permission": "Odobri dopuštenje.", "notifications.group": "{count} obavijesti", "notifications.mark_as_read": "Označi sve obavijesti kao pročitane", "onboarding.actions.go_to_explore": "See what's trending", @@ -343,12 +370,14 @@ "onboarding.steps.follow_people.body": "You curate your own feed. Lets fill it with interesting people.", "onboarding.steps.follow_people.title": "Follow {count, plural, one {one person} other {# people}}", "onboarding.steps.publish_status.body": "Say hello to the world.", + "onboarding.steps.publish_status.title": "Napiši svoj prvi post", "onboarding.steps.setup_profile.body": "Others are more likely to interact with you with a filled out profile.", "onboarding.steps.setup_profile.title": "Customize your profile", "onboarding.steps.share_profile.body": "Let your friends know how to find you on Mastodon!", "onboarding.steps.share_profile.title": "Share your profile", "poll.closed": "Završeno", "poll.refresh": "Osvježi", + "poll.reveal": "Vidi rezultate", "poll.total_people": "{count, plural, one {# osoba} few {# osobe} other {# osoba}}", "poll.total_votes": "{count, plural, one {# glas} few {# glasa} other {# glasova}}", "poll.vote": "Glasaj", @@ -397,14 +426,41 @@ "report.reasons.spam_description": "Zlonamjerne poveznice, lažni angažman ili repetitivni odgovori", "report.submit": "Pošalji", "report.target": "Prijavljivanje korisnika {target}", + "report.thanks.title": "Ne želiš vidjeti ovo?", "report_notification.attached_statuses": "{count, plural, one {# post} other {# posts}} attached", + "report_notification.categories.other": "Drugo", + "report_notification.categories.spam": "Spam", + "report_notification.categories.violation": "Povreda pravila", + "report_notification.open": "Otvori izvješće", + "search.no_recent_searches": "Nema nedavnih pretraga", "search.placeholder": "Traži", + "search.quick_action.go_to_account": "Idi na profil {x}", + "search.quick_action.open_url": "Otvori link u Mastodonu", + "search.search_or_paste": "Pretraži ili zalijepi URL", + "search_popout.full_text_search_disabled_message": "Nije dostuppno na {domain}.", + "search_popout.language_code": "ISO jezični kod", + "search_popout.options": "Opcije pretraživanja", + "search_popout.quick_actions": "Brze radnje", + "search_popout.recent": "Nedavne pretrage", + "search_popout.specific_date": "specifičan datum", + "search_popout.user": "korisnik", + "search_results.accounts": "Profili", + "search_results.all": "Sve", + "search_results.nothing_found": "Nije pronađeno ništa za te ključne riječi", + "search_results.see_all": "Prikaži sve", "search_results.statuses": "Toots", + "search_results.title": "Traži {q}", + "server_banner.about_active_users": "Popis aktivnih korisnika prošli mjesec", "server_banner.active_users": "aktivni korisnici", + "server_banner.administered_by": "Administrator je:", + "server_banner.introduction": "{domain} je dio decentralizirane socijalne mreže koju pokreće {mastodon}.", "server_banner.learn_more": "Saznaj više", + "server_banner.server_stats": "Statistike poslužitelja:", "sign_in_banner.create_account": "Stvori račun", "sign_in_banner.sign_in": "Prijavi se", + "sign_in_banner.sso_redirect": "Prijava ili registracija", "status.admin_status": "Open this status in the moderation interface", + "status.block": "Blokiraj @{name}", "status.bookmark": "Dodaj u favorite", "status.cannot_reblog": "Ova objava ne može biti boostana", "status.copy": "Copy link to status", @@ -419,6 +475,7 @@ "status.history.created": "Kreirao/la {name} prije {date}", "status.history.edited": "Uredio/la {name} prije {date}", "status.load_more": "Učitaj više", + "status.media.open": "Kliknite za otvaranje", "status.media_hidden": "Sakriven medijski sadržaj", "status.mention": "Spomeni @{name}", "status.more": "Više", @@ -447,6 +504,7 @@ "status.title.with_attachments": "{user} posted {attachmentCount, plural, one {an attachment} other {# attachments}}", "status.translate": "Prevedi", "status.translated_from_with": "Prevedno s {lang} koristeći {provider}", + "status.uncached_media_warning": "Pregled nije dostupan", "status.unmute_conversation": "Poništi utišavanje razgovora", "status.unpin": "Otkvači s profila", "subscribed_languages.save": "Spremi promjene", @@ -484,6 +542,7 @@ "upload_modal.description_placeholder": "Gojazni đačić s biciklom drži hmelj i finu vatu u džepu nošnje", "upload_modal.detect_text": "Detektiraj tekst sa slike", "upload_modal.edit_media": "Uređivanje medija", + "upload_modal.preparing_ocr": "Pripremam OCR…", "upload_modal.preview_label": "Pretpregled ({ratio})", "upload_progress.label": "Prenošenje...", "upload_progress.processing": "Obrada…", diff --git a/app/javascript/mastodon/locales/ko.json b/app/javascript/mastodon/locales/ko.json index 3a78a9cd791e70..269063b7cbfaba 100644 --- a/app/javascript/mastodon/locales/ko.json +++ b/app/javascript/mastodon/locales/ko.json @@ -204,7 +204,7 @@ "dismissable_banner.explore_links": "이 소식들은 오늘 소셜 웹에서 가장 많이 공유된 내용들입니다. 새 소식을 더 많은 사람들이 공유할수록 높은 순위가 됩니다.", "dismissable_banner.explore_statuses": "이 게시물들은 오늘 소셜 웹에서 호응을 얻고 있는 게시물들입니다. 부스트와 관심을 받는 새로운 글들이 높은 순위가 됩니다.", "dismissable_banner.explore_tags": "이 해시태그들은 이 서버와 분산화된 네트워크의 다른 서버에서 사람들의 인기를 끌고 있는 것들입니다.", - "dismissable_banner.public_timeline": "{domain} 사람들이 팔로우하는 소셜 웹 사람들의 최신 공개 게시물입니다.", + "dismissable_banner.public_timeline": "이것들은 {domain}에 있는 사람들이 팔로우한 사람들의 최신 공개 게시물들입니다.", "embed.instructions": "아래의 코드를 복사하여 대화를 원하는 곳으로 공유하세요.", "embed.preview": "이렇게 표시됩니다:", "emoji_button.activity": "활동", diff --git a/app/javascript/mastodon/locales/zh-TW.json b/app/javascript/mastodon/locales/zh-TW.json index dab8a721913e89..5d3d74ea684ae0 100644 --- a/app/javascript/mastodon/locales/zh-TW.json +++ b/app/javascript/mastodon/locales/zh-TW.json @@ -225,7 +225,7 @@ "empty_column.account_suspended": "帳號已被停權", "empty_column.account_timeline": "這裡還沒有嘟文!", "empty_column.account_unavailable": "無法取得個人檔案", - "empty_column.blocks": "您尚未封鎖任何使用者。", + "empty_column.blocks": "您還沒有封鎖任何使用者。", "empty_column.bookmarked_statuses": "您還沒有建立任何書籤。當您建立書籤時,它將於此顯示。", "empty_column.community": "本站時間軸是空的。快公開嘟些文搶頭香啊!", "empty_column.direct": "您還沒有收到任何私訊。當您私訊別人或收到私訊時,它將於此顯示。", diff --git a/app/javascript/mastodon/settings.js b/app/javascript/mastodon/settings.js index aefb8e0e95b4de..f31aee0afc0725 100644 --- a/app/javascript/mastodon/settings.js +++ b/app/javascript/mastodon/settings.js @@ -46,4 +46,5 @@ export default class Settings { export const pushNotificationsSetting = new Settings('mastodon_push_notification_data'); export const tagHistory = new Settings('mastodon_tag_history'); export const bannerSettings = new Settings('mastodon_banner_settings'); -export const searchHistory = new Settings('mastodon_search_history'); \ No newline at end of file +export const searchHistory = new Settings('mastodon_search_history'); +export const playerSettings = new Settings('mastodon_player'); diff --git a/app/lib/feed_manager.rb b/app/lib/feed_manager.rb index 76e2b117db2ac5..7e39219a6da126 100644 --- a/app/lib/feed_manager.rb +++ b/app/lib/feed_manager.rb @@ -283,7 +283,7 @@ def clear_from_antenna(antenna, target_account) end def clear_from_antennas(account, target_account) - Antenna.where(account: account).each do |antenna| + Antenna.where(account: account).find_each do |antenna| clear_from_antenna(antenna, target_account) end end diff --git a/app/models/feed.rb b/app/models/feed.rb index f51dcfab1dad66..d9cab2cd1e558f 100644 --- a/app/models/feed.rb +++ b/app/models/feed.rb @@ -23,9 +23,9 @@ def from_redis(limit, max_id, since_id, min_id) max_id = '+inf' if max_id.blank? if min_id.blank? since_id = '-inf' if since_id.blank? - unhydrated = redis.zrevrangebyscore(key, "(#{max_id}", "(#{since_id}", limit: [0, limit], with_scores: true).map(&:first).map(&:to_i) + unhydrated = redis.zrevrangebyscore(key, "(#{max_id}", "(#{since_id}", limit: [0, limit], with_scores: true).map { |id| id.first.to_i } else - unhydrated = redis.zrangebyscore(key, "(#{min_id}", "(#{max_id}", limit: [0, limit], with_scores: true).map(&:first).map(&:to_i) + unhydrated = redis.zrangebyscore(key, "(#{min_id}", "(#{max_id}", limit: [0, limit], with_scores: true).map { |id| id.first.to_i } end Status.where(id: unhydrated).cache_ids diff --git a/app/models/user.rb b/app/models/user.rb index ab988360d51408..c540a7a8f05273 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -490,7 +490,7 @@ def needs_feed_update? end def validate_email_dns? - email_changed? && !external? && !Rails.env.local? # rubocop:disable Rails/UnknownEnv + email_changed? && !external? && !Rails.env.local? end def validate_role_elevation diff --git a/app/services/approve_appeal_service.rb b/app/services/approve_appeal_service.rb index 59b41495cd1fc0..6de051edc457f4 100644 --- a/app/services/approve_appeal_service.rb +++ b/app/services/approve_appeal_service.rb @@ -62,7 +62,7 @@ def undo_mark_statuses_as_sensitive! def undo_force_cw! representative_account = Account.representative - @strike.statuses.includes(:media_attachments).each do |status| + @strike.statuses.includes(:media_attachments).find_each do |status| UpdateStatusService.new.call(status, representative_account.id, spoiler_text: '') end end diff --git a/app/services/remove_status_service.rb b/app/services/remove_status_service.rb index 2e9d0648b2b6e9..38d6e59f838e7a 100644 --- a/app/services/remove_status_service.rb +++ b/app/services/remove_status_service.rb @@ -128,7 +128,7 @@ def remove_reblogs end def decrement_references - @status.references.each do |ref| + @status.references.find_each do |ref| ref.decrement_count!(:status_referred_by_count) end end diff --git a/app/services/un_emoji_react_service.rb b/app/services/un_emoji_react_service.rb index 1ec7e2867bf549..400efda19ad910 100644 --- a/app/services/un_emoji_react_service.rb +++ b/app/services/un_emoji_react_service.rb @@ -28,7 +28,7 @@ def call(account, status, emoji_reaction = nil) private def bulk(account, status) - EmojiReaction.where(account: account, status: status).each do |emoji_reaction| + EmojiReaction.where(account: account, status: status).find_each do |emoji_reaction| call(account, status, emoji_reaction) end end diff --git a/app/views/admin/statuses/show.html.haml b/app/views/admin/statuses/show.html.haml index 69776b94f7abce..ef9ea1c5225567 100644 --- a/app/views/admin/statuses/show.html.haml +++ b/app/views/admin/statuses/show.html.haml @@ -60,7 +60,7 @@ %h3= t('admin.statuses.history') %ol.history - - @status.edits.includes(:account, status: [:account]).each.with_index do |status_edit, i| + - @status.edits.reorder(nil).includes(:account, status: [:account]).find_each(order: :asc).with_index do |status_edit, i| %li .history__entry %h5 diff --git a/app/views/filters/statuses/_status_filter.html.haml b/app/views/filters/statuses/_status_filter.html.haml index ba1170cf92a3ff..9999dcda81fda5 100644 --- a/app/views/filters/statuses/_status_filter.html.haml +++ b/app/views/filters/statuses/_status_filter.html.haml @@ -20,7 +20,7 @@ .detailed-status__meta = link_to ActivityPub::TagManager.instance.url_for(status.account), class: 'name-tag', target: '_blank', rel: 'noopener noreferrer' do - = image_tag(status.account.avatar.url, width: 15, height: 15, alt: display_name(status.account), class: 'avatar') + = image_tag(status.account.avatar.url, width: 15, height: 15, alt: '', class: 'avatar') .username= status.account.acct · = link_to ActivityPub::TagManager.instance.url_for(status), class: 'detailed-status__datetime', target: stream_link_target, rel: 'noopener noreferrer' do diff --git a/config/application.rb b/config/application.rb index ad931fd36bcce6..387827784a5a6c 100644 --- a/config/application.rb +++ b/config/application.rb @@ -86,115 +86,6 @@ class Application < Rails::Application # config.time_zone = "Central Time (US & Canada)" # config.eager_load_paths << Rails.root.join("extras") - # All translations from config/locales/*.rb,yml are auto loaded. - # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] - config.i18n.available_locales = [ - :af, - :an, - :ar, - :ast, - :be, - :bg, - :bn, - :br, - :bs, - :ca, - :ckb, - :co, - :cs, - :cy, - :da, - :de, - :el, - :en, - :'en-GB', - :eo, - :es, - :'es-AR', - :'es-MX', - :et, - :eu, - :fa, - :fi, - :fo, - :fr, - :'fr-QC', - :fy, - :ga, - :gd, - :gl, - :he, - :hi, - :hr, - :hu, - :hy, - :id, - :ig, - :io, - :is, - :it, - :ja, - :ka, - :kab, - :kk, - :kn, - :ko, - :ku, - :kw, - :la, - :lt, - :lv, - :mk, - :ml, - :mr, - :ms, - :my, - :nl, - :nn, - :no, - :oc, - :pa, - :pl, - :'pt-BR', - :'pt-PT', - :ro, - :ru, - :sa, - :sc, - :sco, - :si, - :sk, - :sl, - :sq, - :sr, - :'sr-Latn', - :sv, - :szl, - :ta, - :te, - :th, - :tr, - :tt, - :ug, - :uk, - :ur, - :vi, - :zgh, - :'zh-CN', - :'zh-HK', - :'zh-TW', - ] - - config.i18n.default_locale = begin - custom_default_locale = ENV['DEFAULT_LOCALE']&.to_sym - - if config.i18n.available_locales.include?(custom_default_locale) - custom_default_locale - else - :en - end - end - # config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb') # config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')] @@ -206,7 +97,7 @@ class Application < Rails::Application # We use our own middleware for this config.public_file_server.enabled = false - config.middleware.use PublicFileServerMiddleware if Rails.env.local? || ENV['RAILS_SERVE_STATIC_FILES'] == 'true' # rubocop:disable Rails/UnknownEnv + config.middleware.use PublicFileServerMiddleware if Rails.env.local? || ENV['RAILS_SERVE_STATIC_FILES'] == 'true' config.middleware.use Rack::Attack config.middleware.use Mastodon::RackMiddleware diff --git a/config/initializers/i18n.rb b/config/initializers/i18n.rb new file mode 100644 index 00000000000000..39b7a3cc40ff3f --- /dev/null +++ b/config/initializers/i18n.rb @@ -0,0 +1,110 @@ +# frozen_string_literal: true + +Rails.application.configure do + config.i18n.available_locales = [ + :af, + :an, + :ar, + :ast, + :be, + :bg, + :bn, + :br, + :bs, + :ca, + :ckb, + :co, + :cs, + :cy, + :da, + :de, + :el, + :en, + :'en-GB', + :eo, + :es, + :'es-AR', + :'es-MX', + :et, + :eu, + :fa, + :fi, + :fo, + :fr, + :'fr-QC', + :fy, + :ga, + :gd, + :gl, + :he, + :hi, + :hr, + :hu, + :hy, + :id, + :ig, + :io, + :is, + :it, + :ja, + :ka, + :kab, + :kk, + :kn, + :ko, + :ku, + :kw, + :la, + :lt, + :lv, + :mk, + :ml, + :mr, + :ms, + :my, + :nl, + :nn, + :no, + :oc, + :pa, + :pl, + :'pt-BR', + :'pt-PT', + :ro, + :ru, + :sa, + :sc, + :sco, + :si, + :sk, + :sl, + :sq, + :sr, + :'sr-Latn', + :sv, + :szl, + :ta, + :te, + :th, + :tr, + :tt, + :ug, + :uk, + :ur, + :vi, + :zgh, + :'zh-CN', + :'zh-HK', + :'zh-TW', + ] + + config.i18n.default_locale = begin + custom_default_locale = ENV['DEFAULT_LOCALE']&.to_sym + + if Rails.configuration.i18n.available_locales.include?(custom_default_locale) + custom_default_locale + else + :en + end + end +end diff --git a/config/locales/bg.yml b/config/locales/bg.yml index 04b4d438bbe4eb..9da83430199475 100644 --- a/config/locales/bg.yml +++ b/config/locales/bg.yml @@ -1537,7 +1537,7 @@ bg: reach: Обхват reach_hint_html: Управлявайте дали искате да бъдете открити и последвани от нови хора. Искате ли публикациите ви да се появяват в главния екран? Искате ли другите да ви виждат в препоръките им за последване? Желаете ли да приемате автоматично всички нови последователи или да имате подробен контрол върху всеки един? search: Търсене - search_hint_html: Управлявайте как искате да бъдете открити. Желаете ли хората да ви открият по това, за което сте публикували публично? Искате ли хората извън Mastodon да намират профила ви, търсейки из мрежата? Обърнете внимание, че общото изключване от всички търсачки не може да гарантира за публичната информация. + search_hint_html: Управлявайте как искате да бъдете открити. Желаете ли хората да ви открият по това, за което сте публикували обществено? Искате ли хората извън Mastodon да намират профила ви, търсейки из уебпространството? Обърнете внимание, че пълното изключване от всички търсачки не може да се гарантира за обществените сведения. title: Поверителност и обхват privacy_policy: title: Политика за поверителност diff --git a/config/locales/de.yml b/config/locales/de.yml index ca7659c4c9343c..2ab90611fb20a0 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -747,7 +747,7 @@ de: title: Neue Nutzer*innen müssen ein CAPTCHA lösen, um das Konto zu bestätigen content_retention: preamble: Lege fest, wie lange Inhalte von Nutzer*innen auf deinem Mastodon-Server gespeichert bleiben. - title: Aufbewahrung von Inhalten + title: Cache & Archive default_noindex: desc_html: Betrifft alle Profile, die diese Einstellung bei sich nicht geändert haben title: Profile standardmäßig von der Suchmaschinen-Indizierung ausnehmen diff --git a/config/locales/devise.fi.yml b/config/locales/devise.fi.yml index 8bbcb071e36adb..7846ebd8c281dc 100644 --- a/config/locales/devise.fi.yml +++ b/config/locales/devise.fi.yml @@ -27,12 +27,12 @@ fi: title: Vahvista sähköpostiosoite email_changed: explanation: 'Tilin sähköpostiosoitteeksi vaihdetaan:' - extra: Jos et vaihtanut sähköpostiosoitettasi, joku muu on todennäköisesti päässyt käyttämään tiliäsi. Vaihda salasanasi viipymättä, tai ota yhteyttä palvelimen ylläpitäjään, jos et pääse kirjautumaan tilillesi. + extra: Jos et vaihtanut sähköpostiosoitettasi, joku muu on todennäköisesti päässyt käyttämään tiliäsi. Vaihda salasanasi viipymättä, tai ota yhteys palvelimen ylläpitäjään, jos et pääse kirjautumaan tilillesi. subject: 'Mastodon: Sähköpostiosoite vaihdettu' title: Uusi sähköpostiosoite password_change: explanation: Tilisi salasana on vaihdettu. - extra: Jos et vaihtanut salasanaasi, joku muu on todennäköisesti päässyt käyttämään tiliäsi. Vaihda salasanasi viipymättä, tai ota yhteyttä palvelimen ylläpitäjään, jos et pääse kirjautumaan tilillesi. + extra: Jos et vaihtanut salasanaasi, joku muu on todennäköisesti päässyt käyttämään tiliäsi. Vaihda salasanasi viipymättä, tai ota yhteys palvelimen ylläpitäjään, jos et pääse kirjautumaan tilillesi. subject: 'Mastodon: salasana vaihdettu' title: Salasana vaihdettu reconfirmation_instructions: diff --git a/config/locales/devise.hr.yml b/config/locales/devise.hr.yml index 235e354140fca1..89db8922e433ac 100644 --- a/config/locales/devise.hr.yml +++ b/config/locales/devise.hr.yml @@ -5,24 +5,61 @@ hr: confirmed: Vaša adresa e-pošte uspješno je potvrđena. send_instructions: Za nekoliko minuta primit ćete e-poštu s uputama kako potvrditi Vašu adresu e-pošte. Molimo pogledajte Vašu mapu s neželjenom poštom, ako niste primili ovu e-poštu. send_paranoid_instructions: Ako Vaša adresa e-pošte postoji u našoj bazi podataka, za nekoliko minuta primit ćete e-poštu s uputama kako ju potvrditi. Molimo provjerite mapu s neželjenom poštom, ako niste primili ovu e-poštu. + failure: + already_authenticated: Već ste prijavljeni. + inactive: Vaš račun još nije aktiviran. + invalid: "%{authentication_keys} ili lozinka nisu valjani." + last_attempt: Imate još jedan pokušaj prije zaključavanja računa. + locked: Vaš je račun zaključan. + not_found_in_database: "%{authentication_keys} ili lozinka nisu valjani." + pending: Tvoj račun je još uvijek pod revizijom. + timeout: Vaša je sesija istekla. Ponovno se prijavite kako biste nastavili. + unauthenticated: Morate se prijaviti ili registrirati prije nastavka. + unconfirmed: Moraš potvrditi svoju email adresu kako bi nastavio. mailer: confirmation_instructions: action: Potvrdi adresu e-pošte action_with_app: Potvrdi i vrati se na %{app} + extra_html: Važno je da pročitaš pravila ovog servera i naše uvjete korištenja. subject: 'Mastodon: upute za potvrđivanje za %{instance}' title: Potvrdi adresu e-pošte email_changed: + explanation: 'Email adresa za ovaj račun je izmijenjena u:' subject: 'Mastodon: adresa e-pošte je promijenjena' title: Nova adresa e-pošte password_change: + explanation: Lozinka tvog računa je promijenjena. subject: 'Mastodon: lozinka je promijenjena' + title: Lozinka je promijenjena + reconfirmation_instructions: + explanation: Potvrdi novu adresu kako bi promijenio email. + subject: 'Mastodon: Potvrdi email za %{instance}' + title: Potvrdi adresu e-pošte reset_password_instructions: + action: Promijeni lozinku + explanation: Zatražili ste novu lozinku za svoj račun. + extra: Ako nisi ovo zatražio, samo ignoriraj ovu email poruku. Tvoja lozinka neće biti promijenjena sve dok ne pristupiš linku iznad kako bi stvorio novu. subject: 'Mastodon: upute za ponovno postavljanje lozinke' title: Ponovno postavljanje lozinke two_factor_disabled: + subject: 'Mastodon: Dvo-faktorska autentifikacija je onemogućena' title: 2FA je onemogućen + two_factor_enabled: + subject: 'Mastodon: Dvo-faktorska autentifikacija je omogućena' + title: 2FA omogućena unlock_instructions: subject: 'Mastodon: upute za otključavanje' + webauthn_credential: + added: + subject: 'Mastodon: Novi sigurnosni ključ' + title: Dodan je novi sigurnosni ključ + deleted: + subject: 'Mastodon: Sigurnosni ključ je obrisan' + title: Jedan od tvojih sigurnosnih ključeva je obrisan + webauthn_disabled: + title: Sigurnosni ključevi su onemogućeni + webauthn_enabled: + title: Sigurnosni ključevi su omogućeni omniauth_callbacks: failure: Ne možemo Vas autentificirati s %{kind} zbog "%{reason}". success: Uspješno ste autentificirani s računom na %{kind}. diff --git a/config/locales/doorkeeper.gl.yml b/config/locales/doorkeeper.gl.yml index c7f21d1ba8e412..57ee4777c97887 100644 --- a/config/locales/doorkeeper.gl.yml +++ b/config/locales/doorkeeper.gl.yml @@ -33,7 +33,7 @@ gl: help: native_redirect_uri: Utiliza %{native_redirect_uri} para probas locais redirect_uri: Utiliza unha liña por URI - scopes: Separar permisos con espazos. Deixar en branco para utilizar os permisos por omisión. + scopes: Separar permisos con espazos. Deixar en branco para utilizar os permisos por defecto. index: application: Aplicación callback_url: URL de chamada diff --git a/config/locales/doorkeeper.he.yml b/config/locales/doorkeeper.he.yml index 6d6b5866eeaa97..9030e45e0c4662 100644 --- a/config/locales/doorkeeper.he.yml +++ b/config/locales/doorkeeper.he.yml @@ -38,12 +38,12 @@ he: application: יישום callback_url: כתובת גישה חוזרת (Callback URL) delete: למחוק - empty: אין לך אפליקציות. + empty: אין לך יישומים. name: שם new: ישום חדש scopes: תחומים show: להציג - title: ישומך + title: היישומים שלך new: title: ישום חדש show: diff --git a/config/locales/eu.yml b/config/locales/eu.yml index 3ce8cc728765e5..3b7bba6ce34efc 100644 --- a/config/locales/eu.yml +++ b/config/locales/eu.yml @@ -776,6 +776,7 @@ eu: open: Edonork eman dezake izena security: authorized_fetch: Eskatu autentifikazioa federatutako zerbitzarietatik + federation_authentication: Federazio autentifikazioaren betearaztea title: Zerbitzariko ezarpenak site_uploads: delete: Ezabatu igotako fitxategia @@ -859,6 +860,7 @@ eu: message_html: Mastodon eguneraketa kritikoa eskuragarri, mesedez eguneratu ahal bezain azkar. software_version_patch_check: action: Ikusi eguneraketa eskuragarriak + message_html: Mastodon akats konponketa eguneratze bat eskuragarri dago. upload_check_privacy_error: action: Ikus hemen informazio gehiagorako message_html: "Zure zerbitzaria ez dago ongi konfiguratua. Zure erabiltzaileen pribatutasuna arriskuan dago." @@ -981,6 +983,9 @@ eu: body: "%{reporter}(e)k %{target} salatu du" body_remote: "%{domain} domeinuko norbaitek %{target} salatu du" subject: Salaketa berria %{instance} instantzian (#%{id}) + new_software_updates: + body: Mastodon bertsio berria atera da, eguneratu nahiko duzu, ezta! + subject: Mastodon bertsio berriak %{instance} rentzat eskuragarri daude! new_trends: body: 'Ondorengo elementuak berrikusi behar dira publikoki bistaratu aurretik:' new_trending_links: @@ -1033,6 +1038,12 @@ eu: hint_html: Azken kontu bat! Gizakia zarela berretsi behar dugu (zabor-kontuak kanpoan mantentzeko baino ez da!) Ebatzi azpiko CAPTCHA eta sakatu "Jarraitu". title: Segurtasun txekeoa confirmations: + awaiting_review_title: Zure izen-ematea berrikusten ari da + clicking_this_link: lotura hau klikatzen + login_link: hasi saioa + proceed_to_login_html: Orain jarraitu dezakezu %{login_link} -era. + registration_complete: Osatuta dago orain zure izen-ematea %{domain} -en! + welcome_title: Ongi etorri, %{name}! wrong_email_hint: Helbide-elektroniko hori zuzena ez bada, kontuaren ezarpenetan alda dezakezu. delete_account: Ezabatu kontua delete_account_html: Kontua ezabatu nahi baduzu, jarraitu hemen. Berrestea eskatuko zaizu. diff --git a/config/locales/fa.yml b/config/locales/fa.yml index e2138e0aeb1fd6..8e076878a091f5 100644 --- a/config/locales/fa.yml +++ b/config/locales/fa.yml @@ -748,6 +748,12 @@ fa: message_html: هیچ قانون کارسازی تعریف نکرده‌اید. sidekiq_process_check: message_html: صف(های) %{value} فاقد هیچونه فرایند Sidekiq هستند. لطفا تنظیمات Sidekiq خود را بازبینی کنید + software_version_critical_check: + action: مشاهده به‌روزرسانی‌های موجود + message_html: یک به‌روزرسانی حیاتی ماستودون موجود است، لطفا در اسرع وقت به‌روزرسانی کنید. + software_version_patch_check: + action: مشاهده به‌روزرسانی‌های موجود + message_html: یک به‌روزرسانی رفع اشکال ماستودون موجود است. upload_check_privacy_error: action: برای اطّلاعات بیش‌تر این‌جا را بررسی کنید message_html: "کارساز وبتان بد پیکربندی شده. محرمانگی کاربرانتان در خطر است." @@ -879,6 +885,9 @@ fa: apply_for_account: درخواست یک حساب captcha_confirmation: title: بررسی های امنیتی + confirmations: + login_link: ورود + welcome_title: خوش آمدید، %{name}! delete_account: پاک‌کردن حساب delete_account_html: اگر می‌خواهید حساب خود را پاک کنید، از این‌جا پیش بروید. از شما درخواست تأیید خواهد شد. description: @@ -901,6 +910,8 @@ fa: progress: confirm: تأیید رایانامه details: جزئیات شما + review: بررسی ما + rules: پذیرش قوانین providers: cas: CAS saml: SAML diff --git a/config/locales/fi.yml b/config/locales/fi.yml index 0f670847f4bc46..d6f327c327790d 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -1837,7 +1837,7 @@ fi: follow_limit_reached: Et voi seurata yli %{limit} henkilöä go_to_sso_account_settings: Avaa identiteettitarjoajasi tiliasetukset invalid_otp_token: Virheellinen kaksivaiheisen todentamisen koodi - otp_lost_help_html: Jos sinulla ei ole pääsyä kumpaankaan, voit ottaa yhteyttä osoitteeseen %{email} + otp_lost_help_html: Jos sinulla ei ole pääsyä kumpaankaan, voit ottaa yhteyden osoitteeseen %{email} seamless_external_login: Olet kirjautunut ulkoisen palvelun kautta, joten salasana- ja sähköpostiasetukset eivät ole käytettävissä. signed_in_as: 'Kirjautunut tilillä:' verification: diff --git a/config/locales/gl.yml b/config/locales/gl.yml index 525532ed98bbcc..f86b4fc20b777b 100644 --- a/config/locales/gl.yml +++ b/config/locales/gl.yml @@ -750,7 +750,7 @@ gl: title: Retención do contido default_noindex: desc_html: Aféctalle a tódalas usuarias que non cambiaron este axuste elas mesmas - title: Por omisión exclúe as usuarias do indexado por servidores de busca + title: Omitir por defecto ás usuarias do indexado por servidores de busca discovery: follow_recommendations: Recomendacións de seguimento preamble: Destacar contido interesante é importante para axudar a que as novas usuarias se sintan cómodas se non coñecen a ninguén en Mastodon. Xestiona os diferentes xeitos de promocionar contidos. @@ -1528,7 +1528,7 @@ gl: too_many_options: non pode haber máis de %{max} opcións preferences: other: Outro - posting_defaults: Valores por omisión + posting_defaults: Valores por defecto public_timelines: Cronoloxías públicas privacy: hint_html: "Personaliza o xeito no que queres que se atope o teu perfil e publicacións. Mastodon ten variedade de ferramentas para axudarche a acadar unha audiencia maior. Dedica un minuto a revisalas e confirma que se axustan ao teu caso persoal." @@ -1698,7 +1698,7 @@ gl: private_long: Mostrar só as seguidoras public: Público public_long: Visible para calquera - unlisted: Non listado + unlisted: Sen listar unlisted_long: Visible para calquera, pero non en cronoloxías públicas statuses_cleanup: enabled: Borrar automáticamente publicacións antigas diff --git a/config/locales/he.yml b/config/locales/he.yml index 2bd9f89c713a11..ea2ab8f29ab100 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -782,7 +782,7 @@ he: discovery: follow_recommendations: המלצות מעקב preamble: הצפה של תוכן מעניין בקבלת פני משתמשות חדשות שאולי אינן מכירות עדיין א.נשים במסטודון. ניתן לשלוט איך אפשרויות גילוי שונות עובדות על השרת שלך. - profile_directory: מדריך פרופילים + profile_directory: ספריית פרופילים public_timelines: פידים פומביים publish_discovered_servers: פרסום שרתים שנתגלו publish_statistics: פרסום הסטטיסטיקות בפומבי @@ -1417,7 +1417,7 @@ he: '604800': שבוע '86400': יום אחד expires_in_prompt: לעולם לא - generate: צור קישור להזמנה + generate: יצירת קישור להזמנה invited_by: הוזמנת ע"י max_uses: many: "%{count} שימושים" @@ -1425,9 +1425,9 @@ he: other: "%{count} שימושים" two: "%{count} שימושים" max_uses_prompt: ללא הגבלה - prompt: צור ושתף קישורים לאחרים על מנת להעניק גישה לשרת זה + prompt: צרו ושתפו קישורים לאחרים על מנת להעניק גישה לשרת זה table: - expires_at: פוקעת ב + expires_at: פג תוקף ב- uses: שימושים title: הזמנת אנשים lists: @@ -1917,7 +1917,7 @@ he: error: היתה בעיה בהוספת מפתח האבטחה. נסה שנית. success: מפתח האבטחה הוסף בהצלחה. delete: למחוק - delete_confirmation: האם אתה בטוח שברצונך למחוק מפתח אבטחה זה? + delete_confirmation: האם את.ה בטוח.ה שברצונך למחוק מפתח אבטחה זה? description_html: אם יאופשר אימות במפתח אבטחה, כניסה לאתר תדרוש שימוש באחד ממפתחות האבטחה שלך. destroy: error: היתה בעיה במחיקת מפתח האבטחה. נסה בשנית. diff --git a/config/locales/hr.yml b/config/locales/hr.yml index aa7ee760baf755..28bd830158476f 100644 --- a/config/locales/hr.yml +++ b/config/locales/hr.yml @@ -47,6 +47,8 @@ hr: followers: Pratitelji follows: Praćeni header: Zaglavlje + ip: IP + joined: Pridružen location: all: Sve local: Lokalno @@ -54,6 +56,11 @@ hr: title: Lokacija moderation: all: Sve + most_recent_activity: Nedavne aktivnosti + perform_full_suspension: Suspendiraj + protocol: Protokol + public: Javno + reject: Odbij action_logs: empty: Nema pronađenih izvješća. filter_by_action: Filtriraj prema radnji diff --git a/config/locales/nn.yml b/config/locales/nn.yml index 1c187c1de1f285..551824e800f6bb 100644 --- a/config/locales/nn.yml +++ b/config/locales/nn.yml @@ -534,6 +534,7 @@ nn: total_reported: Rapportar om dei total_storage: Medievedlegg totals_time_period_hint_html: Totalsum vist nedanfor gjeld data for alle tidsperiodar. + unknown_instance: Dette domenet er ukjent for denne serveren. invites: deactivate_all: Slå av alle filter: @@ -1101,6 +1102,7 @@ nn: functional: Kontoen din er fullt operativt. pending: Søknaden din ventar på gjennomgang frå personalet vårt. Dette kan taka litt tid. Du får ein e-post om søknaden din vert godkjend. redirecting_to: Kontoen din er inaktiv fordi den for øyeblikket omdirigerer til %{acct}. + self_destruct: Siden %{domain} stenger, vil du kun ha begrenset tilgang til kontoen din. view_strikes: Vis tidligere advarsler mot kontoen din too_fast: Skjemaet ble sendt inn for raskt, prøv på nytt. use_security_key: Bruk sikkerhetsnøkkel @@ -1570,6 +1572,9 @@ nn: over_daily_limit: Du har overskredet grensen på %{limit} planlagte tuter for den dagen over_total_limit: Du har overskredet grensen på %{limit} planlagte tuter too_soon: Den planlagte datoen må være i fremtiden + self_destruct: + lead_html: Dessverre stenger %{domain} for alltid. Hvis du hadde en konto der vil du ikke kunne fortsette å bruke den, men du kan fremdeles be om en sikkerhetskopi av dataene dine. + title: Denne serveren stenger sessions: activity: Siste aktivitet browser: Nettlesar diff --git a/config/locales/no.yml b/config/locales/no.yml index dc8151d552c448..1abfbdb97da49d 100644 --- a/config/locales/no.yml +++ b/config/locales/no.yml @@ -534,6 +534,7 @@ total_reported: Rapporter om dem total_storage: Mediavedlegg totals_time_period_hint_html: Summen som vises nedenfor inkluderer data for alle tider. + unknown_instance: Dette domenet er ukjent for denne serveren. invites: deactivate_all: Deaktiver alle filter: @@ -1096,6 +1097,7 @@ functional: Kontoen din er fullt operativt. pending: Søknaden din avventer gjennomgang av våre medarbeidere. Dette kan ta litt tid. Du vil motta en e-post dersom søknaden din blir godkjent. redirecting_to: Kontoen din er inaktiv fordi den for øyeblikket omdirigerer til %{acct}. + self_destruct: Siden %{domain} stenger, vil du kun ha begrenset tilgang til kontoen din. view_strikes: Vis tidligere advarsler mot kontoen din too_fast: Skjemaet ble sendt inn for raskt, prøv på nytt. use_security_key: Bruk sikkerhetsnøkkel @@ -1565,6 +1567,9 @@ over_daily_limit: Du har overskredet grensen på %{limit} planlagte innlegg for i dag over_total_limit: Du har overskredet grensen på %{limit} planlagte innlegg too_soon: Den planlagte datoen må være i fremtiden + self_destruct: + lead_html: Dessverre stenger %{domain} for alltid. Hvis du hadde en konto der vil du ikke kunne fortsette å bruke den, men du kan fremdeles be om en sikkerhetskopi av dataene dine. + title: Denne serveren stenger sessions: activity: Siste aktivitet browser: Nettleser diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 4e64f9cfd93572..d99c265fe29eb1 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -534,6 +534,7 @@ pt-BR: total_reported: Denúncias sobre eles total_storage: Mídias anexadas totals_time_period_hint_html: Os totais exibidos abaixo incluem dados para todo o tempo. + unknown_instance: Atualmente não há registros deste domínio neste servidor. invites: deactivate_all: Desativar todos filter: @@ -1040,6 +1041,12 @@ pt-BR: hint_html: Só mais uma coisa! Precisamos confirmar que você é um humano (isso é para que possamos evitar o spam!). Resolva o CAPTCHA abaixo e clique em "Continuar". title: Verificação de segurança confirmations: + awaiting_review: Seu endereço de e-mail foi confirmado! A equipe de %{domain} está agora revisando o seu cadastro. Eles lhe enviarão um e-mail se aprovarem a sua conta! + awaiting_review_title: Seu cadastro está sendo analisado + clicking_this_link: clicar este link + login_link: entrar + proceed_to_login_html: Agora você pode prosseguir para %{login_link}. + redirect_to_app_html: Você deveria ter sido redirecionado para o aplicativo %{app_name}. Se isso não aconteceu, tente %{clicking_this_link} ou volte manualmente para o aplicativo. registration_complete: Seu cadastro no %{domain} foi concluído! welcome_title: Boas vindas, %{name}! wrong_email_hint: Se esse endereço de e-mail não estiver correto, você pode alterá-lo nas configurações da conta. diff --git a/config/locales/simple_form.bg.yml b/config/locales/simple_form.bg.yml index d576da71c65c4c..68e45ef47bd4bf 100644 --- a/config/locales/simple_form.bg.yml +++ b/config/locales/simple_form.bg.yml @@ -295,7 +295,7 @@ bg: all: Известие за всички обновявания critical: Известие само за критични обновявания label: Има нова версия на Mastodon - none: Никога да не се известяват обновявания (не се препоръчва) + none: Никога да не се известява обновяване (непрепоръчително) patch: Известие за обновявания на оправени грешки trending_tag: Изискване на преглед за новонашумели rule: diff --git a/config/locales/simple_form.fa.yml b/config/locales/simple_form.fa.yml index 676eb192ee8c2f..5ff495a54023ba 100644 --- a/config/locales/simple_form.fa.yml +++ b/config/locales/simple_form.fa.yml @@ -84,6 +84,7 @@ fa: custom_css: می‌توانیدروی نگارش وب ماستودون سبک‌های سفارشی اعمال کنید. mascot: نقش میانای وب پیش‌رفته را پایمال می‌کند. media_cache_retention_period: اگر به مقدار مثبتی تنظیم شود، پرونده‌های رسانهٔ بارگرفته پس از روزهای مشخّص شده حذف خواهند شد و هنگام درخواست دوباره بارگرفته می‌شوند. + peers_api_enabled: فهرستی از نام‌های دامنه‌ای که این کارساز در فدیورس با آن مواجه شده است. هیچ اطلاعاتی در مورد اینکه آیا شما با یک کارساز داده شده متعهد هستید، در اینجا گنجانده نشده است، فقط کارساز شما در مورد آن می‌داند. این توسط خدماتی استفاده می‌شود که آمار مربوط به فدراسیون را به معنای کلی جمع‌آوری می‌کنند. profile_directory: شاخهٔ نمایه، همهٔ کاربرانی که کشف‌پذیری را برگزیده‌اند سیاهه می‌کند. require_invite_text: زمانی که نام‌نویسی ها نیازمند تایید دستی است، متن «چرا می‌خواهید بپیوندید؟» بخش درخواست دعوت را به جای اختیاری، اجباری کنید site_contact_email: چگونگی دسترسی افراد به شما برای مقاصد قانونی یا پشتیبانی. @@ -91,6 +92,7 @@ fa: site_extended_description: هر اطّلاعات بیش‌تری که ممکن است برای بازدیدکنندگان و کاربرانتان مفید باشد. می‌تواند به شکل مارک‌دون باشد. site_short_description: شرحی کوتاه برای کمک به شناسایی یکتای کارسازتان. چه‌کسی می‌گرداندش و برای چه کسیست؟ site_terms: از سیاست محرمانگی خوتان استفاده کرده یا برای استفاده از سیاست پیش‌گزیده خالی بگذارید. می‌تواند در قالب مارک‌دون باشد. + site_title: چگونه مردم ممکن است به کارساز شما علاوه بر نام دامنه آن مراجعه کنند. form_challenge: current_password: شما در حال ورود به یک منطقهٔ‌ حفاظت‌شده هستید imports: diff --git a/config/locales/simple_form.fi.yml b/config/locales/simple_form.fi.yml index 403162b8203525..bada4c3d0f10c7 100644 --- a/config/locales/simple_form.fi.yml +++ b/config/locales/simple_form.fi.yml @@ -252,7 +252,7 @@ fi: require_invite_text: Vaadi syy liittyä show_domain_blocks: Näytä verkkotunnusten estot show_domain_blocks_rationale: Näytä, miksi verkkotunnukset on estetty - site_contact_email: Ota yhteyttä sähköpostilla + site_contact_email: Ota yhteys sähköpostitse site_contact_username: Yhteyshenkilön käyttäjänimi site_extended_description: Laajennettu kuvaus site_short_description: Palvelimen kuvaus diff --git a/config/locales/simple_form.gl.yml b/config/locales/simple_form.gl.yml index 4eb4ae4f24530e..b917f551c7fb72 100644 --- a/config/locales/simple_form.gl.yml +++ b/config/locales/simple_form.gl.yml @@ -210,7 +210,7 @@ gl: setting_delete_modal: Solicitar confirmación antes de eliminar unha publicación setting_disable_swiping: Desactivar opcións de desprazamento setting_display_media: Mostrar multimedia - setting_display_media_default: Por omisión + setting_display_media_default: Por defecto setting_display_media_hide_all: Ocultar todo setting_display_media_show_all: Mostrar todo setting_expand_spoilers: Despregar sempre as publicacións marcadas con avisos de contido @@ -259,7 +259,7 @@ gl: site_terms: Política de Privacidade site_title: Nome do servidor status_page_url: URL da páxina do estado - theme: Decorado por omisión + theme: Decorado por defecto thumbnail: Icona do servidor timeline_preview: Permitir acceso á cronoloxía pública sen autenticación trendable_by_default: Permitir tendencias sen aprobación previa diff --git a/config/locales/simple_form.hr.yml b/config/locales/simple_form.hr.yml index 0f2896fe05d1d7..8f0178c7b2afe2 100644 --- a/config/locales/simple_form.hr.yml +++ b/config/locales/simple_form.hr.yml @@ -2,12 +2,18 @@ hr: simple_form: hints: + account: + display_name: Tvoje puno ime ili tvoj online nadimak. + account_warning_preset: + title: Proizvoljno. Nije vidljivo primatelju defaults: avatar: PNG, GIF ili JPG. Najviše %{size}. Bit će smanjeno na %{dimensions}px header: PNG, GIF ili JPG. Najviše %{size}. Bit će smanjeno na %{dimensions}px + password: Mora biti najmanje 8 znakova setting_display_media_default: Sakrij medijski sadržaj označen kao osjetljiv setting_display_media_hide_all: Uvijek sakrij medijski sadržaj setting_display_media_show_all: Uvijek prikaži medijski sadržaj + username: Mora sadržavati samo slova, brojeve i _ imports: data: CSV datoteka izvezena iz drugog Mastodonovog poslužitelja labels: diff --git a/config/locales/sv.yml b/config/locales/sv.yml index a6ee12ba2794f6..736d839f9104f3 100644 --- a/config/locales/sv.yml +++ b/config/locales/sv.yml @@ -1041,6 +1041,7 @@ sv: hint_html: En sista sak till! Vi måste bekräfta att du är en människa (för att hålla borta skräpinlägg!). Lös CAPTCHA nedan och klicka på "Fortsätt". title: Säkerhetskontroll confirmations: + awaiting_review: Din e-postadress är bekräftad! %{domain} personalen granskar nu din registrering. Du kommer att få ett e-postmeddelande om de godkänner ditt konto! awaiting_review_title: Din registrering är under granskning clicking_this_link: klicka på denna länk login_link: logga in diff --git a/config/locales/uk.yml b/config/locales/uk.yml index 85db04715b5727..eb947a7d0bfd48 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -54,14 +54,14 @@ uk: no_role: Немає ролі title: Змінити роль для %{username} confirm: Зберегти - confirmed: Підтвердити ел.адресу + confirmed: Підтверджено confirming: Зберігається custom: Власне delete: Видалити дані deleted: Видалено demote: Усунути destroyed_msg: Дані %{username} тепер в черзі на негайне видалення - disable: Вимкнути + disable: Заморозити disable_sign_in_token_auth: Вимкнути автентифікацію за допомогою е-пошти disable_two_factor_authentication: Вимкнути двофакторну авторизацію disabled: Вимкнено @@ -70,7 +70,7 @@ uk: edit: Змінити email: Електронна пошта email_status: Стан електронної пошти - enable: Увімкнути + enable: Розморозити enable_sign_in_token_auth: Увімкнути автентифікацію за допомогою е-пошти enabled: Увімкнено enabled_msg: Обліковий запис %{username} успішно розморожено diff --git a/config/locales/zh-HK.yml b/config/locales/zh-HK.yml index 236b2d0cf93a1e..58aeac84144e79 100644 --- a/config/locales/zh-HK.yml +++ b/config/locales/zh-HK.yml @@ -1023,6 +1023,14 @@ zh-HK: hint_html: 還有最後一步!我們需要確認你是人類(這樣我們才能杜絕垃圾郵件!)。解答下方的 CAPTCHA,然後點擊「繼續」。 title: 安全檢查 confirmations: + awaiting_review: 已確認你的電郵地址!%{domain} 的工作人員正在審核你的註冊資料。如果他們批准你的帳號,你將會收到電郵通知。 + awaiting_review_title: 正在審核你的註冊 + clicking_this_link: 點擊此連結 + login_link: 登入 + proceed_to_login_html: 你現在可前往 %{login_link} + redirect_to_app_html: 你應該已被重新導向%{app_name}應用程式。如果尚未被導向,請嘗試%{clicking_this_link}或自行回到應用程式。 + registration_complete: 你在%{domain}已完成註冊! + welcome_title: 歡迎,%{name}! wrong_email_hint: 如果該電郵地址不正確,你可以在帳號設定中修改。 delete_account: 刪除帳號 delete_account_html: 如果你想刪除你的帳號,請點擊這裡繼續。你需要確認你的操作。 diff --git a/db/migrate/20231001031337_add_quote_to_statuses.rb b/db/migrate/20231001031337_add_quote_to_statuses.rb index c60ec58ecf921d..ae42317ca01d5f 100644 --- a/db/migrate/20231001031337_add_quote_to_statuses.rb +++ b/db/migrate/20231001031337_add_quote_to_statuses.rb @@ -17,7 +17,7 @@ def up add_column_with_default :statuses, :quote_of_id, :bigint, default: nil, allow_null: true StatusReference.transaction do - StatusReference.where(quote: true).includes(:status).each do |ref| + StatusReference.where(quote: true).includes(:status).find_each do |ref| ref.status.update(quote_of_id: ref.target_status_id) end end diff --git a/lib/mastodon/cli/maintenance.rb b/lib/mastodon/cli/maintenance.rb index e73bcbf86a0ab5..a95b7a30cdd29d 100644 --- a/lib/mastodon/cli/maintenance.rb +++ b/lib/mastodon/cli/maintenance.rb @@ -136,24 +136,24 @@ class User < ApplicationRecord Mastodon has to be stopped to run this task, which will take a long time and may be destructive. LONG_DESC def fix_duplicates - if ActiveRecord::Migrator.current_version < MIN_SUPPORTED_VERSION - say 'Your version of the database schema is too old and is not supported by this script.', :red - say 'Please update to at least Mastodon 3.0.0 before running this script.', :red - exit(1) - elsif ActiveRecord::Migrator.current_version > MAX_SUPPORTED_VERSION - say 'Your version of the database schema is more recent than this script, this may cause unexpected errors.', :yellow - exit(1) unless yes?('Continue anyway? (Yes/No)') - end + verify_system_ready! - if Sidekiq::ProcessSet.new.any? - say 'It seems Sidekiq is running. All Mastodon processes need to be stopped when using this script.', :red - exit(1) - end + process_deduplications - say 'This task will take a long time to run and is potentially destructive.', :yellow - say 'Please make sure to stop Mastodon and have a backup.', :yellow - exit(1) unless yes?('Continue? (Yes/No)') + deduplication_cleanup_tasks + + say 'Finished!' + end + private + + def verify_system_ready! + verify_schema_version! + verify_sidekiq_not_active! + verify_backup_warning! + end + + def process_deduplications deduplicate_users! deduplicate_account_domain_blocks! deduplicate_account_identity_proofs! @@ -173,14 +173,44 @@ def fix_duplicates deduplicate_webauthn_credentials! deduplicate_webhooks! deduplicate_software_updates! + end - Scenic.database.refresh_materialized_view('instances', concurrently: true, cascade: false) if ActiveRecord::Migrator.current_version >= 2020_12_06_004238 + def deduplication_cleanup_tasks + refresh_instances_view if schema_has_instances_view? Rails.cache.clear + end - say 'Finished!' + def refresh_instances_view + Scenic.database.refresh_materialized_view('instances', concurrently: true, cascade: false) end - private + def schema_has_instances_view? + ActiveRecord::Migrator.current_version >= 2020_12_06_004238 + end + + def verify_schema_version! + if ActiveRecord::Migrator.current_version < MIN_SUPPORTED_VERSION + say 'Your version of the database schema is too old and is not supported by this script.', :red + say 'Please update to at least Mastodon 3.0.0 before running this script.', :red + exit(1) + elsif ActiveRecord::Migrator.current_version > MAX_SUPPORTED_VERSION + say 'Your version of the database schema is more recent than this script, this may cause unexpected errors.', :yellow + exit(1) unless yes?('Continue anyway? (Yes/No)') + end + end + + def verify_sidekiq_not_active! + if Sidekiq::ProcessSet.new.any? + say 'It seems Sidekiq is running. All Mastodon processes need to be stopped when using this script.', :red + exit(1) + end + end + + def verify_backup_warning! + say 'This task will take a long time to run and is potentially destructive.', :yellow + say 'Please make sure to stop Mastodon and have a backup.', :yellow + exit(1) unless yes?('Continue? (Yes/No)') + end def deduplicate_accounts! remove_index_if_exists!(:accounts, 'index_accounts_on_username_and_domain_lower') @@ -224,7 +254,7 @@ def deduplicate_users! users = User.where(id: row['ids'].split(',')).sort_by(&:updated_at).reverse ref_user = users.shift say "Multiple users registered with e-mail address #{ref_user.email}.", :yellow - say "e-mail will be disabled for the following accounts: #{user.map(&:account).map(&:acct).join(', ')}", :yellow + say "e-mail will be disabled for the following accounts: #{user.map { |user| user.account.acct }.join(', ')}", :yellow say 'Please reach out to them and set another address with `tootctl account modify` or delete them.', :yellow users.each_with_index do |user, index| @@ -253,7 +283,7 @@ def deduplicate_users! def deduplicate_users_process_confirmation_token ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM users WHERE confirmation_token IS NOT NULL GROUP BY confirmation_token HAVING count(*) > 1").each do |row| users = User.where(id: row['ids'].split(',')).sort_by(&:created_at).reverse.drop(1) - say "Unsetting confirmation token for those accounts: #{users.map(&:account).map(&:acct).join(', ')}", :yellow + say "Unsetting confirmation token for those accounts: #{users.map { |user| user.account.acct }.join(', ')}", :yellow users.each do |user| user.update!(confirmation_token: nil) @@ -265,7 +295,7 @@ def deduplicate_users_process_remember_token if ActiveRecord::Migrator.current_version < 2022_01_18_183010 ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM users WHERE remember_token IS NOT NULL GROUP BY remember_token HAVING count(*) > 1").each do |row| users = User.where(id: row['ids'].split(',')).sort_by(&:updated_at).reverse.drop(1) - say "Unsetting remember token for those accounts: #{users.map(&:account).map(&:acct).join(', ')}", :yellow + say "Unsetting remember token for those accounts: #{users.map { |user| user.account.acct }.join(', ')}", :yellow users.each do |user| user.update!(remember_token: nil) @@ -277,7 +307,7 @@ def deduplicate_users_process_remember_token def deduplicate_users_process_password_token ActiveRecord::Base.connection.select_all("SELECT string_agg(id::text, ',') AS ids FROM users WHERE reset_password_token IS NOT NULL GROUP BY reset_password_token HAVING count(*) > 1").each do |row| users = User.where(id: row['ids'].split(',')).sort_by(&:updated_at).reverse.drop(1) - say "Unsetting password reset token for those accounts: #{users.map(&:account).map(&:acct).join(', ')}", :yellow + say "Unsetting password reset token for those accounts: #{users.map { |user| user.account.acct }.join(', ')}", :yellow users.each do |user| user.update!(reset_password_token: nil) diff --git a/lib/sanitize_ext/sanitize_config.rb b/lib/sanitize_ext/sanitize_config.rb index d8a841a0478583..b1bf1e58cd13a0 100644 --- a/lib/sanitize_ext/sanitize_config.rb +++ b/lib/sanitize_ext/sanitize_config.rb @@ -87,7 +87,7 @@ module Config current_node.wrap('

') end - MASTODON_STRICT ||= freeze_config( + MASTODON_STRICT = freeze_config( elements: %w(p br span a del pre blockquote code b strong u i em ul ol li), attributes: { @@ -115,7 +115,7 @@ module Config ] ) - MASTODON_OEMBED ||= freeze_config( + MASTODON_OEMBED = freeze_config( elements: %w(audio embed iframe source video), attributes: { diff --git a/spec/controllers/admin/accounts_controller_spec.rb b/spec/controllers/admin/accounts_controller_spec.rb index b57ec671416164..ba03ec85a4c160 100644 --- a/spec/controllers/admin/accounts_controller_spec.rb +++ b/spec/controllers/admin/accounts_controller_spec.rb @@ -18,9 +18,20 @@ end it 'filters with parameters' do - new = AccountFilter.method(:new) + account_filter = instance_double(AccountFilter, results: Account.all) + allow(AccountFilter).to receive(:new).and_return(account_filter) - expect(AccountFilter).to receive(:new) do |params| + get :index, params: { + origin: 'local', + by_domain: 'domain', + status: 'active', + username: 'username', + display_name: 'display name', + email: 'local-part@domain', + ip: '0.0.0.42', + } + + expect(AccountFilter).to have_received(:new) do |params| h = params.to_h expect(h[:origin]).to eq 'local' @@ -30,19 +41,7 @@ expect(h[:display_name]).to eq 'display name' expect(h[:email]).to eq 'local-part@domain' expect(h[:ip]).to eq '0.0.0.42' - - new.call({}) end - - get :index, params: { - origin: 'local', - by_domain: 'domain', - status: 'active', - username: 'username', - display_name: 'display name', - email: 'local-part@domain', - ip: '0.0.0.42', - } end it 'paginates accounts' do diff --git a/spec/controllers/admin/settings/branding_controller_spec.rb b/spec/controllers/admin/settings/branding_controller_spec.rb index 4b0f1e21e014e5..435616022aa2ba 100644 --- a/spec/controllers/admin/settings/branding_controller_spec.rb +++ b/spec/controllers/admin/settings/branding_controller_spec.rb @@ -19,10 +19,6 @@ end describe 'PUT #update' do - before do - allow_any_instance_of(Form::AdminSettings).to receive(:valid?).and_return(true) - end - around do |example| before = Setting.site_short_description Setting.site_short_description = nil diff --git a/spec/controllers/api/v1/streaming_controller_spec.rb b/spec/controllers/api/v1/streaming_controller_spec.rb index 7014ed9b2bead8..06639a13fdb6b2 100644 --- a/spec/controllers/api/v1/streaming_controller_spec.rb +++ b/spec/controllers/api/v1/streaming_controller_spec.rb @@ -3,14 +3,14 @@ require 'rails_helper' describe Api::V1::StreamingController do - around(:each) do |example| + around do |example| before = Rails.configuration.x.streaming_api_base_url Rails.configuration.x.streaming_api_base_url = Rails.configuration.x.web_domain example.run Rails.configuration.x.streaming_api_base_url = before end - before(:each) do + before do request.headers.merge! Host: Rails.configuration.x.web_domain end @@ -24,7 +24,7 @@ end context 'with streaming api on different host' do - before(:each) do + before do Rails.configuration.x.streaming_api_base_url = "wss://streaming-#{Rails.configuration.x.web_domain}" @streaming_host = URI.parse(Rails.configuration.x.streaming_api_base_url).host end diff --git a/spec/controllers/api/v2/search_controller_spec.rb b/spec/controllers/api/v2/search_controller_spec.rb index a3b92fc37a632d..d3ff42d6a04f3b 100644 --- a/spec/controllers/api/v2/search_controller_spec.rb +++ b/spec/controllers/api/v2/search_controller_spec.rb @@ -53,7 +53,7 @@ context 'without token' do describe 'GET #index' do - let(:search_params) {} + let(:search_params) { nil } before do get :index, params: search_params diff --git a/spec/controllers/emojis_controller_spec.rb b/spec/controllers/emojis_controller_spec.rb index 249dfd9d511873..3fe19ee5ce36c5 100644 --- a/spec/controllers/emojis_controller_spec.rb +++ b/spec/controllers/emojis_controller_spec.rb @@ -8,13 +8,11 @@ let(:emoji) { Fabricate(:custom_emoji) } describe 'GET #show' do - subject(:body) { JSON.parse(response.body, symbolize_names: true) } - let(:response) { get :show, params: { id: emoji.id, format: :json } } it 'returns the right response' do expect(response).to have_http_status 200 - expect(body[:name]).to eq ':coolcat:' + expect(body_as_json[:name]).to eq ':coolcat:' end end end diff --git a/spec/controllers/well_known/webfinger_controller_spec.rb b/spec/controllers/well_known/webfinger_controller_spec.rb index 20770a72114b3e..6610f4d138e1e2 100644 --- a/spec/controllers/well_known/webfinger_controller_spec.rb +++ b/spec/controllers/well_known/webfinger_controller_spec.rb @@ -16,7 +16,7 @@ let(:alice) { Fabricate(:account, username: 'alice') } let(:resource) { nil } - around(:each) do |example| + around do |example| tmp = Rails.configuration.x.alternate_domains Rails.configuration.x.alternate_domains = alternate_domains example.run diff --git a/spec/fabricators/access_token_fabricator.rb b/spec/fabricators/access_token_fabricator.rb index 508c328085da4a..d07f1ca14fd9fd 100644 --- a/spec/fabricators/access_token_fabricator.rb +++ b/spec/fabricators/access_token_fabricator.rb @@ -1,4 +1,3 @@ # frozen_string_literal: true -Fabricator :access_token, from: 'Doorkeeper::AccessToken' do -end +Fabricator :access_token, from: 'Doorkeeper::AccessToken' diff --git a/spec/fabricators/conversation_fabricator.rb b/spec/fabricators/conversation_fabricator.rb index 07c6780bf96952..5440e4380c72d9 100644 --- a/spec/fabricators/conversation_fabricator.rb +++ b/spec/fabricators/conversation_fabricator.rb @@ -1,4 +1,3 @@ # frozen_string_literal: true -Fabricator(:conversation) do -end +Fabricator(:conversation) diff --git a/spec/fabricators/system_key_fabricator.rb b/spec/fabricators/system_key_fabricator.rb index ef6cec9c40dc01..bcb3bd5577b14f 100644 --- a/spec/fabricators/system_key_fabricator.rb +++ b/spec/fabricators/system_key_fabricator.rb @@ -1,4 +1,3 @@ # frozen_string_literal: true -Fabricator(:system_key) do -end +Fabricator(:system_key) diff --git a/spec/features/captcha_spec.rb b/spec/features/captcha_spec.rb index a5c5a44aa628a1..906aec4af977bd 100644 --- a/spec/features/captcha_spec.rb +++ b/spec/features/captcha_spec.rb @@ -7,11 +7,7 @@ let(:client_app) { nil } before do - # rubocop:disable RSpec/AnyInstance -- easiest way to deal with that that I know of - allow_any_instance_of(Auth::ConfirmationsController).to receive(:captcha_enabled?).and_return(true) - allow_any_instance_of(Auth::ConfirmationsController).to receive(:check_captcha!).and_return(true) - allow_any_instance_of(Auth::ConfirmationsController).to receive(:render_captcha).and_return(nil) - # rubocop:enable RSpec/AnyInstance + allow(Auth::ConfirmationsController).to receive(:new).and_return(stubbed_controller) end context 'when the user signed up through an app' do @@ -40,4 +36,12 @@ expect(page).to have_link(I18n.t('auth.confirmations.clicking_this_link'), href: client_app.confirmation_redirect_uri) end end + + private + + def stubbed_controller + Auth::ConfirmationsController.new.tap do |controller| + allow(controller).to receive_messages(captcha_enabled?: true, check_captcha!: true, render_captcha: nil) + end + end end diff --git a/spec/helpers/admin/account_moderation_notes_helper_spec.rb b/spec/helpers/admin/account_moderation_notes_helper_spec.rb index 6386f07ac921e0..91bf4ab6fe7df1 100644 --- a/spec/helpers/admin/account_moderation_notes_helper_spec.rb +++ b/spec/helpers/admin/account_moderation_notes_helper_spec.rb @@ -18,13 +18,15 @@ let(:account) { Fabricate(:account) } it 'calls #link_to' do - expect(helper).to receive(:link_to).with( + allow(helper).to receive(:link_to) + + helper.admin_account_link_to(account) + + expect(helper).to have_received(:link_to).with( admin_account_path(account.id), class: name_tag_classes(account), title: account.acct ) - - helper.admin_account_link_to(account) end end end diff --git a/spec/helpers/instance_helper_spec.rb b/spec/helpers/instance_helper_spec.rb index c2e26dbed373f3..cdbce565984576 100644 --- a/spec/helpers/instance_helper_spec.rb +++ b/spec/helpers/instance_helper_spec.rb @@ -18,7 +18,7 @@ end describe 'site_hostname' do - around(:each) do |example| + around do |example| before = Rails.configuration.x.local_domain example.run Rails.configuration.x.local_domain = before diff --git a/spec/lib/account_statuses_filter_spec.rb b/spec/lib/account_statuses_filter_spec.rb index 1f9868f2fb3bcd..0e0e2ba5928832 100644 --- a/spec/lib/account_statuses_filter_spec.rb +++ b/spec/lib/account_statuses_filter_spec.rb @@ -3,8 +3,6 @@ require 'rails_helper' RSpec.describe AccountStatusesFilter do - subject { described_class.new(account, current_account, params) } - let(:account) { Fabricate(:account) } let(:current_account) { nil } let(:params) { {} } @@ -38,6 +36,8 @@ def status_with_media_attachment!(visibility) end describe '#results' do + subject { described_class.new(account, current_account, params).results } + let(:tag) { Fabricate(:tag) } before do @@ -61,7 +61,7 @@ def status_with_media_attachment!(visibility) let(:params) { { only_media: true } } it 'returns only statuses with media' do - expect(subject.results.all?(&:with_media?)).to be true + expect(subject.all?(&:with_media?)).to be true end end @@ -69,7 +69,7 @@ def status_with_media_attachment!(visibility) let(:params) { { tagged: tag.name } } it 'returns only statuses with tag' do - expect(subject.results.all? { |s| s.tags.include?(tag) }).to be true + expect(subject.all? { |s| s.tags.include?(tag) }).to be true end end @@ -77,7 +77,7 @@ def status_with_media_attachment!(visibility) let(:params) { { exclude_replies: true } } it 'returns only statuses that are not replies' do - expect(subject.results.none?(&:reply?)).to be true + expect(subject.none?(&:reply?)).to be true end end @@ -85,7 +85,7 @@ def status_with_media_attachment!(visibility) let(:params) { { exclude_reblogs: true } } it 'returns only statuses that are not reblogs' do - expect(subject.results.none?(&:reblog?)).to be true + expect(subject.none?(&:reblog?)).to be true end end end @@ -94,16 +94,12 @@ def status_with_media_attachment!(visibility) let(:current_account) { nil } let(:direct_status) { nil } - it 'returns only public statuses' do - expect(subject.results.pluck(:visibility).uniq).to match_array %w(unlisted public_unlisted public) - end + it 'returns only public statuses, public replies, and public reblogs' do + expect(results_unique_visibilities).to match_array %w(unlisted public_unlisted public) - it 'returns public replies' do - expect(subject.results.pluck(:in_reply_to_id)).to_not be_empty - end + expect(results_in_reply_to_ids).to_not be_empty - it 'returns public reblogs' do - expect(subject.results.pluck(:reblog_of_id)).to_not be_empty + expect(results_reblog_of_ids).to_not be_empty end it_behaves_like 'filter params' @@ -117,23 +113,19 @@ def status_with_media_attachment!(visibility) end it 'returns nothing' do - expect(subject.results.to_a).to be_empty + expect(subject.to_a).to be_empty end end context 'when accessed by self' do let(:current_account) { account } - it 'returns everything' do - expect(subject.results.pluck(:visibility).uniq).to match_array %w(direct private login unlisted public_unlisted public limited) - end + it 'returns all statuses, replies, and reblogs' do + expect(results_unique_visibilities).to match_array %w(direct private login unlisted public_unlisted public limited) - it 'returns replies' do - expect(subject.results.pluck(:in_reply_to_id)).to_not be_empty - end + expect(results_in_reply_to_ids).to_not be_empty - it 'returns reblogs' do - expect(subject.results.pluck(:reblog_of_id)).to_not be_empty + expect(results_reblog_of_ids).to_not be_empty end it_behaves_like 'filter params' @@ -146,23 +138,19 @@ def status_with_media_attachment!(visibility) current_account.follow!(account) end - it 'returns private statuses' do - expect(subject.results.pluck(:visibility).uniq).to match_array %w(private login unlisted public_unlisted public) - end + it 'returns private statuses, replies, and reblogs' do + expect(results_unique_visibilities).to match_array %w(private login unlisted public_unlisted public) - it 'returns replies' do - expect(subject.results.pluck(:in_reply_to_id)).to_not be_empty - end + expect(results_in_reply_to_ids).to_not be_empty - it 'returns reblogs' do - expect(subject.results.pluck(:reblog_of_id)).to_not be_empty + expect(results_reblog_of_ids).to_not be_empty end context 'when there is a direct status mentioning the non-follower' do let!(:direct_status) { status_with_mention!(:direct, current_account) } it 'returns the direct status' do - expect(subject.results.pluck(:id)).to include(direct_status.id) + expect(results_ids).to include(direct_status.id) end end @@ -196,23 +184,19 @@ def status_with_media_attachment!(visibility) context 'when accessed by a non-follower' do let(:current_account) { Fabricate(:account) } - it 'returns only public statuses' do - expect(subject.results.pluck(:visibility).uniq).to match_array %w(login unlisted public_unlisted public) - end + it 'returns only public statuses, replies, and reblogs' do + expect(results_unique_visibilities).to match_array %w(login unlisted public_unlisted public) - it 'returns public replies' do - expect(subject.results.pluck(:in_reply_to_id)).to_not be_empty - end + expect(results_in_reply_to_ids).to_not be_empty - it 'returns public reblogs' do - expect(subject.results.pluck(:reblog_of_id)).to_not be_empty + expect(results_reblog_of_ids).to_not be_empty end context 'when there is a private status mentioning the non-follower' do let!(:private_status) { status_with_mention!(:private, current_account) } it 'returns the private status' do - expect(subject.results.pluck(:id)).to include(private_status.id) + expect(results_ids).to include(private_status.id) end end @@ -224,7 +208,7 @@ def status_with_media_attachment!(visibility) end it 'does not return reblog of blocked account' do - expect(subject.results.pluck(:id)).to_not include(reblog.id) + expect(results_ids).to_not include(reblog.id) end end @@ -238,7 +222,7 @@ def status_with_media_attachment!(visibility) end it 'does not return reblog of blocked domain' do - expect(subject.results.pluck(:id)).to_not include(reblog.id) + expect(results_ids).to_not include(reblog.id) end end @@ -252,7 +236,7 @@ def status_with_media_attachment!(visibility) end it 'returns the reblog from the non-blocked domain' do - expect(subject.results.pluck(:id)).to include(reblog.id) + expect(results_ids).to include(reblog.id) end end @@ -264,7 +248,7 @@ def status_with_media_attachment!(visibility) end it 'does not return reblog of muted account' do - expect(subject.results.pluck(:id)).to_not include(reblog.id) + expect(results_ids).to_not include(reblog.id) end end @@ -276,11 +260,29 @@ def status_with_media_attachment!(visibility) end it 'does not return reblog of blocked-by account' do - expect(subject.results.pluck(:id)).to_not include(reblog.id) + expect(results_ids).to_not include(reblog.id) end end it_behaves_like 'filter params' end + + private + + def results_unique_visibilities + subject.pluck(:visibility).uniq + end + + def results_in_reply_to_ids + subject.pluck(:in_reply_to_id) + end + + def results_reblog_of_ids + subject.pluck(:reblog_of_id) + end + + def results_ids + subject.pluck(:id) + end end end diff --git a/spec/lib/activitypub/adapter_spec.rb b/spec/lib/activitypub/adapter_spec.rb index f9f8b8dce0d81d..7d8d703ec2586b 100644 --- a/spec/lib/activitypub/adapter_spec.rb +++ b/spec/lib/activitypub/adapter_spec.rb @@ -53,7 +53,7 @@ def virtual_object describe '#serializable_hash' do subject { ActiveModelSerializers::SerializableResource.new(TestObject.new(foo: 'bar'), serializer: serializer_class, adapter: described_class).as_json } - let(:serializer_class) {} + let(:serializer_class) { nil } context 'when serializer defines no context' do let(:serializer_class) { TestWithBasicContextSerializer } diff --git a/spec/lib/mastodon/cli/maintenance_spec.rb b/spec/lib/mastodon/cli/maintenance_spec.rb index 12cd9ca8a6500b..a6789ea5a41c46 100644 --- a/spec/lib/mastodon/cli/maintenance_spec.rb +++ b/spec/lib/mastodon/cli/maintenance_spec.rb @@ -4,9 +4,51 @@ require 'mastodon/cli/maintenance' describe Mastodon::CLI::Maintenance do + let(:cli) { described_class.new } + describe '.exit_on_failure?' do it 'returns true' do expect(described_class.exit_on_failure?).to be true end end + + describe '#fix_duplicates' do + context 'when the database version is too old' do + before do + allow(ActiveRecord::Migrator).to receive(:current_version).and_return(2000_01_01_000000) # Earlier than minimum + end + + it 'Exits with error message' do + expect { cli.invoke :fix_duplicates }.to output( + a_string_including('is too old') + ).to_stdout.and raise_error(SystemExit) + end + end + + context 'when the database version is too new and the user does not continue' do + before do + allow(ActiveRecord::Migrator).to receive(:current_version).and_return(2100_01_01_000000) # Later than maximum + allow(cli.shell).to receive(:yes?).with('Continue anyway? (Yes/No)').and_return(false).once + end + + it 'Exits with error message' do + expect { cli.invoke :fix_duplicates }.to output( + a_string_including('more recent') + ).to_stdout.and raise_error(SystemExit) + end + end + + context 'when Sidekiq is running' do + before do + allow(ActiveRecord::Migrator).to receive(:current_version).and_return(2022_01_01_000000) # Higher than minimum, lower than maximum + allow(Sidekiq::ProcessSet).to receive(:new).and_return [:process] + end + + it 'Exits with error message' do + expect { cli.invoke :fix_duplicates }.to output( + a_string_including('Sidekiq is running') + ).to_stdout.and raise_error(SystemExit) + end + end + end end diff --git a/spec/lib/webfinger_resource_spec.rb b/spec/lib/webfinger_resource_spec.rb index 558a318927fcc8..0e2bdcb71ad6d9 100644 --- a/spec/lib/webfinger_resource_spec.rb +++ b/spec/lib/webfinger_resource_spec.rb @@ -29,12 +29,16 @@ allow(recognized).to receive(:[]).with(:username).and_return('alice') allow(recognized).to receive(:[]).with(:action).and_return('create') - expect(Rails.application.routes).to receive(:recognize_path).with(resource).and_return(recognized).at_least(:once) + allow(Rails.application.routes).to receive(:recognize_path).with(resource).and_return(recognized) expect do described_class.new(resource).username end.to raise_error(ActiveRecord::RecordNotFound) expect(recognized).to have_received(:[]).exactly(3).times + + expect(Rails.application.routes).to have_received(:recognize_path) + .with(resource) + .at_least(:once) end it 'raises with a string that doesnt start with URL' do diff --git a/spec/models/admin/account_action_spec.rb b/spec/models/admin/account_action_spec.rb index b47561dd4855f7..604fe73189a354 100644 --- a/spec/models/admin/account_action_spec.rb +++ b/spec/models/admin/account_action_spec.rb @@ -78,13 +78,15 @@ end it 'calls process_email!' do - expect(account_action).to receive(:process_email!) + allow(account_action).to receive(:process_email!) subject + expect(account_action).to have_received(:process_email!) end it 'calls process_reports!' do - expect(account_action).to receive(:process_reports!) + allow(account_action).to receive(:process_reports!) subject + expect(account_action).to have_received(:process_reports!) end end diff --git a/spec/models/concerns/remotable_spec.rb b/spec/models/concerns/remotable_spec.rb index b2aa56a7047c8b..6413b6f467980b 100644 --- a/spec/models/concerns/remotable_spec.rb +++ b/spec/models/concerns/remotable_spec.rb @@ -120,8 +120,11 @@ def self.attachment_definitions end it 'does not try to write attribute' do - expect(foo).to_not receive('[]=').with(attribute_name, url) + allow(foo).to receive('[]=').with(attribute_name, url) + foo.hoge_remote_url = url + + expect(foo).to_not have_received('[]=').with(attribute_name, url) end end @@ -131,8 +134,11 @@ def self.attachment_definitions end it 'does not try to write attribute' do - expect(foo).to receive('[]=').with(attribute_name, url) + allow(foo).to receive('[]=').with(attribute_name, url) + foo.hoge_remote_url = url + + expect(foo).to have_received('[]=').with(attribute_name, url) end end @@ -146,10 +152,13 @@ def self.attachment_definitions let(:code) { 500 } it 'does not assign file' do - expect(foo).to_not receive(:public_send).with("#{hoge}=", any_args) - expect(foo).to_not receive(:public_send).with("#{hoge}_file_name=", any_args) + allow(foo).to receive(:public_send) + allow(foo).to receive(:public_send) foo.hoge_remote_url = url + + expect(foo).to_not have_received(:public_send).with("#{hoge}=", any_args) + expect(foo).to_not have_received(:public_send).with("#{hoge}_file_name=", any_args) end end @@ -165,13 +174,13 @@ def self.attachment_definitions allow(ResponseWithLimit).to receive(:new).with(anything, anything).and_return(response_with_limit) - expect(foo).to receive(:public_send).with("download_#{hoge}!", url) - + allow(foo).to receive(:public_send) foo.hoge_remote_url = url + expect(foo).to have_received(:public_send).with("download_#{hoge}!", url) - expect(foo).to receive(:public_send).with("#{hoge}=", response_with_limit) - + allow(foo).to receive(:public_send) foo.download_hoge!(url) + expect(foo).to have_received(:public_send).with("#{hoge}=", response_with_limit) end end end @@ -193,10 +202,13 @@ def self.attachment_definitions let(:error_class) { error_class } it 'calls Rails.logger.debug' do - expect(Rails.logger).to receive(:debug) do |&block| + allow(Rails.logger).to receive(:debug) + + foo.hoge_remote_url = url + + expect(Rails.logger).to have_received(:debug) do |&block| expect(block.call).to match(/^Error fetching remote #{hoge}: /) end - foo.hoge_remote_url = url end end end diff --git a/spec/models/follow_request_spec.rb b/spec/models/follow_request_spec.rb index e413747852f607..9cccb82903c916 100644 --- a/spec/models/follow_request_spec.rb +++ b/spec/models/follow_request_spec.rb @@ -21,12 +21,17 @@ end it 'calls Account#follow!, MergeWorker.perform_async, and #destroy!' do - expect(account).to receive(:follow!).with(target_account, reblogs: true, notify: false, uri: follow_request.uri, languages: nil, bypass_limit: true) do + allow(account).to receive(:follow!) do account.active_relationships.create!(target_account: target_account) end - expect(MergeWorker).to receive(:perform_async).with(target_account.id, account.id) - expect(follow_request).to receive(:destroy!) + allow(MergeWorker).to receive(:perform_async) + allow(follow_request).to receive(:destroy!) + follow_request.authorize! + + expect(account).to have_received(:follow!).with(target_account, reblogs: true, notify: false, uri: follow_request.uri, languages: nil, bypass_limit: true) + expect(MergeWorker).to have_received(:perform_async).with(target_account.id, account.id) + expect(follow_request).to have_received(:destroy!) end it 'correctly passes show_reblogs when true' do diff --git a/spec/models/identity_spec.rb b/spec/models/identity_spec.rb index 2fca1e1c14e254..70224544433c8d 100644 --- a/spec/models/identity_spec.rb +++ b/spec/models/identity_spec.rb @@ -7,8 +7,11 @@ let(:auth) { Fabricate(:identity, user: Fabricate(:user)) } it 'calls .find_or_create_by' do - expect(described_class).to receive(:find_or_create_by).with(uid: auth.uid, provider: auth.provider) + allow(described_class).to receive(:find_or_create_by) + described_class.find_for_oauth(auth) + + expect(described_class).to have_received(:find_or_create_by).with(uid: auth.uid, provider: auth.provider) end it 'returns an instance of Identity' do diff --git a/spec/models/session_activation_spec.rb b/spec/models/session_activation_spec.rb index 75842e25bad223..4012d46fd70920 100644 --- a/spec/models/session_activation_spec.rb +++ b/spec/models/session_activation_spec.rb @@ -74,9 +74,13 @@ let(:options) { { user: Fabricate(:user), session_id: '1' } } it 'calls create! and purge_old' do - expect(described_class).to receive(:create!).with(**options) - expect(described_class).to receive(:purge_old) + allow(described_class).to receive(:create!).with(**options) + allow(described_class).to receive(:purge_old) + described_class.activate(**options) + + expect(described_class).to have_received(:create!).with(**options) + expect(described_class).to have_received(:purge_old) end it 'returns an instance of SessionActivation' do diff --git a/spec/models/setting_spec.rb b/spec/models/setting_spec.rb index 5ed5c5d766c5ec..5f53ee56341196 100644 --- a/spec/models/setting_spec.rb +++ b/spec/models/setting_spec.rb @@ -23,8 +23,11 @@ let(:rails_initialized) { false } it 'calls RailsSettings::Base#[]' do - expect(RailsSettings::Base).to receive(:[]).with(key) + allow(RailsSettings::Base).to receive(:[]).with(key) + described_class[key] + + expect(RailsSettings::Base).to have_received(:[]).with(key) end end @@ -38,8 +41,11 @@ let(:cache_value) { 'cache-value' } it 'calls not RailsSettings::Base#[]' do - expect(RailsSettings::Base).to_not receive(:[]).with(key) + allow(RailsSettings::Base).to receive(:[]).with(key) + described_class[key] + + expect(RailsSettings::Base).to_not have_received(:[]).with(key) end context 'when Rails.cache does not exists' do @@ -56,8 +62,11 @@ let(:records) { [Fabricate(:setting, var: key, value: nil)] } it 'calls RailsSettings::Settings.object' do - expect(RailsSettings::Settings).to receive(:object).with(key) + allow(RailsSettings::Settings).to receive(:object).with(key) + described_class[key] + + expect(RailsSettings::Settings).to have_received(:object).with(key) end context 'when RailsSettings::Settings.object returns truthy' do diff --git a/spec/models/user_role_spec.rb b/spec/models/user_role_spec.rb index f7cfe9bb043123..d5234ebe8d96a9 100644 --- a/spec/models/user_role_spec.rb +++ b/spec/models/user_role_spec.rb @@ -60,7 +60,7 @@ end describe '#permissions_as_keys=' do - let(:input) {} + let(:input) { nil } before do subject.permissions_as_keys = input diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 92ce87e3696329..faf7fabf1e0c6a 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -102,7 +102,7 @@ end describe 'blacklist' do - around(:each) do |example| + around do |example| old_blacklist = Rails.configuration.x.email_blacklist Rails.configuration.x.email_domains_blacklist = 'mvrht.com' @@ -169,7 +169,7 @@ let(:user) { Fabricate(:user, confirmed_at: nil, unconfirmed_email: new_email) } context 'when the user is already approved' do - around(:example) do |example| + around do |example| registrations_mode = Setting.registrations_mode Setting.registrations_mode = 'approved' @@ -193,7 +193,7 @@ end context 'when the user does not require explicit approval' do - around(:example) do |example| + around do |example| registrations_mode = Setting.registrations_mode Setting.registrations_mode = 'open' @@ -213,7 +213,7 @@ end context 'when the user requires explicit approval but is not approved' do - around(:example) do |example| + around do |example| registrations_mode = Setting.registrations_mode Setting.registrations_mode = 'approved' @@ -237,7 +237,7 @@ describe '#approve!' do subject { user.approve! } - around(:example) do |example| + around do |example| registrations_mode = Setting.registrations_mode Setting.registrations_mode = 'approved' @@ -338,7 +338,7 @@ end describe 'whitelist' do - around(:each) do |example| + around do |example| old_whitelist = Rails.configuration.x.email_domains_whitelist Rails.configuration.x.email_domains_whitelist = 'mastodon.space' diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb index 8d9677f6ced70f..c2ef3e3159c2e9 100644 --- a/spec/rails_helper.rb +++ b/spec/rails_helper.rb @@ -142,13 +142,13 @@ def sign_in(resource, _deprecated = nil, scope: nil) search_data_manager.remove_indexes end - config.before(:each) do |example| + config.before do |example| unless example.metadata[:paperclip_processing] allow_any_instance_of(Paperclip::Attachment).to receive(:post_process).and_return(true) # rubocop:disable RSpec/AnyInstance end end - config.after :each do + config.after do Rails.cache.clear redis.del(redis.keys) end diff --git a/spec/requests/cache_spec.rb b/spec/requests/cache_spec.rb index c391c8b3da9f51..1e31c28ca40898 100644 --- a/spec/requests/cache_spec.rb +++ b/spec/requests/cache_spec.rb @@ -171,12 +171,10 @@ module DisabledAnonymousAPI let(:user) { Fabricate(:user, role: UserRole.find_by(name: 'Moderator')) } before do - # rubocop:disable Style/NumericLiterals - status = Fabricate(:status, account: alice, id: 110224538612341312) - Fabricate(:status, account: alice, id: 110224538643211312, visibility: :private) + status = Fabricate(:status, account: alice, id: '110224538612341312') + Fabricate(:status, account: alice, id: '110224538643211312', visibility: :private) Fabricate(:invite, code: 'abcdef') - Fabricate(:poll, status: status, account: alice, id: 12345) - # rubocop:enable Style/NumericLiterals + Fabricate(:poll, status: status, account: alice, id: '12345') user.account.follow!(alice) end diff --git a/spec/serializers/activitypub/device_serializer_spec.rb b/spec/serializers/activitypub/device_serializer_spec.rb index 2a3be821214132..23f0b24c4eabf5 100644 --- a/spec/serializers/activitypub/device_serializer_spec.rb +++ b/spec/serializers/activitypub/device_serializer_spec.rb @@ -3,13 +3,7 @@ require 'rails_helper' describe ActivityPub::DeviceSerializer do - let(:serialization) do - JSON.parse( - ActiveModelSerializers::SerializableResource.new( - record, serializer: described_class - ).to_json - ) - end + let(:serialization) { serialized_record_json(record, described_class) } let(:record) { Fabricate(:device) } describe 'type' do diff --git a/spec/serializers/activitypub/note_serializer_spec.rb b/spec/serializers/activitypub/note_serializer_spec.rb index 0c8c78e7a9e7a0..e60144d3208c8f 100644 --- a/spec/serializers/activitypub/note_serializer_spec.rb +++ b/spec/serializers/activitypub/note_serializer_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' describe ActivityPub::NoteSerializer do - subject { JSON.parse(@serialization.to_json) } + subject { serialized_record_json(parent, described_class, adapter: ActivityPub::Adapter) } let(:visibility) { :public } let(:searchability) { :public } @@ -18,10 +18,9 @@ let!(:referred) { nil } let!(:referred2) { nil } - before(:each) do + before do parent.references << referred if referred.present? parent.references << referred2 if referred2.present? - @serialization = ActiveModelSerializers::SerializableResource.new(parent, serializer: described_class, adapter: ActivityPub::Adapter) end it 'has the expected shape' do diff --git a/spec/serializers/activitypub/one_time_key_serializer_spec.rb b/spec/serializers/activitypub/one_time_key_serializer_spec.rb index 6fe1f06185e6f6..89efe95c8c2e3e 100644 --- a/spec/serializers/activitypub/one_time_key_serializer_spec.rb +++ b/spec/serializers/activitypub/one_time_key_serializer_spec.rb @@ -3,13 +3,7 @@ require 'rails_helper' describe ActivityPub::OneTimeKeySerializer do - let(:serialization) do - JSON.parse( - ActiveModelSerializers::SerializableResource.new( - record, serializer: described_class - ).to_json - ) - end + let(:serialization) { serialized_record_json(record, described_class) } let(:record) { Fabricate(:one_time_key) } describe 'type' do diff --git a/spec/serializers/activitypub/undo_like_serializer_spec.rb b/spec/serializers/activitypub/undo_like_serializer_spec.rb index 43cf7192e45ebb..3d61e8675195ea 100644 --- a/spec/serializers/activitypub/undo_like_serializer_spec.rb +++ b/spec/serializers/activitypub/undo_like_serializer_spec.rb @@ -3,13 +3,7 @@ require 'rails_helper' describe ActivityPub::UndoLikeSerializer do - let(:serialization) do - JSON.parse( - ActiveModelSerializers::SerializableResource.new( - record, serializer: described_class - ).to_json - ) - end + let(:serialization) { serialized_record_json(record, described_class) } let(:record) { Fabricate(:favourite) } describe 'type' do diff --git a/spec/serializers/activitypub/update_poll_serializer_spec.rb b/spec/serializers/activitypub/update_poll_serializer_spec.rb index 14c24c70cc7d18..8ff4fd27013467 100644 --- a/spec/serializers/activitypub/update_poll_serializer_spec.rb +++ b/spec/serializers/activitypub/update_poll_serializer_spec.rb @@ -3,16 +3,12 @@ require 'rails_helper' describe ActivityPub::UpdatePollSerializer do - subject { JSON.parse(@serialization.to_json) } + subject { serialized_record_json(status, described_class, adapter: ActivityPub::Adapter) } let(:account) { Fabricate(:account) } let(:poll) { Fabricate(:poll, account: account) } let!(:status) { Fabricate(:status, account: account, poll: poll) } - before(:each) do - @serialization = ActiveModelSerializers::SerializableResource.new(status, serializer: described_class, adapter: ActivityPub::Adapter) - end - it 'has a Update type' do expect(subject['type']).to eql('Update') end diff --git a/spec/serializers/activitypub/vote_serializer_spec.rb b/spec/serializers/activitypub/vote_serializer_spec.rb index c329542d7914e7..b7c0b8928b862b 100644 --- a/spec/serializers/activitypub/vote_serializer_spec.rb +++ b/spec/serializers/activitypub/vote_serializer_spec.rb @@ -3,13 +3,7 @@ require 'rails_helper' describe ActivityPub::VoteSerializer do - let(:serialization) do - JSON.parse( - ActiveModelSerializers::SerializableResource.new( - record, serializer: described_class - ).to_json - ) - end + let(:serialization) { serialized_record_json(record, described_class) } let(:record) { Fabricate(:poll_vote) } describe 'type' do diff --git a/spec/serializers/rest/account_serializer_spec.rb b/spec/serializers/rest/account_serializer_spec.rb index e399e88f37c3b3..15939e484d86e5 100644 --- a/spec/serializers/rest/account_serializer_spec.rb +++ b/spec/serializers/rest/account_serializer_spec.rb @@ -3,7 +3,7 @@ require 'rails_helper' describe REST::AccountSerializer do - subject { JSON.parse(ActiveModelSerializers::SerializableResource.new(account, serializer: described_class).to_json) } + subject { serialized_record_json(account, described_class) } let(:role) { Fabricate(:user_role, name: 'Role', highlighted: true) } let(:user) { Fabricate(:user, role: role) } diff --git a/spec/serializers/rest/encrypted_message_serializer_spec.rb b/spec/serializers/rest/encrypted_message_serializer_spec.rb index e0e70a3b8466c8..01db1149af52e9 100644 --- a/spec/serializers/rest/encrypted_message_serializer_spec.rb +++ b/spec/serializers/rest/encrypted_message_serializer_spec.rb @@ -3,13 +3,7 @@ require 'rails_helper' describe REST::EncryptedMessageSerializer do - let(:serialization) do - JSON.parse( - ActiveModelSerializers::SerializableResource.new( - record, serializer: described_class - ).to_json - ) - end + let(:serialization) { serialized_record_json(record, described_class) } let(:record) { Fabricate(:encrypted_message) } describe 'account' do diff --git a/spec/serializers/rest/instance_serializer_spec.rb b/spec/serializers/rest/instance_serializer_spec.rb index 4b33d15daaf31c..aab186c34ea188 100644 --- a/spec/serializers/rest/instance_serializer_spec.rb +++ b/spec/serializers/rest/instance_serializer_spec.rb @@ -3,13 +3,7 @@ require 'rails_helper' describe REST::InstanceSerializer do - let(:serialization) do - JSON.parse( - ActiveModelSerializers::SerializableResource.new( - record, serializer: described_class - ).to_json - ) - end + let(:serialization) { serialized_record_json(record, described_class) } let(:record) { InstancePresenter.new } describe 'usage' do diff --git a/spec/serializers/rest/keys/claim_result_serializer_spec.rb b/spec/serializers/rest/keys/claim_result_serializer_spec.rb index cf9416f03289c1..7f7fb850cdacaa 100644 --- a/spec/serializers/rest/keys/claim_result_serializer_spec.rb +++ b/spec/serializers/rest/keys/claim_result_serializer_spec.rb @@ -3,13 +3,7 @@ require 'rails_helper' describe REST::Keys::ClaimResultSerializer do - let(:serialization) do - JSON.parse( - ActiveModelSerializers::SerializableResource.new( - record, serializer: described_class - ).to_json - ) - end + let(:serialization) { serialized_record_json(record, described_class) } let(:record) { Keys::ClaimService::Result.new(Account.new(id: 123), 456) } describe 'account' do diff --git a/spec/serializers/rest/keys/device_serializer_spec.rb b/spec/serializers/rest/keys/device_serializer_spec.rb index c15e197cb8fb39..28177a3db5a212 100644 --- a/spec/serializers/rest/keys/device_serializer_spec.rb +++ b/spec/serializers/rest/keys/device_serializer_spec.rb @@ -3,13 +3,7 @@ require 'rails_helper' describe REST::Keys::DeviceSerializer do - let(:serialization) do - JSON.parse( - ActiveModelSerializers::SerializableResource.new( - record, serializer: described_class - ).to_json - ) - end + let(:serialization) { serialized_record_json(record, described_class) } let(:record) { Device.new(name: 'Device name') } describe 'name' do diff --git a/spec/serializers/rest/keys/query_result_serializer_spec.rb b/spec/serializers/rest/keys/query_result_serializer_spec.rb index 983780ae98fb6a..ef67d706750ffb 100644 --- a/spec/serializers/rest/keys/query_result_serializer_spec.rb +++ b/spec/serializers/rest/keys/query_result_serializer_spec.rb @@ -3,13 +3,7 @@ require 'rails_helper' describe REST::Keys::QueryResultSerializer do - let(:serialization) do - JSON.parse( - ActiveModelSerializers::SerializableResource.new( - record, serializer: described_class - ).to_json - ) - end + let(:serialization) { serialized_record_json(record, described_class) } let(:record) { Keys::QueryService::Result.new(Account.new(id: 123), []) } describe 'account' do diff --git a/spec/serializers/rest/suggestion_serializer_spec.rb b/spec/serializers/rest/suggestion_serializer_spec.rb index b3c086208db8bd..60420d80234f56 100644 --- a/spec/serializers/rest/suggestion_serializer_spec.rb +++ b/spec/serializers/rest/suggestion_serializer_spec.rb @@ -3,13 +3,7 @@ require 'rails_helper' describe REST::SuggestionSerializer do - let(:serialization) do - JSON.parse( - ActiveModelSerializers::SerializableResource.new( - record, serializer: described_class - ).to_json - ) - end + let(:serialization) { serialized_record_json(record, described_class) } let(:record) do AccountSuggestions::Suggestion.new( account: account, diff --git a/spec/services/activitypub/fetch_replies_service_spec.rb b/spec/services/activitypub/fetch_replies_service_spec.rb index bf8e2967643fa3..d7716dd4efd574 100644 --- a/spec/services/activitypub/fetch_replies_service_spec.rb +++ b/spec/services/activitypub/fetch_replies_service_spec.rb @@ -36,8 +36,11 @@ context 'when the payload is a Collection with inlined replies' do context 'when passing the collection itself' do it 'spawns workers for up to 5 replies on the same server' do - expect(FetchReplyWorker).to receive(:push_bulk).with(['http://example.com/self-reply-1', 'http://example.com/self-reply-2', 'http://example.com/self-reply-3', 'http://example.com/self-reply-4', 'http://example.com/self-reply-5']) + allow(FetchReplyWorker).to receive(:push_bulk) + subject.call(status, payload) + + expect(FetchReplyWorker).to have_received(:push_bulk).with(['http://example.com/self-reply-1', 'http://example.com/self-reply-2', 'http://example.com/self-reply-3', 'http://example.com/self-reply-4', 'http://example.com/self-reply-5']) end end @@ -47,8 +50,11 @@ end it 'spawns workers for up to 5 replies on the same server' do - expect(FetchReplyWorker).to receive(:push_bulk).with(['http://example.com/self-reply-1', 'http://example.com/self-reply-2', 'http://example.com/self-reply-3', 'http://example.com/self-reply-4', 'http://example.com/self-reply-5']) + allow(FetchReplyWorker).to receive(:push_bulk) + subject.call(status, collection_uri) + + expect(FetchReplyWorker).to have_received(:push_bulk).with(['http://example.com/self-reply-1', 'http://example.com/self-reply-2', 'http://example.com/self-reply-3', 'http://example.com/self-reply-4', 'http://example.com/self-reply-5']) end end end @@ -65,8 +71,11 @@ context 'when passing the collection itself' do it 'spawns workers for up to 5 replies on the same server' do - expect(FetchReplyWorker).to receive(:push_bulk).with(['http://example.com/self-reply-1', 'http://example.com/self-reply-2', 'http://example.com/self-reply-3', 'http://example.com/self-reply-4', 'http://example.com/self-reply-5']) + allow(FetchReplyWorker).to receive(:push_bulk) + subject.call(status, payload) + + expect(FetchReplyWorker).to have_received(:push_bulk).with(['http://example.com/self-reply-1', 'http://example.com/self-reply-2', 'http://example.com/self-reply-3', 'http://example.com/self-reply-4', 'http://example.com/self-reply-5']) end end @@ -76,8 +85,11 @@ end it 'spawns workers for up to 5 replies on the same server' do - expect(FetchReplyWorker).to receive(:push_bulk).with(['http://example.com/self-reply-1', 'http://example.com/self-reply-2', 'http://example.com/self-reply-3', 'http://example.com/self-reply-4', 'http://example.com/self-reply-5']) + allow(FetchReplyWorker).to receive(:push_bulk) + subject.call(status, collection_uri) + + expect(FetchReplyWorker).to have_received(:push_bulk).with(['http://example.com/self-reply-1', 'http://example.com/self-reply-2', 'http://example.com/self-reply-3', 'http://example.com/self-reply-4', 'http://example.com/self-reply-5']) end end end @@ -98,8 +110,11 @@ context 'when passing the collection itself' do it 'spawns workers for up to 5 replies on the same server' do - expect(FetchReplyWorker).to receive(:push_bulk).with(['http://example.com/self-reply-1', 'http://example.com/self-reply-2', 'http://example.com/self-reply-3', 'http://example.com/self-reply-4', 'http://example.com/self-reply-5']) + allow(FetchReplyWorker).to receive(:push_bulk) + subject.call(status, payload) + + expect(FetchReplyWorker).to have_received(:push_bulk).with(['http://example.com/self-reply-1', 'http://example.com/self-reply-2', 'http://example.com/self-reply-3', 'http://example.com/self-reply-4', 'http://example.com/self-reply-5']) end end @@ -109,8 +124,11 @@ end it 'spawns workers for up to 5 replies on the same server' do - expect(FetchReplyWorker).to receive(:push_bulk).with(['http://example.com/self-reply-1', 'http://example.com/self-reply-2', 'http://example.com/self-reply-3', 'http://example.com/self-reply-4', 'http://example.com/self-reply-5']) + allow(FetchReplyWorker).to receive(:push_bulk) + subject.call(status, collection_uri) + + expect(FetchReplyWorker).to have_received(:push_bulk).with(['http://example.com/self-reply-1', 'http://example.com/self-reply-2', 'http://example.com/self-reply-3', 'http://example.com/self-reply-4', 'http://example.com/self-reply-5']) end end end diff --git a/spec/services/activitypub/process_collection_service_spec.rb b/spec/services/activitypub/process_collection_service_spec.rb index 02011afea05499..ede9f5c049aa3f 100644 --- a/spec/services/activitypub/process_collection_service_spec.rb +++ b/spec/services/activitypub/process_collection_service_spec.rb @@ -41,8 +41,11 @@ end it 'does not process payload' do - expect(ActivityPub::Activity).to_not receive(:factory) + allow(ActivityPub::Activity).to receive(:factory) + subject.call(json, actor) + + expect(ActivityPub::Activity).to_not have_received(:factory) end end end @@ -59,8 +62,11 @@ end it 'processes the payload' do - expect(ActivityPub::Activity).to receive(:factory) + allow(ActivityPub::Activity).to receive(:factory) + subject.call(json, actor) + + expect(ActivityPub::Activity).to have_received(:factory) end end end @@ -71,27 +77,33 @@ it 'does not process payload if no signature exists' do allow_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_actor!).and_return(nil) - expect(ActivityPub::Activity).to_not receive(:factory) + allow(ActivityPub::Activity).to receive(:factory) subject.call(json, forwarder) + + expect(ActivityPub::Activity).to_not have_received(:factory) end it 'processes payload with actor if valid signature exists' do payload['signature'] = { 'type' => 'RsaSignature2017' } allow_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_actor!).and_return(actor) - expect(ActivityPub::Activity).to receive(:factory).with(instance_of(Hash), actor, instance_of(Hash)) + allow(ActivityPub::Activity).to receive(:factory).with(instance_of(Hash), actor, instance_of(Hash)) subject.call(json, forwarder) + + expect(ActivityPub::Activity).to have_received(:factory).with(instance_of(Hash), actor, instance_of(Hash)) end it 'does not process payload if invalid signature exists' do payload['signature'] = { 'type' => 'RsaSignature2017' } allow_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_actor!).and_return(nil) - expect(ActivityPub::Activity).to_not receive(:factory) + allow(ActivityPub::Activity).to receive(:factory) subject.call(json, forwarder) + + expect(ActivityPub::Activity).to_not have_received(:factory) end context 'when receiving a fabricated status' do @@ -225,7 +237,11 @@ end it 'does not process forged payload' do - expect(ActivityPub::Activity).to_not receive(:factory).with( + allow(ActivityPub::Activity).to receive(:factory) + + subject.call(json, forwarder) + + expect(ActivityPub::Activity).to_not have_received(:factory).with( hash_including( 'object' => hash_including( 'id' => 'https://example.com/users/bob/fake-status' @@ -235,7 +251,7 @@ anything ) - expect(ActivityPub::Activity).to_not receive(:factory).with( + expect(ActivityPub::Activity).to_not have_received(:factory).with( hash_including( 'object' => hash_including( 'content' => '

puck was here

' @@ -245,8 +261,6 @@ anything ) - subject.call(json, forwarder) - expect(Status.where(uri: 'https://example.com/users/bob/fake-status').exists?).to be false end end diff --git a/spec/services/bulk_import_service_spec.rb b/spec/services/bulk_import_service_spec.rb index 281b642ea41c25..16d718815a705a 100644 --- a/spec/services/bulk_import_service_spec.rb +++ b/spec/services/bulk_import_service_spec.rb @@ -54,7 +54,7 @@ Import::RowWorker.drain - expect(FollowRequest.includes(:target_account).where(account: account).map(&:target_account).map(&:acct)).to contain_exactly('user@foo.bar', 'unknown@unknown.bar') + expect(FollowRequest.includes(:target_account).where(account: account).map { |follow_request| follow_request.target_account.acct }).to contain_exactly('user@foo.bar', 'unknown@unknown.bar') end end @@ -102,7 +102,7 @@ Import::RowWorker.drain - expect(FollowRequest.includes(:target_account).where(account: account).map(&:target_account).map(&:acct)).to contain_exactly('user@foo.bar', 'unknown@unknown.bar') + expect(FollowRequest.includes(:target_account).where(account: account).map { |follow_request| follow_request.target_account.acct }).to contain_exactly('user@foo.bar', 'unknown@unknown.bar') end end @@ -367,7 +367,7 @@ Import::RowWorker.drain - expect(account.bookmarks.map(&:status).map(&:uri)).to contain_exactly(already_bookmarked.uri, status.uri, bookmarked.uri, 'https://domain.unknown/foo') + expect(account.bookmarks.map { |bookmark| bookmark.status.uri }).to contain_exactly(already_bookmarked.uri, status.uri, bookmarked.uri, 'https://domain.unknown/foo') end end @@ -410,7 +410,7 @@ Import::RowWorker.drain - expect(account.bookmarks.map(&:status).map(&:uri)).to contain_exactly(status.uri, bookmarked.uri, 'https://domain.unknown/foo') + expect(account.bookmarks.map { |bookmark| bookmark.status.uri }).to contain_exactly(status.uri, bookmarked.uri, 'https://domain.unknown/foo') end end end diff --git a/spec/services/import_service_spec.rb b/spec/services/import_service_spec.rb index 1904ac8dc914a9..3936b2363f76a7 100644 --- a/spec/services/import_service_spec.rb +++ b/spec/services/import_service_spec.rb @@ -208,7 +208,7 @@ let!(:remote_status) { Fabricate(:status, uri: 'https://example.com/statuses/1312') } let!(:direct_status) { Fabricate(:status, uri: 'https://example.com/statuses/direct', visibility: :direct) } - around(:each) do |example| + around do |example| local_before = Rails.configuration.x.local_domain web_before = Rails.configuration.x.web_domain Rails.configuration.x.local_domain = 'local.com' @@ -232,9 +232,9 @@ it 'adds the toots the user has access to to bookmarks' do local_status = Fabricate(:status, account: local_account, uri: 'https://local.com/users/foo/statuses/42', id: 42, local: true) subject.call(import) - expect(account.bookmarks.map(&:status).map(&:id)).to include(local_status.id) - expect(account.bookmarks.map(&:status).map(&:id)).to include(remote_status.id) - expect(account.bookmarks.map(&:status).map(&:id)).to_not include(direct_status.id) + expect(account.bookmarks.map { |bookmark| bookmark.status.id }).to include(local_status.id) + expect(account.bookmarks.map { |bookmark| bookmark.status.id }).to include(remote_status.id) + expect(account.bookmarks.map { |bookmark| bookmark.status.id }).to_not include(direct_status.id) expect(account.bookmarks.count).to eq 3 end end diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index b81be752ca8a89..8a282a09a98d56 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -58,128 +58,22 @@ def json_str_to_hash(str) JSON.parse(str, symbolize_names: true) end +def serialized_record_json(record, serializer, adapter: nil) + options = { serializer: serializer } + options[:adapter] = adapter if adapter.present? + JSON.parse( + ActiveModelSerializers::SerializableResource.new( + record, + options + ).to_json + ) +end + def expect_push_bulk_to_match(klass, matcher) - expect(Sidekiq::Client).to receive(:push_bulk).with(hash_including({ + allow(Sidekiq::Client).to receive(:push_bulk) + yield + expect(Sidekiq::Client).to have_received(:push_bulk).with(hash_including({ 'class' => klass, 'args' => matcher, })) end - -class StreamingServerManager - @running_thread = nil - - def initialize - at_exit { stop } - end - - def start(port: 4020) - return if @running_thread - - queue = Queue.new - - @queue = queue - - @running_thread = Thread.new do - Open3.popen2e( - { - 'REDIS_NAMESPACE' => ENV.fetch('REDIS_NAMESPACE'), - 'DB_NAME' => "#{ENV.fetch('DB_NAME', 'mastodon')}_test#{ENV.fetch('TEST_ENV_NUMBER', '')}", - 'RAILS_ENV' => ENV.fetch('RAILS_ENV', 'test'), - 'NODE_ENV' => ENV.fetch('STREAMING_NODE_ENV', 'development'), - 'PORT' => port.to_s, - }, - 'node index.js', # must not call yarn here, otherwise it will fail because yarn does not send signals to its child process - chdir: Rails.root.join('streaming') - ) do |_stdin, stdout_err, process_thread| - status = :starting - - # Spawn a thread to listen on streaming server output - output_thread = Thread.new do - stdout_err.each_line do |line| - Rails.logger.info "Streaming server: #{line}" - - if status == :starting && line.match('Streaming API now listening on') - status = :started - @queue.enq 'started' - end - end - end - - # And another thread to listen on commands from the main thread - loop do - msg = queue.pop - - case msg - when 'stop' - # we need to properly stop the reading thread - output_thread.kill - - # Then stop the node process - Process.kill('KILL', process_thread.pid) - - # And we stop ourselves - @running_thread.kill - end - end - end - end - - # wait for 10 seconds for the streaming server to start - Timeout.timeout(10) do - loop do - break if @queue.pop == 'started' - end - end - end - - def stop - return unless @running_thread - - @queue.enq 'stop' - - # Wait for the thread to end - @running_thread.join - end -end - -class SearchDataManager - def prepare_test_data - 4.times do |i| - username = "search_test_account_#{i}" - account = Fabricate.create(:account, username: username, indexable: i.even?, discoverable: i.even?, note: "Lover of #{i}.") - 2.times do |j| - Fabricate.create(:status, account: account, text: "#{username}'s #{j} post", visibility: j.even? ? :public : :private) - end - end - - 3.times do |i| - Fabricate.create(:tag, name: "search_test_tag_#{i}") - end - end - - def indexes - [ - AccountsIndex, - PublicStatusesIndex, - StatusesIndex, - TagsIndex, - ] - end - - def populate_indexes - indexes.each do |index_class| - index_class.purge! - index_class.import! - end - end - - def remove_indexes - indexes.each(&:delete!) - end - - def cleanup_test_data - Status.destroy_all - Account.destroy_all - Tag.destroy_all - end -end diff --git a/spec/support/search_data_manager.rb b/spec/support/search_data_manager.rb new file mode 100644 index 00000000000000..24c95ae0694ea5 --- /dev/null +++ b/spec/support/search_data_manager.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +class SearchDataManager + def prepare_test_data + 4.times do |i| + username = "search_test_account_#{i}" + account = Fabricate.create(:account, username: username, indexable: i.even?, discoverable: i.even?, note: "Lover of #{i}.") + 2.times do |j| + Fabricate.create(:status, account: account, text: "#{username}'s #{j} post", visibility: j.even? ? :public : :private) + end + end + + 3.times do |i| + Fabricate.create(:tag, name: "search_test_tag_#{i}") + end + end + + def indexes + [ + AccountsIndex, + PublicStatusesIndex, + StatusesIndex, + TagsIndex, + ] + end + + def populate_indexes + indexes.each do |index_class| + index_class.purge! + index_class.import! + end + end + + def remove_indexes + indexes.each(&:delete!) + end + + def cleanup_test_data + Status.destroy_all + Account.destroy_all + Tag.destroy_all + end +end diff --git a/spec/support/streaming_server_manager.rb b/spec/support/streaming_server_manager.rb new file mode 100644 index 00000000000000..93e1a6d17fafa3 --- /dev/null +++ b/spec/support/streaming_server_manager.rb @@ -0,0 +1,78 @@ +# frozen_string_literal: true + +class StreamingServerManager + @running_thread = nil + + def initialize + at_exit { stop } + end + + def start(port: 4020) + return if @running_thread + + queue = Queue.new + + @queue = queue + + @running_thread = Thread.new do + Open3.popen2e( + { + 'REDIS_NAMESPACE' => ENV.fetch('REDIS_NAMESPACE'), + 'DB_NAME' => "#{ENV.fetch('DB_NAME', 'mastodon')}_test#{ENV.fetch('TEST_ENV_NUMBER', '')}", + 'RAILS_ENV' => ENV.fetch('RAILS_ENV', 'test'), + 'NODE_ENV' => ENV.fetch('STREAMING_NODE_ENV', 'development'), + 'PORT' => port.to_s, + }, + 'node index.js', # must not call yarn here, otherwise it will fail because yarn does not send signals to its child process + chdir: Rails.root.join('streaming') + ) do |_stdin, stdout_err, process_thread| + status = :starting + + # Spawn a thread to listen on streaming server output + output_thread = Thread.new do + stdout_err.each_line do |line| + Rails.logger.info "Streaming server: #{line}" + + if status == :starting && line.match('Streaming API now listening on') + status = :started + @queue.enq 'started' + end + end + end + + # And another thread to listen on commands from the main thread + loop do + msg = queue.pop + + case msg + when 'stop' + # we need to properly stop the reading thread + output_thread.kill + + # Then stop the node process + Process.kill('KILL', process_thread.pid) + + # And we stop ourselves + @running_thread.kill + end + end + end + end + + # wait for 10 seconds for the streaming server to start + Timeout.timeout(10) do + loop do + break if @queue.pop == 'started' + end + end + end + + def stop + return unless @running_thread + + @queue.enq 'stop' + + # Wait for the thread to end + @running_thread.join + end +end diff --git a/spec/validators/status_length_validator_spec.rb b/spec/validators/status_length_validator_spec.rb index 98ea15e03bb398..06625917bdc6e0 100644 --- a/spec/validators/status_length_validator_spec.rb +++ b/spec/validators/status_length_validator_spec.rb @@ -6,14 +6,20 @@ describe '#validate' do it 'does not add errors onto remote statuses' do status = instance_double(Status, local?: false) + allow(status).to receive(:errors) + subject.validate(status) - expect(status).to_not receive(:errors) + + expect(status).to_not have_received(:errors) end it 'does not add errors onto local reblogs' do status = instance_double(Status, local?: false, reblog?: true) + allow(status).to receive(:errors) + subject.validate(status) - expect(status).to_not receive(:errors) + + expect(status).to_not have_received(:errors) end it 'adds an error when content warning is over 500 characters' do diff --git a/spec/workers/activitypub/distribute_poll_update_worker_spec.rb b/spec/workers/activitypub/distribute_poll_update_worker_spec.rb index 0bdbf639032405..afe2b291fd0228 100644 --- a/spec/workers/activitypub/distribute_poll_update_worker_spec.rb +++ b/spec/workers/activitypub/distribute_poll_update_worker_spec.rb @@ -16,8 +16,9 @@ end it 'delivers to followers' do - expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), account.id, 'http://example.com']]) - subject.perform(status.id) + expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), account.id, 'http://example.com']]) do + subject.perform(status.id) + end end end end diff --git a/spec/workers/activitypub/distribution_worker_spec.rb b/spec/workers/activitypub/distribution_worker_spec.rb index d8803f6b8a94cb..2706967fcaea56 100644 --- a/spec/workers/activitypub/distribution_worker_spec.rb +++ b/spec/workers/activitypub/distribution_worker_spec.rb @@ -19,8 +19,9 @@ end it 'delivers to followers' do - expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), status.account.id, 'http://example.com', anything]]) - subject.perform(status.id) + expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), status.account.id, 'http://example.com', anything]]) do + subject.perform(status.id) + end end end @@ -30,8 +31,9 @@ end it 'delivers to followers' do - expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), status.account.id, 'http://example.com', anything]]) - subject.perform(status.id) + expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), status.account.id, 'http://example.com', anything]]) do + subject.perform(status.id) + end end end @@ -44,8 +46,9 @@ end it 'delivers to mentioned accounts' do - expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), status.account.id, 'https://foo.bar/inbox', anything]]) - subject.perform(status.id) + expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), status.account.id, 'https://foo.bar/inbox', anything]]) do + subject.perform(status.id) + end end end end diff --git a/spec/workers/activitypub/move_distribution_worker_spec.rb b/spec/workers/activitypub/move_distribution_worker_spec.rb index b8601f78cf3943..75ca21733ce379 100644 --- a/spec/workers/activitypub/move_distribution_worker_spec.rb +++ b/spec/workers/activitypub/move_distribution_worker_spec.rb @@ -19,8 +19,9 @@ expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [ [kind_of(String), migration.account.id, 'http://example.com'], [kind_of(String), migration.account.id, 'http://example2.com'], - ]) - subject.perform(migration.id) + ]) do + subject.perform(migration.id) + end end end end diff --git a/spec/workers/activitypub/status_update_distribution_worker_spec.rb b/spec/workers/activitypub/status_update_distribution_worker_spec.rb index c500bac9591848..a4fd246e534eb9 100644 --- a/spec/workers/activitypub/status_update_distribution_worker_spec.rb +++ b/spec/workers/activitypub/status_update_distribution_worker_spec.rb @@ -25,9 +25,9 @@ end it 'delivers to followers' do - expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), status.account.id, 'http://example.com', anything]]) - - subject.perform(status.id) + expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), status.account.id, 'http://example.com', anything]]) do + subject.perform(status.id) + end end end @@ -37,9 +37,9 @@ end it 'delivers to followers' do - expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), status.account.id, 'http://example.com', anything]]) - - subject.perform(status.id) + expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), status.account.id, 'http://example.com', anything]]) do + subject.perform(status.id) + end end end end diff --git a/spec/workers/activitypub/update_distribution_worker_spec.rb b/spec/workers/activitypub/update_distribution_worker_spec.rb index d0eeda43bfa214..4a0ed050bb7cfe 100644 --- a/spec/workers/activitypub/update_distribution_worker_spec.rb +++ b/spec/workers/activitypub/update_distribution_worker_spec.rb @@ -14,8 +14,9 @@ end it 'delivers to followers' do - expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), account.id, 'http://example.com', anything]]) - subject.perform(account.id) + expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), account.id, 'http://example.com', anything]]) do + subject.perform(account.id) + end end end end diff --git a/yarn.lock b/yarn.lock index 3cce7f61cf0633..4c6552ec1c6646 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1367,6 +1367,14 @@ "@formatjs/intl-localematcher" "0.4.2" tslib "^2.4.0" +"@formatjs/ecma402-abstract@1.17.3": + version "1.17.3" + resolved "https://registry.yarnpkg.com/@formatjs/ecma402-abstract/-/ecma402-abstract-1.17.3.tgz#73ce8aecb1ff5572046564c833786504dfafbb06" + integrity sha512-2Q4hmKQ6CM30mRG/YMdSBW8LXf32BfuOb1FZgG+uVWPC/SQMoiVFz5JaeOukt96v6TZ4ddE+bHCmd611PW38QA== + dependencies: + "@formatjs/intl-localematcher" "0.5.0" + tslib "^2.4.0" + "@formatjs/fast-memoize@2.2.0": version "2.2.0" resolved "https://registry.yarnpkg.com/@formatjs/fast-memoize/-/fast-memoize-2.2.0.tgz#33bd616d2e486c3e8ef4e68c99648c196887802b" @@ -1383,6 +1391,15 @@ "@formatjs/icu-skeleton-parser" "1.6.2" tslib "^2.4.0" +"@formatjs/icu-messageformat-parser@2.7.1": + version "2.7.1" + resolved "https://registry.yarnpkg.com/@formatjs/icu-messageformat-parser/-/icu-messageformat-parser-2.7.1.tgz#3968a48fdf4064cdd2d0b751afb8ed6d55574019" + integrity sha512-ErnXyRdk8AlpGcKskKVYn23aAlWXhI1kt5ek2o3pJwVeMTcrosSESQ8baztdTtJjfQHlB4NBeocfRA5C6DKv2g== + dependencies: + "@formatjs/ecma402-abstract" "1.17.3" + "@formatjs/icu-skeleton-parser" "1.6.3" + tslib "^2.4.0" + "@formatjs/icu-skeleton-parser@1.6.2": version "1.6.2" resolved "https://registry.yarnpkg.com/@formatjs/icu-skeleton-parser/-/icu-skeleton-parser-1.6.2.tgz#00303034dc08583973c8aa67b96534c49c0bad8d" @@ -1391,22 +1408,30 @@ "@formatjs/ecma402-abstract" "1.17.2" tslib "^2.4.0" -"@formatjs/intl-displaynames@6.6.1": - version "6.6.1" - resolved "https://registry.yarnpkg.com/@formatjs/intl-displaynames/-/intl-displaynames-6.6.1.tgz#2099dbd0d3dffba3176d7b470c73bdd578850d76" - integrity sha512-TIPaDu0SlwJUXlIyeSL9052jrUC4QviLnvUEJ53Ldc3Q4nZJnT2wD8NHIroTOYX9lgp5m3BeTlhpRcsnuExDkA== +"@formatjs/icu-skeleton-parser@1.6.3": + version "1.6.3" + resolved "https://registry.yarnpkg.com/@formatjs/icu-skeleton-parser/-/icu-skeleton-parser-1.6.3.tgz#3167a9f4a7a8ca2298ac74e5d11c4e289f61d93b" + integrity sha512-Viggz4Pic7oC4uR8z2VroL8H9boiUTTB0TqEsiRb6DHZv7QEcg1BoVQZBkBdLmvxhBS7nwBNrTdbaiW8GOV58Q== dependencies: - "@formatjs/ecma402-abstract" "1.17.2" - "@formatjs/intl-localematcher" "0.4.2" + "@formatjs/ecma402-abstract" "1.17.3" tslib "^2.4.0" -"@formatjs/intl-listformat@7.5.0": - version "7.5.0" - resolved "https://registry.yarnpkg.com/@formatjs/intl-listformat/-/intl-listformat-7.5.0.tgz#dbccf2e0f07792aa1c273702796bdad061dc27ae" - integrity sha512-n9FsXGl1T2ZbX6wSyrzCDJHrbJR0YJ9ZNsAqUvHXfbY3nsOmGnSTf5+bkuIp1Xiywu7m1X1Pfm/Ngp/yK1H84A== +"@formatjs/intl-displaynames@6.6.2": + version "6.6.2" + resolved "https://registry.yarnpkg.com/@formatjs/intl-displaynames/-/intl-displaynames-6.6.2.tgz#3d06089bc4ea1840a41445d42aaa387717d621c1" + integrity sha512-8wenvLpInbVEPoVDHiG1QC/dE16io3fptVanMr2jKUqr3938UziygflnUqPlG7U6AHRbU7geCFthfZt8x2NpsA== dependencies: - "@formatjs/ecma402-abstract" "1.17.2" - "@formatjs/intl-localematcher" "0.4.2" + "@formatjs/ecma402-abstract" "1.17.3" + "@formatjs/intl-localematcher" "0.5.0" + tslib "^2.4.0" + +"@formatjs/intl-listformat@7.5.1": + version "7.5.1" + resolved "https://registry.yarnpkg.com/@formatjs/intl-listformat/-/intl-listformat-7.5.1.tgz#a578bd88879fd66793a0cba4038240d99d94f73c" + integrity sha512-J6heE28cikJ2cUZ7Mvmets418lE96k5OcbgDYQkXDFHVbRnUKCHQwRAXKRCPFEGDrEmcvtqUj7NmZEJYbsJdqQ== + dependencies: + "@formatjs/ecma402-abstract" "1.17.3" + "@formatjs/intl-localematcher" "0.5.0" tslib "^2.4.0" "@formatjs/intl-localematcher@0.4.2": @@ -1416,26 +1441,33 @@ dependencies: tslib "^2.4.0" +"@formatjs/intl-localematcher@0.5.0": + version "0.5.0" + resolved "https://registry.yarnpkg.com/@formatjs/intl-localematcher/-/intl-localematcher-0.5.0.tgz#9c8bbba9f698efba732facac1a695ce8dd08aa53" + integrity sha512-K1Xpg/8oyfCMxisJQa/fILoeoeyndcM0wcN8QiNG/uM5OAe1BcO1+2yd0gIboDI2tRJEsUi/sSBEYPbgkIdq4A== + dependencies: + tslib "^2.4.0" + "@formatjs/intl-pluralrules@^5.2.2": - version "5.2.7" - resolved "https://registry.yarnpkg.com/@formatjs/intl-pluralrules/-/intl-pluralrules-5.2.7.tgz#f13ad9760f859ca67d2faddcac0d76a5b8b955f6" - integrity sha512-KmLGzj8VUOhMjlFP0uEOfEgH9xkRAhDNBVmsVGZnE2EIsbpVG0GDG6DHuqnyC0KYXy7UfU/XuE0H1Bo+Mr35DQ== + version "5.2.8" + resolved "https://registry.yarnpkg.com/@formatjs/intl-pluralrules/-/intl-pluralrules-5.2.8.tgz#830af77f5f377afdc43c439729ed60c4bcc25ee5" + integrity sha512-1pNtsZkAa3Ck1JKKydRwlys7D+wAkclWYbWdyNocoY8+UL+jjMQrh7LzHCTxsZbwWDADouWuVyeWnwEMl5wkSw== dependencies: - "@formatjs/ecma402-abstract" "1.17.2" - "@formatjs/intl-localematcher" "0.4.2" + "@formatjs/ecma402-abstract" "1.17.3" + "@formatjs/intl-localematcher" "0.5.0" tslib "^2.4.0" -"@formatjs/intl@2.9.5": - version "2.9.5" - resolved "https://registry.yarnpkg.com/@formatjs/intl/-/intl-2.9.5.tgz#30087e97db940038ede523439c2fb2bdf84989dd" - integrity sha512-WEdEv8Jf2nKBErTK4MJ2xCesUJVHH9iunXzfHzZo4tnn2NSj48g04FNH9w17XDpEbj9KEM39fLkwBz7ay/ErPQ== +"@formatjs/intl@2.9.6": + version "2.9.6" + resolved "https://registry.yarnpkg.com/@formatjs/intl/-/intl-2.9.6.tgz#af0204d590c670502cf6801671dc156d5040fc37" + integrity sha512-pHvVycu4g1S8zsZhYm0naf/ODCsDXHw00ITMMUM9TK9MYa8zGkf4W5gdItVbUX7elYN3JdDwp0d5fLNBBljhgQ== dependencies: - "@formatjs/ecma402-abstract" "1.17.2" + "@formatjs/ecma402-abstract" "1.17.3" "@formatjs/fast-memoize" "2.2.0" - "@formatjs/icu-messageformat-parser" "2.7.0" - "@formatjs/intl-displaynames" "6.6.1" - "@formatjs/intl-listformat" "7.5.0" - intl-messageformat "10.5.4" + "@formatjs/icu-messageformat-parser" "2.7.1" + "@formatjs/intl-displaynames" "6.6.2" + "@formatjs/intl-listformat" "7.5.1" + intl-messageformat "10.5.5" tslib "^2.4.0" "@formatjs/ts-transformer@3.13.6": @@ -1451,6 +1483,19 @@ tslib "^2.4.0" typescript "5" +"@formatjs/ts-transformer@3.13.7": + version "3.13.7" + resolved "https://registry.yarnpkg.com/@formatjs/ts-transformer/-/ts-transformer-3.13.7.tgz#8dab6789ae36de87a5212b13bfbc32ba1bf75dd9" + integrity sha512-yDuLP68gPT+EGm3LLIVfZ7cRRynFx2MIhF5V1lFTzEMxNvHANhal7WRHYieDVMiPsI0vd84H+hD77hY/5KfJmw== + dependencies: + "@formatjs/icu-messageformat-parser" "2.7.1" + "@types/json-stable-stringify" "^1.0.32" + "@types/node" "14 || 16 || 17" + chalk "^4.0.0" + json-stable-stringify "^1.0.1" + tslib "^2.4.0" + typescript "5" + "@gamestdio/websocket@^0.3.2": version "0.3.2" resolved "https://registry.yarnpkg.com/@gamestdio/websocket/-/websocket-0.3.2.tgz#321ba0976ee30fd14e51dbf8faa85ce7b325f76a" @@ -3509,17 +3554,17 @@ babel-loader@^8.3.0: schema-utils "^2.6.5" babel-plugin-formatjs@^10.5.1: - version "10.5.7" - resolved "https://registry.yarnpkg.com/babel-plugin-formatjs/-/babel-plugin-formatjs-10.5.7.tgz#be31824cfb8e130166a79059b2946dbb430b794b" - integrity sha512-mJeRdLfmVVqtKWWuEyLZgd2HYEiTv9aCNZT9XAmEg5qmMTR2GA7DrX1H9G4I1FfagsX+7dI7JUvhfbqj0CSvZA== + version "10.5.8" + resolved "https://registry.yarnpkg.com/babel-plugin-formatjs/-/babel-plugin-formatjs-10.5.8.tgz#575d36815136013171737c4c837498896cf3abec" + integrity sha512-pK2DW1vhDtnxtMrqh/rCNn4u8dYSD45U3i3zCB8+Lw45FoV8poiDrejTgvJSvyynk+H6LT0VYMdT6tjtbnRocg== dependencies: "@babel/core" "^7.10.4" "@babel/helper-plugin-utils" "^7.10.4" "@babel/plugin-syntax-jsx" "7" "@babel/traverse" "7" "@babel/types" "^7.12.11" - "@formatjs/icu-messageformat-parser" "2.7.0" - "@formatjs/ts-transformer" "3.13.6" + "@formatjs/icu-messageformat-parser" "2.7.1" + "@formatjs/ts-transformer" "3.13.7" "@types/babel__core" "^7.1.7" "@types/babel__helper-plugin-utils" "^7.10.0" "@types/babel__traverse" "^7.1.7" @@ -4072,9 +4117,9 @@ caniuse-lite@^1.0.30001538: integrity sha512-HWJnhnID+0YMtGlzcp3T9drmBJUVDchPJ08tpUGFLs9CYlwWPH2uLgpHn8fND5pCgXVtnGS3H4QR9XLMHVNkHw== caniuse-lite@^1.0.30001541: - version "1.0.30001553" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001553.tgz#e64e7dc8fd4885cd246bb476471420beb5e474b5" - integrity sha512-N0ttd6TrFfuqKNi+pMgWJTb9qrdJu4JSpgPFLe/lrD19ugC6fZgF0pUewRowDwzdDnb9V41mFcdlYgl/PyKf4A== + version "1.0.30001561" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001561.tgz#752f21f56f96f1b1a52e97aae98c57c562d5d9da" + integrity sha512-NTt0DNoKe958Q0BE0j0c1V9jbUzhBxHIEJy7asmGrpE0yG63KTV7PLHPnK2E1O9RsQrQ081I3NLuXGS6zht3cw== chalk@5.2.0: version "5.2.0" @@ -5230,9 +5275,9 @@ electron-to-chromium@^1.4.428: integrity sha512-/g3UyNDmDd6ebeWapmAoiyy+Sy2HyJ+/X8KyvNeHfKRFfHaA2W8oF5fxD5F3tjBDcjpwo0iek6YNgxNXDBoEtA== electron-to-chromium@^1.4.535: - version "1.4.563" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.563.tgz#dabb424202754c1fed2d2938ff564b23d3bbf0d3" - integrity sha512-dg5gj5qOgfZNkPNeyKBZQAQitIQ/xwfIDmEQJHCbXaD9ebTZxwJXUsDYcBlAvZGZLi+/354l35J1wkmP6CqYaw== + version "1.4.576" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.576.tgz#0c6940fdc0d60f7e34bd742b29d8fa847c9294d1" + integrity sha512-yXsZyXJfAqzWk1WKryr0Wl0MN2D47xodPvEEwlVePBnhU5E7raevLQR+E6b9JAD3GfL/7MbAL9ZtWQQPcLx7wA== elliptic@^6.5.3: version "6.5.4" @@ -7003,14 +7048,14 @@ intersection-observer@^0.12.0: resolved "https://registry.yarnpkg.com/intersection-observer/-/intersection-observer-0.12.2.tgz#4a45349cc0cd91916682b1f44c28d7ec737dc375" integrity sha512-7m1vEcPCxXYI8HqnL8CKI6siDyD+eIWSwgB3DZA+ZTogxk9I4CDnj4wilt9x/+/QbHI4YG5YZNmC6458/e9Ktg== -intl-messageformat@10.5.4, intl-messageformat@^10.3.5: - version "10.5.4" - resolved "https://registry.yarnpkg.com/intl-messageformat/-/intl-messageformat-10.5.4.tgz#7b212b083f1b354d7e282518e78057e025134af9" - integrity sha512-z+hrFdiJ/heRYlzegrdFYqU1m/KOMOVMqNilIArj+PbsuU8TNE7v4TWdQgSoxlxbT4AcZH3Op3/Fu15QTp+W1w== +intl-messageformat@10.5.5, intl-messageformat@^10.3.5: + version "10.5.5" + resolved "https://registry.yarnpkg.com/intl-messageformat/-/intl-messageformat-10.5.5.tgz#cb7979887cd9d3b02a23ae8baa78ef93b2f5b8d6" + integrity sha512-sF+cJCfMn+kGcSeGGRcB1UpBH0/+Ko2KByHj2RpL2qIkRvsrnuDl8zufEkvk+GPosk932C6W1Kq24xWaw+2jDA== dependencies: - "@formatjs/ecma402-abstract" "1.17.2" + "@formatjs/ecma402-abstract" "1.17.3" "@formatjs/fast-memoize" "2.2.0" - "@formatjs/icu-messageformat-parser" "2.7.0" + "@formatjs/icu-messageformat-parser" "2.7.1" tslib "^2.4.0" invariant@^2.2.2, invariant@^2.2.4: @@ -10288,19 +10333,19 @@ react-immutable-pure-component@^2.2.2: integrity sha512-vkgoMJUDqHZfXXnjVlG3keCxSO/U6WeDQ5/Sl0GK2cH8TOxEzQ5jXqDXHEL/jqk6fsNxV05oH5kD7VNMUE2k+A== react-intl@^6.4.2: - version "6.5.1" - resolved "https://registry.yarnpkg.com/react-intl/-/react-intl-6.5.1.tgz#c44f67798e25b2778b2091563e004f54e8dc911b" - integrity sha512-mKxfH7GV5P4dJcQmbq/xU8FVBl//xRudXgS5r1Gt62NEr+T8pnzQZZ2th1jP5BQ+Ne/3kS3uYpFcynj5KyXVhg== - dependencies: - "@formatjs/ecma402-abstract" "1.17.2" - "@formatjs/icu-messageformat-parser" "2.7.0" - "@formatjs/intl" "2.9.5" - "@formatjs/intl-displaynames" "6.6.1" - "@formatjs/intl-listformat" "7.5.0" + version "6.5.2" + resolved "https://registry.yarnpkg.com/react-intl/-/react-intl-6.5.2.tgz#9a3f79425f3c8d3732482142e094c846f035e64c" + integrity sha512-o6rmAViKusLQMVu2bKAULBiQVdkk88TurPUAJiNxUAmoxubSu+pAYjLpOuByM52HSLOKPrRvDXQrrCOSykQusw== + dependencies: + "@formatjs/ecma402-abstract" "1.17.3" + "@formatjs/icu-messageformat-parser" "2.7.1" + "@formatjs/intl" "2.9.6" + "@formatjs/intl-displaynames" "6.6.2" + "@formatjs/intl-listformat" "7.5.1" "@types/hoist-non-react-statics" "^3.3.1" "@types/react" "16 || 17 || 18" hoist-non-react-statics "^3.3.2" - intl-messageformat "10.5.4" + intl-messageformat "10.5.5" tslib "^2.4.0" "react-is@^16.12.0 || ^17.0.0 || ^18.0.0", react-is@^18.0.0, react-is@^18.2.0: @@ -10410,9 +10455,9 @@ react-router@5.3.4, react-router@^5.3.4: tiny-warning "^1.0.0" react-select@*, react-select@^5.7.3: - version "5.7.7" - resolved "https://registry.yarnpkg.com/react-select/-/react-select-5.7.7.tgz#dbade9dbf711ef2a181970c10f8ab319ac37fbd0" - integrity sha512-HhashZZJDRlfF/AKj0a0Lnfs3sRdw/46VJIRd8IbB9/Ovr74+ZIwkAdSBjSPXsFMG+u72c5xShqwLSKIJllzqw== + version "5.8.0" + resolved "https://registry.yarnpkg.com/react-select/-/react-select-5.8.0.tgz#bd5c467a4df223f079dd720be9498076a3f085b5" + integrity sha512-TfjLDo58XrhP6VG5M/Mi56Us0Yt8X7xD6cDybC7yoRMUNm7BGO7qk8J0TLQOua/prb8vUOtsfnXZwfm30HGsAA== dependencies: "@babel/runtime" "^7.12.0" "@emotion/cache" "^11.4.0" @@ -11755,6 +11800,7 @@ stringz@^2.1.0: char-regex "^1.0.2" "strip-ansi-cjs@npm:strip-ansi@^6.0.1", strip-ansi@^6.0.0, strip-ansi@^6.0.1: + name strip-ansi-cjs version "6.0.1" resolved "https://registry.yarnpkg.com/strip-ansi/-/strip-ansi-6.0.1.tgz#9e26c63d30f53443e9489495b2105d37b67a85d9" integrity sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==