Merge commit '389a6cc4c0' into upstream-20231108

This commit is contained in:
KMY 2023-11-08 10:41:10 +09:00
commit 08f86bcb8f
107 changed files with 970 additions and 703 deletions

View file

@ -8,6 +8,7 @@
public/system
public/assets
public/packs
public/packs-test
node_modules
neo4j
vendor/bundle

View file

@ -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'

View file

@ -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'

View file

@ -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)

View file

@ -6,7 +6,7 @@ module Admin::AccountModerationNotesHelper
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

View file

@ -25,7 +25,7 @@ module SettingsHelper
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

View file

@ -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) {

View file

@ -13,7 +13,7 @@ exports[`<Avatar /> Autoplay renders a animated avatar 1`] = `
}
>
<img
alt="alice"
alt=""
src="/animated/alice.gif"
/>
</div>
@ -32,7 +32,7 @@ exports[`<Avatar /> Still renders a still avatar 1`] = `
}
>
<img
alt="alice"
alt=""
src="/static/alice.jpg"
/>
</div>

View file

@ -42,7 +42,7 @@ export const Avatar: React.FC<Props> = ({
onMouseLeave={handleMouseLeave}
style={style}
>
{src && <img src={src} alt={account?.get('acct')} />}
{src && <img src={src} alt='' />}
</div>
);
};

View file

@ -207,7 +207,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
modalType: 'IMAGE',
modalProps: {
src: account.get('avatar'),
alt: account.get('acct'),
alt: '',
},
}));
},

View file

@ -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 = () => {

View file

@ -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.",

View file

@ -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",

View file

@ -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": "קיצורי מקלדת",

View file

@ -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…",

View file

@ -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": "활동",

View file

@ -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": "您還沒有收到任何私訊。當您私訊別人或收到私訊時,它將於此顯示。",

View file

@ -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');
export const searchHistory = new Settings('mastodon_search_history');
export const playerSettings = new Settings('mastodon_player');

View file

@ -283,7 +283,7 @@ class FeedManager
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

View file

@ -23,9 +23,9 @@ class Feed
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

View file

@ -490,7 +490,7 @@ class User < ApplicationRecord
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

View file

@ -62,7 +62,7 @@ class ApproveAppealService < BaseService
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

View file

@ -128,7 +128,7 @@ class RemoveStatusService < BaseService
end
def decrement_references
@status.references.each do |ref|
@status.references.find_each do |ref|
ref.decrement_count!(:status_referred_by_count)
end
end

View file

@ -28,7 +28,7 @@ class UnEmojiReactService < BaseService
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

View file

@ -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

View file

@ -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

View file

@ -86,115 +86,6 @@ module Mastodon
# 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 @@ module Mastodon
# 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

110
config/initializers/i18n.rb Normal file
View file

@ -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

View file

@ -1537,7 +1537,7 @@ bg:
reach: Обхват
reach_hint_html: Управлявайте дали искате да бъдете открити и последвани от нови хора. Искате ли публикациите ви да се появяват в главния екран? Искате ли другите да ви виждат в препоръките им за последване? Желаете ли да приемате автоматично всички нови последователи или да имате подробен контрол върху всеки един?
search: Търсене
search_hint_html: Управлявайте как искате да бъдете открити. Желаете ли хората да ви открият по това, за което сте публикували публично? Искате ли хората извън Mastodon да намират профила ви, търсейки из мрежата? Обърнете внимание, че общото изключване от всички търсачки не може да гарантира за публичната информация.
search_hint_html: Управлявайте как искате да бъдете открити. Желаете ли хората да ви открият по това, за което сте публикували обществено? Искате ли хората извън Mastodon да намират профила ви, търсейки из уебпространството? Обърнете внимание, че пълното изключване от всички търсачки не може да се гарантира за обществените сведения.
title: Поверителност и обхват
privacy_policy:
title: Политика за поверителност

View file

@ -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

View file

@ -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:

View file

@ -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š <a href="%{terms_path}">pravila ovog servera</a> i <a href="%{policy_path}">naše uvjete korištenja</a>.
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}.

View file

@ -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

View file

@ -38,12 +38,12 @@ he:
application: יישום
callback_url: כתובת גישה חוזרת (Callback URL)
delete: למחוק
empty: אין לך אפליקציות.
empty: אין לך יישומים.
name: שם
new: ישום חדש
scopes: תחומים
show: להציג
title: ישומך
title: היישומים שלך
new:
title: ישום חדש
show:

View file

@ -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: "<strong>Zure zerbitzaria ez dago ongi konfiguratua. Zure erabiltzaileen pribatutasuna arriskuan dago.</strong>"
@ -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, <a href="%{path}">jarraitu hemen</a>. Berrestea eskatuko zaizu.

View file

@ -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: "<strong>کارساز وبتان بد پیکربندی شده. محرمانگی کاربرانتان در خطر است.</strong>"
@ -879,6 +885,9 @@ fa:
apply_for_account: درخواست یک حساب
captcha_confirmation:
title: بررسی های امنیتی
confirmations:
login_link: ورود
welcome_title: خوش آمدید، %{name}!
delete_account: پاک‌کردن حساب
delete_account_html: اگر می‌خواهید حساب خود را پاک کنید، از <a href="%{path}">این‌جا</a> پیش بروید. از شما درخواست تأیید خواهد شد.
description:
@ -901,6 +910,8 @@ fa:
progress:
confirm: تأیید رایانامه
details: جزئیات شما
review: بررسی ما
rules: پذیرش قوانین
providers:
cas: CAS
saml: SAML

View file

@ -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:

View file

@ -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: "<strong>Personaliza o xeito no que queres que se atope o teu perfil e publicacións.</strong> 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

View file

@ -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: אם יאופשר <strong>אימות במפתח אבטחה</strong>, כניסה לאתר תדרוש שימוש באחד ממפתחות האבטחה שלך.
destroy:
error: היתה בעיה במחיקת מפתח האבטחה. נסה בשנית.

View file

@ -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

View file

@ -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 <strong>%{domain}</strong> 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

View file

@ -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 <strong>%{domain}</strong> 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

View file

@ -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 <strong>%{app_name}</strong>. 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.

View file

@ -295,7 +295,7 @@ bg:
all: Известие за всички обновявания
critical: Известие само за критични обновявания
label: Има нова версия на Mastodon
none: Никога да не се известяват обновявания (не се препоръчва)
none: Никога да не се известява обновяване (непрепоръчително)
patch: Известие за обновявания на оправени грешки
trending_tag: Изискване на преглед за новонашумели
rule:

View file

@ -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:

View file

@ -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

View file

@ -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

View file

@ -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:

View file

@ -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

View file

@ -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} успішно розморожено

View file

@ -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: 你應該已被重新導向<strong>%{app_name}</strong>應用程式。如果尚未被導向,請嘗試%{clicking_this_link}或自行回到應用程式。
registration_complete: 你在%{domain}已完成註冊!
welcome_title: 歡迎,%{name}
wrong_email_hint: 如果該電郵地址不正確,你可以在帳號設定中修改。
delete_account: 刪除帳號
delete_account_html: 如果你想刪除你的帳號,請<a href="%{path}">點擊這裡繼續</a>。你需要確認你的操作。

View file

@ -17,7 +17,7 @@ class AddQuoteToStatuses < ActiveRecord::Migration[7.0]
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

View file

@ -136,24 +136,24 @@ module Mastodon::CLI
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 @@ module Mastodon::CLI
deduplicate_webauthn_credentials!
deduplicate_webhooks!
deduplicate_software_updates!
Scenic.database.refresh_materialized_view('instances', concurrently: true, cascade: false) if ActiveRecord::Migrator.current_version >= 2020_12_06_004238
Rails.cache.clear
say 'Finished!'
end
private
def deduplication_cleanup_tasks
refresh_instances_view if schema_has_instances_view?
Rails.cache.clear
end
def refresh_instances_view
Scenic.database.refresh_materialized_view('instances', concurrently: true, cascade: false)
end
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 @@ module Mastodon::CLI
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 @@ module Mastodon::CLI
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 @@ module Mastodon::CLI
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 @@ module Mastodon::CLI
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)

View file

@ -87,7 +87,7 @@ class Sanitize
current_node.wrap('<p></p>')
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 @@ class Sanitize
]
)
MASTODON_OEMBED ||= freeze_config(
MASTODON_OEMBED = freeze_config(
elements: %w(audio embed iframe source video),
attributes: {

View file

@ -18,21 +18,8 @@ RSpec.describe Admin::AccountsController do
end
it 'filters with parameters' do
new = AccountFilter.method(:new)
expect(AccountFilter).to receive(:new) do |params|
h = params.to_h
expect(h[:origin]).to eq 'local'
expect(h[:by_domain]).to eq 'domain'
expect(h[:status]).to eq 'active'
expect(h[:username]).to eq 'username'
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
account_filter = instance_double(AccountFilter, results: Account.all)
allow(AccountFilter).to receive(:new).and_return(account_filter)
get :index, params: {
origin: 'local',
@ -43,6 +30,18 @@ RSpec.describe Admin::AccountsController do
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'
expect(h[:by_domain]).to eq 'domain'
expect(h[:status]).to eq 'active'
expect(h[:username]).to eq 'username'
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'
end
end
it 'paginates accounts' do

View file

@ -19,10 +19,6 @@ RSpec.describe Admin::Settings::BrandingController do
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

View file

@ -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 @@ describe Api::V1::StreamingController do
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

View file

@ -53,7 +53,7 @@ RSpec.describe Api::V2::SearchController do
context 'without token' do
describe 'GET #index' do
let(:search_params) {}
let(:search_params) { nil }
before do
get :index, params: search_params

View file

@ -8,13 +8,11 @@ describe EmojisController do
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

View file

@ -16,7 +16,7 @@ describe WellKnown::WebfingerController do
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

View file

@ -1,4 +1,3 @@
# frozen_string_literal: true
Fabricator :access_token, from: 'Doorkeeper::AccessToken' do
end
Fabricator :access_token, from: 'Doorkeeper::AccessToken'

View file

@ -1,4 +1,3 @@
# frozen_string_literal: true
Fabricator(:conversation) do
end
Fabricator(:conversation)

View file

@ -1,4 +1,3 @@
# frozen_string_literal: true
Fabricator(:system_key) do
end
Fabricator(:system_key)

View file

@ -7,11 +7,7 @@ describe 'email confirmation flow when captcha is enabled' do
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 @@ describe 'email confirmation flow when captcha is enabled' do
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

View file

@ -18,13 +18,15 @@ RSpec.describe Admin::AccountModerationNotesHelper do
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

View file

@ -18,7 +18,7 @@ describe InstanceHelper do
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

View file

@ -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 @@ RSpec.describe AccountStatusesFilter do
end
describe '#results' do
subject { described_class.new(account, current_account, params).results }
let(:tag) { Fabricate(:tag) }
before do
@ -61,7 +61,7 @@ RSpec.describe AccountStatusesFilter do
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 @@ RSpec.describe AccountStatusesFilter do
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 @@ RSpec.describe AccountStatusesFilter do
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 @@ RSpec.describe AccountStatusesFilter do
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 @@ RSpec.describe AccountStatusesFilter do
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 @@ RSpec.describe AccountStatusesFilter do
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 @@ RSpec.describe AccountStatusesFilter do
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 @@ RSpec.describe AccountStatusesFilter do
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 @@ RSpec.describe AccountStatusesFilter do
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 @@ RSpec.describe AccountStatusesFilter do
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 @@ RSpec.describe AccountStatusesFilter do
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 @@ RSpec.describe AccountStatusesFilter do
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 @@ RSpec.describe AccountStatusesFilter do
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

View file

@ -53,7 +53,7 @@ RSpec.describe ActivityPub::Adapter do
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 }

View file

@ -4,9 +4,51 @@ require 'rails_helper'
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

View file

@ -29,12 +29,16 @@ describe WebfingerResource do
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

View file

@ -78,13 +78,15 @@ RSpec.describe Admin::AccountAction do
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

View file

@ -120,8 +120,11 @@ RSpec.describe Remotable do
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 @@ RSpec.describe Remotable do
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 @@ RSpec.describe Remotable do
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 @@ RSpec.describe Remotable do
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 @@ RSpec.describe Remotable do
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

View file

@ -21,12 +21,17 @@ RSpec.describe FollowRequest do
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

View file

@ -7,8 +7,11 @@ RSpec.describe Identity do
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

View file

@ -74,9 +74,13 @@ RSpec.describe SessionActivation do
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

View file

@ -23,8 +23,11 @@ RSpec.describe Setting do
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 @@ RSpec.describe Setting do
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 @@ RSpec.describe Setting do
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

View file

@ -60,7 +60,7 @@ RSpec.describe UserRole do
end
describe '#permissions_as_keys=' do
let(:input) {}
let(:input) { nil }
before do
subject.permissions_as_keys = input

View file

@ -102,7 +102,7 @@ RSpec.describe User do
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 @@ RSpec.describe User do
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 @@ RSpec.describe User do
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 @@ RSpec.describe User do
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 @@ RSpec.describe User do
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 @@ RSpec.describe User do
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'

View file

@ -142,13 +142,13 @@ RSpec.configure do |config|
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

View file

@ -171,12 +171,10 @@ describe 'Caching behavior' do
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

View file

@ -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

View file

@ -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 @@ describe ActivityPub::NoteSerializer do
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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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) }

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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,

View file

@ -36,8 +36,11 @@ RSpec.describe ActivityPub::FetchRepliesService, type: :service do
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 @@ RSpec.describe ActivityPub::FetchRepliesService, type: :service do
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 @@ RSpec.describe ActivityPub::FetchRepliesService, type: :service 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
@ -76,8 +85,11 @@ RSpec.describe ActivityPub::FetchRepliesService, type: :service do
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 @@ RSpec.describe ActivityPub::FetchRepliesService, type: :service 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
@ -109,8 +124,11 @@ RSpec.describe ActivityPub::FetchRepliesService, type: :service do
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

View file

@ -41,8 +41,11 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
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 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
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 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
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 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
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 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
anything
)
expect(ActivityPub::Activity).to_not receive(:factory).with(
expect(ActivityPub::Activity).to_not have_received(:factory).with(
hash_including(
'object' => hash_including(
'content' => '<p>puck was here</p>'
@ -245,8 +261,6 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do
anything
)
subject.call(json, forwarder)
expect(Status.where(uri: 'https://example.com/users/bob/fake-status').exists?).to be false
end
end

View file

@ -54,7 +54,7 @@ RSpec.describe BulkImportService do
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 @@ RSpec.describe BulkImportService do
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 @@ RSpec.describe BulkImportService do
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 @@ RSpec.describe BulkImportService do
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

View file

@ -208,7 +208,7 @@ RSpec.describe ImportService, type: :service do
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 @@ RSpec.describe ImportService, type: :service do
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

View file

@ -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

View file

@ -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

View file

@ -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

Some files were not shown because too many files have changed in this diff Show more