Merge commit 'ba0fadc332b440864e6b6010e749b02a5d94a5de' into glitch-soc/merge-upstream

This commit is contained in:
Claire committed 2026-07-09 19:31:51 +02:00
commit b0d5a26c9d
34 files changed
+440 -90

No files matched your search

+2 -2
View File
@@ -151,7 +151,7 @@ GEM
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
capybara-playwright-driver (0.5.9)
capybara-playwright-driver (0.5.10)
addressable
capybara
playwright-ruby-client (>= 1.16.0)
@@ -446,7 +446,7 @@ GEM
mime-types (3.7.0)
logger
mime-types-data (~> 3.2025, >= 3.2025.0507)
mime-types-data (3.2026.0414)
mime-types-data (3.2026.0701)
mini_mime (1.1.5)
mini_portile2 (2.8.9)
minitest (6.0.6)
+11 -8
View File
@@ -358,8 +358,8 @@
"carousel.slide": "Slaid {current, number} / {max, number}",
"character_counter.recommended": "{currentLength}/{maxLength} soovitatud märke",
"character_counter.required": "{currentLength}/{maxLength} märki",
"closed_registrations.other_server_instructions": "Kuna Mastodon on detsentraliseeritud, võib konto teha teise serverisse ja sellegipoolest siinse kontoga suhelda.",
"closed_registrations_modal.description": "Praegu ei ole võimalik teha {domain} peale kontot, aga pea meeles, et sul ei pea olema just {domain} konto, et Mastodoni kasutada.",
"closed_registrations.other_server_instructions": "Kuna Mastodon on detsentraliseeritud, võid konto teha teise serverisse ja sellegipoolest siinse kontoga suhelda.",
"closed_registrations_modal.description": "Praegu ei ole võimalik {domain} serverisse kontot lisada, aga pea meeles, et sul ei pea olema just {domain}-i konto, et Mastodoni kasutada.",
"closed_registrations_modal.find_another_server": "Leia mõni muu server",
"closed_registrations_modal.preamble": "Mastodon on hajutatud võrk, mis tähendab, et konto võid luua ükskõik kuhu, kuid ikkagi saad jälgida ja suhelda igaühega selles serveris. Võid isegi oma serveri püsti panna!",
"closed_registrations_modal.title": "Mastodoni registreerumine",
@@ -415,21 +415,21 @@
"collections.mark_as_sensitive_hint": "Peidab kogumiku kirjelduse ja kontod sisuhoiatuse taha. Kogumiku nimi ise on sellele vaatamata nähtav.",
"collections.maximum_collection_count_description": "Sinu server lubab luua kuni {count} kogumikku.",
"collections.maximum_collection_count_reached": "Sa oled loonud nii palju kogumikke, kui on lubatud",
"collections.name_length_hint": "40 märgi piir",
"collections.name_length_hint": "40 tähemärgi piir",
"collections.new_collection": "Uus kogumik",
"collections.pending_accounts.message": "Kui oled ootamst vastut kasutajalt oma serverist, võivad kasutajakontod tunduda olema ootel olekus. Vaid sina saad näha ootel kasutajakontosid.",
"collections.pending_accounts.message": "Kui oled ootamas vastust kasutajalt tema serverist, võivad kasutajakontod tunduda olema ootel olekus. Vaid sina saad näha ootel kasutajakontosid.",
"collections.pending_accounts.title": "Miks ma näen ootel kasutajakontosid?",
"collections.remove_account": "Eemalda",
"collections.report_collection": "Raporteeri sellest kogumikust",
"collections.report_collection": "Teata sellest kogumikust",
"collections.revoke_collection_inclusion": "Eemalda mind sellest kogumikust",
"collections.revoke_inclusion.confirmation": "Oled eemaldatud \"{collection}\"-st",
"collections.revoke_inclusion.error": "Oli viga, palun proovi hiljem uuesti.",
"collections.revoke_inclusion.confirmation": "Oled eemaldatud „{collection}“ kogumikust",
"collections.revoke_inclusion.error": "Tekkis viga, palun proovi hiljem uuesti.",
"collections.search_accounts_label": "Otsi kontot, mida lisada",
"collections.search_accounts_max_reached": "Oled lisanud maksimumarvu kontosid",
"collections.sensitive": "Tundlik",
"collections.share_short": "Jaga",
"collections.sort_alphabetical": "Tähestikuline",
"collections.sort_by": "Sortimine:",
"collections.sort_by": "Järjestus:",
"collections.sort_date_added": "Lisamisaeg",
"collections.sort_last_active": "Viimati aktiivne",
"collections.sort_most_followers": "Enim jälgijaid",
@@ -1231,6 +1231,7 @@
"status.block": "Blokeeri @{name}",
"status.bookmark": "Järjehoidja",
"status.cancel_reblog_private": "Lõpeta jagamine",
"status.cannot_edit": "Sul pole õigust seda postitust muuta",
"status.cannot_quote": "Sul pole õigust seda postitust tsiteerida",
"status.cannot_reblog": "Seda postitust ei saa jagada",
"status.contains_quote": "Sisaldab tsitaati",
@@ -1264,8 +1265,10 @@
"status.more": "Veel",
"status.mute": "Summuta @{name}",
"status.mute_conversation": "Summuta vestlus",
"status.not_quoted": "Sa pole selles postituses tsiteeritud",
"status.open": "Laienda postitus",
"status.pin": "Kinnita profiilile",
"status.public_only": "See postitus on privaatne",
"status.quote": "Tsiteeri",
"status.quote.cancel": "Katkesta tsiteerimine",
"status.quote_error.blocked_account_hint.title": "Kuna sa oled blokeerinud kasutaja @{name}, siis see postitus on peidetud.",
+37
View File
@@ -2,6 +2,7 @@
"about.blocks": "Moderatutako zerbitzariak",
"about.contact": "Kontaktua:",
"about.default_locale": "Lehenetsia",
"about.disclaimer": "Mastodon software libre eta kode irekikoa da, eta Mastodon gGmbH-ren marka erregistratua.",
"about.domain_blocks.no_reason_available": "Arrazoia ez dago eskuragarri",
"about.domain_blocks.preamble": "Mastodonek orokorrean aukera ematen dizu fedibertsoko beste zerbitzarietako erabiltzaileen edukia ikusi eta haiekin komunikatzeko. Zerbitzari zehatz honi ezarritako salbuespenak hauek dira.",
"about.domain_blocks.silenced.explanation": "Orokorrean ez duzu zerbitzari honetako profil eta edukirik ikusiko. Profilak jarraitzen badituzu edo edukia esplizituki bilatzen baduzu bai.",
@@ -13,9 +14,14 @@
"about.powered_by": "{mastodon} erabiltzen duen sare sozial deszentralizatua",
"about.rules": "Zerbitzariaren arauak",
"account.account_note_header": "Ohar pertsonala",
"account.activity": "Jarduera",
"account.add_note": "Gehitu ohar pertsonala",
"account.add_or_remove_from_list": "Gehitu edo kendu zerrendetatik",
"account.badges.admin": "Administratzailea",
"account.badges.blocked": "Blokeatuta",
"account.badges.bot": "Bot-a",
"account.badges.group": "Taldea",
"account.badges.muted": "Mutututa",
"account.block": "Blokeatu @{name}",
"account.block_domain": "Blokeatu {domain} domeinua",
"account.block_short": "Blokeatu",
@@ -24,6 +30,7 @@
"account.copy": "Kopiatu profilerako esteka",
"account.direct": "Aipatu pribatuki @{name}",
"account.disable_notifications": "Utzi jakinarazteari @{name} erabiltzaileak argitaratzean",
"account.edit_note": "Editatu ohar pertsonala",
"account.edit_profile": "Editatu profila",
"account.edit_profile_short": "Editatu",
"account.enable_notifications": "Jakinarazi @{name} erabiltzaileak argitaratzean",
@@ -33,6 +40,15 @@
"account.familiar_followers_two": "{name1}-k eta {name2}-k jarraitzen dute",
"account.featured": "Gailenak",
"account.featured.accounts": "Profilak",
"account.featured.collections": "Bildumak",
"account.featured.new_collection": "Bilduma berria",
"account.field_overflow": "Erakutsi eduki osoa",
"account.filters.all": "Jarduera guztia",
"account.filters.boosts_toggle": "Erakutsi bultzadak",
"account.filters.posts_boosts": "Bidalketak eta bultzadak",
"account.filters.posts_only": "Bidalketak",
"account.filters.posts_replies": "Bidalketak eta erantzunak",
"account.filters.replies_toggle": "Erakutsi erantzunak",
"account.follow": "Jarraitu",
"account.follow_back": "Jarraitu bueltan",
"account.follow_back_short": "Jarraitu bueltan",
@@ -51,18 +67,38 @@
"account.go_to_profile": "Joan profilera",
"account.hide_reblogs": "Ezkutatu @{name} erabiltzailearen bultzadak",
"account.in_memoriam": "Oroimenezkoa.",
"account.join_modal.day": "Eguna",
"account.joined_short": "Elkartuta",
"account.languages": "Aldatu harpidetutako hizkuntzak",
"account.last_active": "Azkenekoz aktiboa",
"account.link_verified_on": "Esteka honen jabetzaren egiaztaketa data: {date}",
"account.locked_info": "Kontu honen pribatutasun egoera blokeatuta gisa ezarri da. Jabeak eskuz erabakitzen du nork jarraitu diezaioken.",
"account.media": "Multimedia",
"account.mention": "Aipatu @{name}",
"account.menu.add_to_collection": "Gehitu bildumara…",
"account.menu.add_to_list": "Gehitu zerrendara…",
"account.menu.block": "Blokeatu kontua",
"account.menu.block_domain": "Blokeatu {domain}",
"account.menu.copy": "Kopiatu esteka",
"account.menu.direct": "Aipatu pribatuki",
"account.menu.hide_reblogs": "Ezkutatu bultzadak denbora-lerroan",
"account.menu.mention": "Aipamena",
"account.menu.mute": "Mututu kontua",
"account.menu.open_original_page": "Ikusi {domain}-(e)n",
"account.menu.remove_follower": "Kendu jarraitzailea",
"account.menu.report": "Salatu kontua",
"account.menu.share": "Partekatu…",
"account.menu.show_reblogs": "Ezkutatu bultzadak denbora-lerroan",
"account.menu.unblock": "Desblokeatu kontua",
"account.menu.unblock_domain": "Desblokeatu {domain}",
"account.menu.unmute": "Desmututu kontua",
"account.moved_to": "{name} erabiltzaileak adierazi du bere kontu berria hau dela:",
"account.mute": "Mututu @{name}",
"account.mute_notifications_short": "Mututu jakinarazpenak",
"account.mute_short": "Mututu",
"account.muted": "Mutututa",
"account.mutual": "Elkar jarraitzen duzue",
"account.name.copy": "Kopiatu helbidea",
"account.name.help.domain_self": "{domain} zure zerbitzaria da, zure profila eta bidalketak ostatatzen dituena.",
"account.name.help.footer": "Poste elektronikoak hornitzaile ezberdinak darabiltzaten lagunei bidali ahal dizkiezun bezalaxe, beste Mastodon zerbitzari abtzuetako erabiltzaileekin ere komunikatu zaitezke, baita Fedobertsoko beste aplikazioen erabiltzaileekin ere.",
"account.name.help.header": "Erabiltzaile-izena posta elektroniko helbide bat bezalakoa da",
@@ -318,6 +354,7 @@
"collection.share_modal.share_via_system": "Bidali hona…",
"collection.share_modal.title": "Partekatu bilduma",
"collection.share_modal.title_new": "Partekatu zure bilduma berria!",
"collections.last_updated_at": "Azkenengo eguneraketa: {date}",
"collections.pending_accounts.title": "Zergatik ikusten ditut kontu batzuk 'zain'?",
"collections.remove_account": "Kendu",
"collections.report_collection": "Salatu bilduma hau",
+1 -1
View File
@@ -668,7 +668,7 @@
"empty_column.notifications": "Vous n'avez pas encore de notifications. Quand d'autres personnes interagissent avec vous, vous en verrez ici.",
"empty_column.public": "Il n’y a rien ici! Écrivez quelque chose publiquement, ou bien suivez manuellement des personnes d’autres serveurs pour remplir le fil public",
"empty_state.no_results": "Aucun résultat",
"error.no_hashtag_feed_access": "Rejoindre ou se connecter pour voir et suivre cet hashtag.",
"error.no_hashtag_feed_access": "Rejoindre ou se connecter pour voir et suivre ce hashtag.",
"error.unexpected_crash.explanation": "En raison d’un bogue dans notre code ou d’un problème de compatibilité avec votre navigateur, cette page n’a pas pu être affichée correctement.",
"error.unexpected_crash.explanation_addons": "Cette page n’a pas pu être affichée correctement. Cette erreur est probablement causée par une extension de navigateur ou des outils de traduction automatique.",
"error.unexpected_crash.next_steps": "Essayez de rafraîchir la page. Si cela n’aide pas, vous pouvez toujours utiliser Mastodon via un autre navigateur ou une application native.",
+3 -3
View File
@@ -661,14 +661,14 @@
"empty_column.follow_requests": "Vous n’avez pas encore de demande de suivi. Lorsque vous en recevrez une, elle apparaîtra ici.",
"empty_column.followed_tags": "Vous n'avez pas encore suivi de hashtags. Lorsque vous le ferez, ils apparaîtront ici.",
"empty_column.hashtag": "Il n’y a encore aucun contenu associé à ce hashtag.",
"empty_column.home": "Votre fil principal est vide ! Suivez plus de personnes pour le remplir.",
"empty_column.home": "Votre fil d'actualité est vide ! Suivez plus de personnes pour le remplir.",
"empty_column.list": "Il n’y a rien dans cette liste pour l’instant. Quand des membres de cette liste publieront de nouveaux messages, ils apparaîtront ici.",
"empty_column.mutes": "Vous n’avez masqué aucun compte pour le moment.",
"empty_column.notification_requests": "C'est fini ! Il n'y a plus rien ici. Lorsque vous recevez de nouvelles notifications, elles apparaitront ici conformément à vos préférences.",
"empty_column.notifications": "Vous n’avez pas encore de notification. Interagissez avec d’autres personnes pour commencer la conversation.",
"empty_column.public": "Il n’y a rien ici ! Écrivez quelque chose publiquement, ou bien suivez manuellement des personnes d’autres serveurs pour remplir le fil public",
"empty_column.public": "Il n’y a rien ici ! Écrivez quelque chose publiquement, ou bien suivez manuellement des personnes d’autres serveurs pour remplir le fil d'actualité",
"empty_state.no_results": "Aucun résultat",
"error.no_hashtag_feed_access": "Rejoindre ou se connecter pour voir et suivre cet hashtag.",
"error.no_hashtag_feed_access": "Rejoindre ou se connecter pour voir et suivre ce hashtag.",
"error.unexpected_crash.explanation": "En raison d’un bug dans notre code ou d’un problème de compatibilité avec votre navigateur, cette page n’a pas pu être affichée correctement.",
"error.unexpected_crash.explanation_addons": "Cette page n’a pas pu être affichée correctement. Cette erreur est probablement causée par une extension de navigateur ou des outils de traduction automatique.",
"error.unexpected_crash.next_steps": "Essayez de rafraîchir la page. Si cela n’aide pas, vous pouvez toujours utiliser Mastodon via un autre navigateur ou une application native.",
+17
View File
@@ -2,6 +2,7 @@
"about.blocks": "制限中のサーバー",
"about.contact": "連絡先",
"about.default_locale": "デフォルト",
"about.disclaimer": "Mastodonは自由なオープンソースソフトウェアであり、Mastodon GmbHの商標です。",
"about.domain_blocks.no_reason_available": "理由未記載",
"about.domain_blocks.preamble": "Mastodonでは原則的にあらゆるサーバー同士で交流したり、互いの投稿を読んだりできますが、当サーバーでは例外的に次のような制限を設けています。",
"about.domain_blocks.silenced.explanation": "このサーバーのプロフィールやコンテンツは、明示的に検索したり、フォローでオプトインしない限り、通常は表示されません。",
@@ -43,6 +44,7 @@
"account.featured.accounts": "プロフィール",
"account.featured.collections": "コレクション",
"account.featured.new_collection": "新規のコレクション",
"account.field_overflow": "すべて表示",
"account.filters.all": "全てのアクティビティ",
"account.filters.boosts_toggle": "ブーストを表示",
"account.filters.posts_boosts": "投稿とブースト",
@@ -67,15 +69,28 @@
"account.go_to_profile": "プロフィールページへ",
"account.hide_reblogs": "@{name}さんからのブーストを非表示",
"account.in_memoriam": "故人を偲んで。",
"account.join_modal.day": "日",
"account.join_modal.me": "あなたが {server} に参加したのは",
"account.join_modal.me_anniversary": "Fediversaryおめでとうございます!あなたが {server} に参加したのは",
"account.join_modal.me_today": "今日は {server} での最初の日です!",
"account.join_modal.other": "{name} が {server} に参加したのは",
"account.join_modal.other_today": "今日は {name} の {server} での最初の日です!",
"account.join_modal.share.celebrate": "お祝いの投稿を共有する",
"account.join_modal.share.intro": "自己紹介の投稿を共有する",
"account.join_modal.share.welcome": "歓迎の投稿を共有する",
"account.join_modal.years": "{number, plural, one {年} other {年}}",
"account.joined_short": "登録日",
"account.languages": "購読言語の変更",
"account.last_active": "最後の活動",
"account.link_verified_on": "このリンクの所有権は{date}に確認されました",
"account.locked_info": "このアカウントは承認制アカウントです。相手が承認するまでフォローは完了しません。",
"account.media": "メディア",
"account.mention": "@{name}さんにメンション",
"account.menu.add_to_collection": "コレクションに追加…",
"account.menu.add_to_list": "リストに追加する…",
"account.menu.block": "アカウントをブロックする",
"account.menu.block_domain": "{domain} をブロックする",
"account.menu.copied": "アカウントへのリンクをクリップボードにコピーしました",
"account.menu.copy": "リンクをコピーする",
"account.menu.direct": "非公開でメンションする",
"account.menu.hide_reblogs": "タイムラインでブーストを隠す",
@@ -85,6 +100,8 @@
"account.menu.open_original_page": "{domain} で表示する",
"account.menu.remove_follower": "フォロワーを削除する",
"account.menu.report": "アカウントを報告する",
"account.menu.share": "共有…",
"account.menu.show_reblogs": "タイムラインにブーストを表示する",
"account.menu.unblock": "アカウントのブロックを解除する",
"account.menu.unblock_domain": "{domain} のブロックを解除する",
"account.menu.unmute": "アカウントのミュートを解除する",
+1 -1
View File
@@ -54,7 +54,7 @@
"account.follow": "跟tuè",
"account.follow_back": "Tuè tńg去",
"account.follow_back_short": "Tuè tńg去",
"account.follow_request": "請求跟tuè lí",
"account.follow_request": "請求跟tuè",
"account.follow_request_cancel": "取消跟tuè",
"account.follow_request_cancel_short": "取消",
"account.follow_request_short": "請求",
+1
View File
@@ -190,6 +190,7 @@
"closed_registrations_modal.title": "Mastodon ਲਈ ਸਾਈਨ ਅੱਪ ਕਰੋ",
"collection.share_modal.share_link_label": "ਲਿੰਕ ਸਾਂਝਾ ਕਰੋ",
"collection.share_modal.share_via_post": "Mastodon ਉੱਤੇ ਪੋਸਟ ਕਰੋ",
"collection.share_modal.share_via_system": "…ਰਾਹੀਂ ਸਾਂਝਾ ਕਰੋ",
"collections.block_collection_owner": "…ਰਾਹੀਂ ਸਾਂਝਾ ਕਰੋ",
"collections.by_account": "{account_handle} ਵਲੋਂ",
"collections.collection_description": "ਵਰਣਨ",
+1 -1
View File
@@ -25,7 +25,7 @@ class Multibase
class Error < StandardError; end
def self.decode(string)
raise Error, 'Multibase string is null' if string.nil?
raise Error, 'Multibase string is nil' if string.nil?
case string[0]
when 'u'
+42 -38
View File
@@ -60,6 +60,25 @@ class PerOperationWithDeadline < HTTP::Timeout::PerOperation
end
end
# Implement HTTP Signature cavage draft as a HTTP.rb middleware
class CavageSignatureFeature < HTTP::Feature
def initialize(keypair: nil, covered_headers: [])
super
@signing = HttpSignatureDraft.new(keypair.keypair, keypair.full_uri) if keypair.present?
@covered_headers = covered_headers
end
def wrap_request(request)
signed_headers = request.headers.to_h.slice(*@covered_headers)
request.headers['Signature'] = @signing.sign(signed_headers, request.verb, Addressable::URI.parse(request.uri))
request
end
# Register this feature with http.rb
::HTTP::Options.register_feature(:http_cavage_signature, self)
end
class Request
# We enforce a 5s timeout on DNS resolving, 5s timeout on socket opening
# and 5s timeout on the TLS handshake, meaning the worst case should take
@@ -69,6 +88,8 @@ class Request
include RoutingHelper
attr_reader :headers, :signing_keypair
def initialize(verb, url, **options)
raise ArgumentError if url.blank?
@@ -79,7 +100,6 @@ class Request
@options = {
follow: {
max_hops: 3,
on_redirect: ->(response, request) { re_sign_on_redirect(response, request) },
},
}.merge(options).merge(
socket_class: use_proxy? || @allow_local ? ProxySocket : Socket,
@@ -89,19 +109,17 @@ class Request
@options = @options.merge(proxy_url) if use_proxy?
@headers = {}
@signing = nil
@signing_keypair = nil
raise Mastodon::HostValidationError, 'Instance does not support hidden service connections' if block_hidden_service?
set_common_headers!
set_digest! if options.key?(:body)
end
def on_behalf_of(actor, sign_with: nil)
raise ArgumentError, 'actor must not be nil' if actor.nil?
keypair = sign_with.presence || actor.keypair(type: :rsa)
@signing = HttpSignatureDraft.new(keypair.keypair, keypair.full_uri)
@signing_keypair = sign_with.presence || actor.keypair(type: :rsa)
self
end
@@ -113,7 +131,7 @@ class Request
def perform
begin
response = http_client.request(@verb, @url.to_s, @options.merge(headers: headers))
response = perform_cavage_signed_request
rescue => e
raise e.class, "#{e.message} on #{@url}", e.backtrace[0]
end
@@ -126,10 +144,6 @@ class Request
end
end
def headers
(@signing ? @headers.merge('Signature' => signature) : @headers)
end
class << self
def valid_url?(url)
begin
@@ -148,6 +162,24 @@ class Request
private
def perform_cavage_signed_request
headers = @headers
headers = headers.merge('Digest' => "SHA-256=#{Digest::SHA256.base64digest(@options[:body])}") if @options[:body]
client = http_client
if @signing_keypair.present?
client = client.use(
http_cavage_signature: {
keypair: @signing_keypair,
covered_headers: headers.keys - %w(User-Agent Accept-Encoding Accept),
}
)
end
client.request(@verb, @url.to_s, @options.merge(headers:))
end
# Using code from https://github.com/sporkmonger/addressable/blob/3450895887d0a1770660d8831d1b6fcfed9bd9d6/lib/addressable/uri.rb#L1609-L1635
# to preserve some URL Encodings while normalizing
def normalize_preserving_url_encodings(url, preserved_chars = SAFE_PRESERVED_CHARS, *flags)
@@ -183,34 +215,6 @@ class Request
@headers['Accept-Encoding'] = 'gzip' if @verb != :head
end
def set_digest!
@headers['Digest'] = "SHA-256=#{Digest::SHA256.base64digest(@options[:body])}"
end
def signature
@signing.sign(@headers.without('User-Agent', 'Accept-Encoding'), @verb, @url)
end
def re_sign_on_redirect(_response, request)
# Delete existing signature if there is one, since it will be invalid
request.headers.delete('Signature')
return unless @signing.present? && @verb == :get
signed_headers = request.headers.to_h.slice(*@headers.keys)
unless @headers.keys.all? { |key| signed_headers.key?(key) }
# We have lost some headers in the process, so don't sign the new
# request, in order to avoid issuing a valid signature with fewer
# conditions than expected.
Rails.logger.warn { "Some headers (#{@headers.keys - signed_headers.keys}) have been lost on redirect from {@uri} to #{request.uri}, this should not happen. Skipping signatures" }
return
end
signature_value = @signing.sign(signed_headers.without('User-Agent', 'Accept-Encoding', 'Accept'), @verb, Addressable::URI.parse(request.uri))
request.headers['Signature'] = signature_value
end
def http_client
@http_client ||= Request.http_client
end
+19 -1
View File
@@ -9,7 +9,7 @@ class AdminMailer < ApplicationMailer
before_action :process_params
before_action :set_instance
after_action :set_important_headers!, only: :new_critical_software_updates
after_action :set_important_headers!, only: [:new_critical_software_updates, :end_of_support_out_of_support_warning]
around_action :set_locale
@@ -57,6 +57,24 @@ class AdminMailer < ApplicationMailer
mail subject: default_i18n_subject(instance: @instance)
end
def end_of_support_three_months_warning
@software_updates = SoftwareUpdate.by_version
mail subject: default_i18n_subject(instance: @instance, branch: SoftwareDeprecation.current_branch)
end
def end_of_support_two_weeks_warning
@software_updates = SoftwareUpdate.by_version
mail subject: default_i18n_subject(instance: @instance, branch: SoftwareDeprecation.current_branch)
end
def end_of_support_out_of_support_warning
@software_updates = SoftwareUpdate.by_version
mail subject: default_i18n_subject(instance: @instance, branch: SoftwareDeprecation.current_branch)
end
def auto_close_registrations
mail subject: default_i18n_subject(instance: @instance)
end
+37
View File
@@ -0,0 +1,37 @@
# frozen_string_literal: true
# == Schema Information
#
# Table name: software_deprecations
#
# id :bigint(8) not null, primary key
# branch :string not null
# end_of_support :date not null
# warning_issued :integer not null
# created_at :datetime not null
# updated_at :datetime not null
#
class SoftwareDeprecation < ApplicationRecord
enum :warning_issued, {
none: 0,
three_months_warning: 1,
two_weeks_warning: 2,
out_of_support_warning: 3,
}, validate: true, suffix: :issued
def unsupported?
end_of_support.past?
end
def self.clear_irrelevant_branches!
where.not(branch: current_branch).delete_all
end
def self.current
find_by(branch: current_branch)
end
def self.current_branch
Mastodon::Version.gem_version.segments[...2].join('.')
end
end
+1
View File
@@ -61,6 +61,7 @@ class UserSettings
setting :status_trends, default: false
setting :appeal, default: true
setting :software_updates, default: 'critical', in: %w(none critical patch all)
setting :end_of_support, default: true
end
namespace :interactions do
+51 -8
View File
@@ -3,9 +3,12 @@
class SoftwareUpdateCheckService < BaseService
def call
clean_outdated_updates!
clean_outdated_deprecations!
return unless SoftwareUpdate.check_enabled?
process_update_notices!(fetch_update_notices)
json = fetch_update_notices
process_update_notices!(json&.fetch('updatesAvailable', nil))
process_deprecation_notice!(json&.fetch('currentVersion', nil))
end
private
@@ -18,6 +21,10 @@ class SoftwareUpdateCheckService < BaseService
end
end
def clean_outdated_deprecations!
SoftwareDeprecation.clear_irrelevant_branches!
end
def fetch_update_notices
Request.new(:get, "#{api_url}?version=#{version}").add_headers('Accept' => 'application/json', 'User-Agent' => 'Mastodon update checker').perform do |res|
return JSON.parse(res.body_with_limit) if res.code == 200
@@ -35,19 +42,17 @@ class SoftwareUpdateCheckService < BaseService
end
def process_update_notices!(update_notices)
return if update_notices.blank? || update_notices['updatesAvailable'].nil?
return if update_notices.blank?
# Clear notices that are not listed by the update server anymore
SoftwareUpdate.where.not(version: update_notices['updatesAvailable'].pluck('version')).delete_all
return if update_notices['updatesAvailable'].blank?
SoftwareUpdate.where.not(version: update_notices.pluck('version')).delete_all
# Check if any of the notices is new, and issue notifications
known_versions = SoftwareUpdate.where(version: update_notices['updatesAvailable'].pluck('version')).pluck(:version)
new_update_notices = update_notices['updatesAvailable'].filter { |notice| known_versions.exclude?(notice['version']) }
known_versions = SoftwareUpdate.where(version: update_notices.pluck('version')).pluck(:version)
new_update_notices = update_notices.filter { |notice| known_versions.exclude?(notice['version']) }
return if new_update_notices.blank?
SoftwareUpdate.upsert_all(update_notices['updatesAvailable'].map do |notice|
SoftwareUpdate.upsert_all(update_notices.map do |notice|
{ version: notice['version'], urgent: notice['urgent'], type: notice['type'], release_notes: notice['releaseNotes'], end_of_support: notice['endOfSupport']&.to_date }
end, unique_by: :version)
@@ -56,6 +61,18 @@ class SoftwareUpdateCheckService < BaseService
notify_devops!(new_updates)
end
def process_deprecation_notice!(current_version)
return if current_version.blank? || current_version['endOfSupport'].blank?
deprecation_notice = SoftwareDeprecation
.create_with(warning_issued: :none, end_of_support: current_version['endOfSupport'].to_date)
.find_or_create_by(branch: SoftwareDeprecation.current_branch)
deprecation_notice.update(end_of_support: current_version['endOfSupport'].to_date)
notify_of_end_of_support!(deprecation_notice)
end
def should_notify_user?(user, urgent_version, patch_version)
case user.settings['notification_emails.software_updates']
when 'none'
@@ -83,4 +100,30 @@ class SoftwareUpdateCheckService < BaseService
end
end
end
def should_notify_about_end_of_support?(user)
user.settings['notification_emails.end_of_support']
end
def send_notification_for_end_of_support_warning!(deprecation_notice, warning_type)
return if deprecation_notice.warning_issued == warning_type
User.those_who_can(:view_devops).includes(:account).find_each do |user|
next unless should_notify_about_end_of_support?(user)
AdminMailer.with(recipient: user.account).public_send("end_of_support_#{warning_type}").deliver_later
end
deprecation_notice.update!(warning_issued: warning_type)
end
def notify_of_end_of_support!(deprecation_notice)
if deprecation_notice.end_of_support.past?
send_notification_for_end_of_support_warning!(deprecation_notice, 'out_of_support_warning')
elsif deprecation_notice.end_of_support < 2.weeks.from_now
send_notification_for_end_of_support_warning!(deprecation_notice, 'two_weeks_warning')
elsif deprecation_notice.end_of_support < 3.months.from_now
send_notification_for_end_of_support_warning!(deprecation_notice, 'three_months_warning')
end
end
end
@@ -1,6 +1,12 @@
- content_for :page_title do
= t('admin.software_updates.title')
- current_deprecation = SoftwareDeprecation.current
- if current_deprecation&.unsupported?
.flash-message.alert= t('admin.software_updates.unsupported_branch')
- elsif current_deprecation.present?
.flash-message.warning= t('admin.software_updates.nearing_eol', date: current_deprecation.end_of_support)
.simple_form
%p.lead
= t('admin.software_updates.description')
@@ -0,0 +1,7 @@
<%= raw t('admin_mailer.end_of_support_out_of_support_warning.body') %>
<% @software_updates.each do |update| %>
- Mastodon <%= update.version %>: <%= update.release_notes %>
<% end %>
<%= raw t('application_mailer.view')%> <%= admin_software_updates_url %>
@@ -0,0 +1,7 @@
<%= raw t('admin_mailer.end_of_support_three_months_warning.body') %>
<% @software_updates.each do |update| %>
- Mastodon <%= update.version %>: <%= update.release_notes %>
<% end %>
<%= raw t('application_mailer.view')%> <%= admin_software_updates_url %>
@@ -0,0 +1,7 @@
<%= raw t('admin_mailer.end_of_support_two_weeks_warning.body') %>
<% @software_updates.each do |update| %>
- Mastodon <%= update.version %>: <%= update.release_notes %>
<% end %>
<%= raw t('application_mailer.view')%> <%= admin_software_updates_url %>
@@ -23,8 +23,8 @@
.fields-group
= ff.input :always_send_emails, wrapper: :with_label, label: I18n.t('simple_form.labels.defaults.setting_always_send_emails'), hint: I18n.t('simple_form.hints.defaults.setting_always_send_emails')
- if current_user.can?(:manage_reports, :manage_appeals, :manage_users, :manage_taxonomies) || (SoftwareUpdate.check_enabled? && current_user.can?(:view_devops))
%h2= t 'notifications.administration_emails'
- if current_user.can?(:manage_reports, :manage_appeals, :manage_users, :manage_taxonomies)
%h2= t 'notifications.moderation_emails'
.fields-group
= ff.input :'notification_emails.report', wrapper: :with_label, label: I18n.t('simple_form.labels.notification_emails.report') if current_user.can?(:manage_reports)
@@ -34,13 +34,21 @@
= ff.input :'notification_emails.link_trends', wrapper: :with_label, label: I18n.t('simple_form.labels.notification_emails.trending_link') if current_user.can?(:manage_taxonomies)
= ff.input :'notification_emails.status_trends', wrapper: :with_label, label: I18n.t('simple_form.labels.notification_emails.trending_status') if current_user.can?(:manage_taxonomies)
- if SoftwareUpdate.check_enabled? && current_user.can?(:view_devops)
.fields-group
= ff.input :'notification_emails.software_updates',
collection: user_settings_collection('notification_emails.software_updates'),
hint: false,
include_blank: false,
label_method: ->(setting) { I18n.t("simple_form.labels.notification_emails.software_updates.#{setting}") },
label: I18n.t('simple_form.labels.notification_emails.software_updates.label'),
wrapper: :with_label,
required: false
- if SoftwareUpdate.check_enabled? && current_user.can?(:view_devops)
%h2= t 'notifications.administration_emails'
.fields-group
= ff.input :'notification_emails.end_of_support',
wrapper: :with_label,
label: I18n.t('simple_form.labels.notification_emails.end_of_support'),
recommended: true
.fields-group
= ff.input :'notification_emails.software_updates',
collection: user_settings_collection('notification_emails.software_updates'),
hint: false,
include_blank: false,
label_method: ->(setting) { I18n.t("simple_form.labels.notification_emails.software_updates.#{setting}") },
label: I18n.t('simple_form.labels.notification_emails.software_updates.label'),
wrapper: :with_label,
required: false
+1 -1
View File
@@ -1021,7 +1021,7 @@ de:
major: Hauptversion
minor: Nebenversion
patch: Revision — Fehlerkorrekturen und einfach zu implementierende Änderungen
unsupported_since: Seit %{date} nicht mehr unterstützt
unsupported_since: Nicht mehr unterstützt seit %{date}
version: Version
statuses:
account: Autor*in
+12
View File
@@ -1013,6 +1013,7 @@ en:
critical_update: Critical — please update quickly
description: It is recommended to keep your Mastodon installation up to date to benefit from the latest fixes and features. Moreover, it is sometimes critical to update Mastodon in a timely manner to avoid security issues. For these reasons, Mastodon checks for updates every 30 minutes, and will notify you according to your email notification preferences.
documentation_link: Learn more
nearing_eol: Support for the branch you are currently running will stop on %{date}, please consider updating.
release_notes: Release notes
supported_until: Support ends on %{date}
title: Available updates
@@ -1021,6 +1022,7 @@ en:
major: Major release
minor: Minor release
patch: Patch release — bugfixes and easy to apply changes
unsupported_branch: The branch you are currently running is unsupported, please update as soon as possible.
unsupported_since: Unsupported since %{date}
version: Version
statuses:
@@ -1287,6 +1289,15 @@ en:
auto_close_registrations:
body: Due to a lack of recent moderator activity, registrations on %{instance} have been automatically switched to requiring manual review, to prevent %{instance} from being used as a platform for potential bad actors. You can switch it back to open registrations at any time.
subject: Registrations for %{instance} have been automatically switched to requiring approval
end_of_support_out_of_support_warning:
body: The Mastodon version currently in use on your server is not supported anymore. We recommend you to update as soon as possible!
subject: Mastodon %{branch} used on %{instance} is now unsupported!
end_of_support_three_months_warning:
body: The Mastodon version currently in use on your server will stop being supported in 3 months. You may want to update to a newer branch ahead of time.
subject: Support for Mastodon %{branch} used on %{instance} to end in 3 months.
end_of_support_two_weeks_warning:
body: The Mastodon version currently in use on your server will stop being supported in 2 weeks. We recommend you update to a newer branch ahead of time.
subject: Support for Mastodon %{branch} used on %{instance} to end in 2 weeks.
new_appeal:
actions:
delete_statuses: to delete their posts
@@ -1922,6 +1933,7 @@ en:
administration_emails: Admin email notifications
email_events: Events for email notifications
email_events_hint: 'Select events that you want to receive notifications for:'
moderation_emails: Moderation email notifications
number:
human:
decimal_units:
+3
View File
@@ -1014,12 +1014,14 @@ et:
description: Soovitatav on hoida oma Mastodoni paigaldus ajakohasena, et saada kasu viimastest parandustest ja funktsioonidest. Lisaks sellele on mõnikord oluline Mastodoni õigeaegne uuendamine, et vältida turvaprobleeme. Neil põhjustel kontrollib Mastodon uuendusi iga 30 minuti järel ja teavitab vastavalt sinu e-posti teavitamise eelistustele.
documentation_link: Vaata lisa
release_notes: Väljalaskemärkused
supported_until: Tugi lõppeb %{date}
title: Saadaval uuendused
type: Tüüp
types:
major: Suur uuendus
minor: Väike uuendus
patch: Parandusuuendus — veaparandused ja hõlpsalt rakendatavad muudatused
unsupported_since: Alates %{date} pole enam toetatud
version: Versioon
statuses:
account: Autor
@@ -1235,6 +1237,7 @@ et:
other: Kasutatud %{count} kasutaja poolt viimase nädala jooksul
title: Soovitused ja trendid
trending: Trendid
update_available: Uuendus saadaval
username_blocks:
add_new: Lisa uus
block_registrations: Blokeeri registreerimisi
+4
View File
@@ -931,6 +931,10 @@ fa:
authenticated: تنها کاربران تأیید شده
disabled: نیازمند نقش کاربری خاص
public: هرکسی
landing_page:
values:
overview: نمای کلی
trends: پرطرفدار
registrations:
moderation_recommandation: لطفاً قبل از اینکه ثبت نام را برای همه باز کنید، مطمئن شوید که یک تیم نظارتی مناسب و واکنشی دارید!
preamble: کنترل کنید چه کسی می تواند در سرور شما یک حساب ایجاد کند.
+1 -1
View File
@@ -1020,7 +1020,7 @@ fr-CA:
types:
major: Mise à jour majeure
minor: Mise à jour mineure
patch: Mise à jour « patch » — correctifs de bugs et changements faciles à faire
patch: Mise à jour corrective — corrections de bugs et changements faciles à appliquer
unsupported_since: Non supportée depuis le %{date}
version: Version
statuses:
+1 -1
View File
@@ -1020,7 +1020,7 @@ fr:
types:
major: Mise à jour majeure
minor: Mise à jour mineure
patch: Mise à jour « patch » — correctifs de bugs et changements faciles à faire
patch: Mise à jour corrective — corrections de bugs et changements faciles à appliquer
unsupported_since: Non supportée depuis le %{date}
version: Version
statuses:
+2
View File
@@ -1062,12 +1062,14 @@ ga:
description: Moltar do shuiteáil Mastodon a choinneáil cothrom le dáta chun leas a bhaint as na socruithe agus na gnéithe is déanaí. Ina theannta sin, tá sé ríthábhachtach uaireanta Mastodon a nuashonrú go tráthúil chun saincheisteanna slándála a sheachaint. Ar na cúiseanna seo, seiceálann Mastodon nuashonruithe gach 30 nóiméad, agus tabharfaidh sé fógra duit de réir do shainroghanna fógra ríomhphoist.
documentation_link: Foghlaim níos mó
release_notes: Nótaí scaoilte
supported_until: Críochnaíonn an tacaíocht ar %{date}
title: Nuashonruithe ar fáil
type: Cineál
types:
major: Mórscaoileadh
minor: Mionscaoileadh
patch: Scaoileadh paiste - ceartúcháin agus athruithe atá éasca a chur i bhfeidhm
unsupported_since: Gan tacaíocht ó %{date}
version: Leagan
statuses:
account: Údar
+2
View File
@@ -1014,12 +1014,14 @@ it:
description: Si consiglia di mantenere aggiornata l'installazione di Mastodon per beneficiare delle ultime correzioni e funzionalità. Inoltre, a volte è fondamentale aggiornare Mastodon in modo tempestivo per evitare problemi di sicurezza. Per queste ragioni, Mastodon verifica la presenza di aggiornamenti ogni 30 minuti e ti avviserà in base alle tue preferenze di notifica e-mail.
documentation_link: Scopri di più
release_notes: Note di rilascio
supported_until: Il supporto termina il %{date}
title: Aggiornamenti disponibili
type: Tipo
types:
major: Rilascio principale
minor: Rilascio secondario
patch: 'Patch: correzioni di bug e modifiche facili da applicare'
unsupported_since: Non più supportato dal %{date}
version: Versione
statuses:
account: Autore
+1
View File
@@ -345,6 +345,7 @@ en:
notification_emails:
appeal: Someone appeals a moderator decision
digest: Send digest e-mails
end_of_support: The current Mastodon version is nearing end of support
favourite: Someone favourited your post
follow: Someone followed you
follow_request: Someone requested to follow you
+2
View File
@@ -1014,12 +1014,14 @@ tr:
description: Son düzeltme ve özelliklerden yararlanmak için Mastodon kurulumunu güncel tutmanızı öneriyoruz. Üstelik güvenlik sorunlarından kaçınmak için Mastodon'u zamanında güncellemek kritiktir. Bu nedenlerle Mastodon her 30 dakikada bir güncellemeleri denetler ve e-posta bildirim seçeneğinize göre size haber verir.
documentation_link: Daha fazlası
release_notes: Sürüm notları
supported_until: Destek %{date} tarihinde bitiyor
title: Mevcut güncellemeler
type: Tür
types:
major: Ana sürüm
minor: Alt sürüm
patch: Yama sürümü — hata düzeltmeleri ve uygulaması kolay değişiklikler
unsupported_since: "%{date} tarihinden beri desteklenmiyor"
version: Sürüm
statuses:
account: Yazar
+1 -1
View File
@@ -11,7 +11,7 @@ SimpleNavigation::Configuration.run do |navigation|
SoftwareUpdate.urgent_pending? ? [material_symbol('report'), t('admin.critical_update_pending')] : [material_symbol('system_update_alt'), t('admin.update_available')]
),
admin_software_updates_path,
html: { class: SoftwareUpdate.urgent_pending? ? 'warning' : nil },
html: { class: SoftwareUpdate.urgent_pending? || SoftwareDeprecation.current&.unsupported? ? 'warning' : nil },
if: -> { Rails.configuration.x.mastodon.software_update_url.present? && current_user.can?(:view_devops) && SoftwareUpdate.pending? }
n.item :profile, safe_join([material_symbol('person'), t('settings.profile')]), settings_profile_path, if: -> { current_user.functional? && !self_destruct }, highlights_on: %r{/settings/profile|/settings/featured_tags|/settings/verification}
@@ -0,0 +1,15 @@
# frozen_string_literal: true
class CreateSoftwareDeprecations < ActiveRecord::Migration[8.1]
def change
create_table :software_deprecations do |t|
t.string :branch, null: false
t.date :end_of_support, null: false
t.integer :warning_issued, null: false
t.timestamps
end
add_index :software_deprecations, :branch, unique: true
end
end
+10 -1
View File
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema[8.1].define(version: 2026_07_06_122112) do
ActiveRecord::Schema[8.1].define(version: 2026_07_06_143100) do
# These are extensions that must be enabled in order to support this database
enable_extension "pg_catalog.plpgsql"
@@ -1157,6 +1157,15 @@ ActiveRecord::Schema[8.1].define(version: 2026_07_06_122112) do
t.index ["var"], name: "index_site_uploads_on_var", unique: true
end
create_table "software_deprecations", force: :cascade do |t|
t.string "branch", null: false
t.datetime "created_at", null: false
t.date "end_of_support", null: false
t.datetime "updated_at", null: false
t.integer "warning_issued", null: false
t.index ["branch"], name: "index_software_deprecations_on_branch", unique: true
end
create_table "software_updates", force: :cascade do |t|
t.datetime "created_at", null: false
t.date "end_of_support"
+26 -9
View File
@@ -27,9 +27,9 @@ RSpec.describe Request do
end
describe '#on_behalf_of' do
it 'when used, adds signature header' do
it 'when used, sets signing keypair' do
subject.on_behalf_of(Fabricate(:account))
expect(subject.headers['Signature']).to be_present
expect(subject.signing_keypair).to be_present
end
end
@@ -110,14 +110,12 @@ RSpec.describe Request do
expect { |block| subject.on_behalf_of(account).perform(&block) }.to yield_control
# request.headers includes the `Signature` sent for the first request
expect(a_request(:get, 'http://example.com').with(headers: subject.headers)).to have_been_made.once
expect(a_request(:get, 'http://example.com').with(headers: subject.headers.merge('Signature' => /.*/))).to have_been_made.once
expect(a_request(:get, 'http://example.com').with { |request| verified_signed_mocked_request?(request, account.keypair) }).to have_been_made.once
# request.headers includes the `Signature`, but it has changed
expect(a_request(:get, 'http://redirected.example.com/foo').with(headers: subject.headers.merge({ 'Host' => 'redirected.example.com' }))).to_not have_been_made
# `with(headers: )` matching tests for inclusion, so strip `Signature`
# This doesn't actually test that there is a signature, but it tests that the original signature is not passed
expect(a_request(:get, 'http://redirected.example.com/foo').with(headers: subject.headers.without('Signature').merge({ 'Host' => 'redirected.example.com' }))).to have_been_made.once
# This doesn't actually test that the signature has changed, but I verified this manually
expect(a_request(:get, 'http://redirected.example.com/foo').with(headers: subject.headers.merge({ 'Host' => 'redirected.example.com', 'Signature' => /.*/ }))).to have_been_made.once
expect(a_request(:get, 'http://redirected.example.com/foo').with { |request| verified_signed_mocked_request?(request, account.keypair) }).to have_been_made.once
end
end
@@ -225,4 +223,23 @@ RSpec.describe Request do
expect(subject.perform { |response| response.body_with_limit.encoding }).to eq Encoding::UTF_8
end
end
def verified_signed_mocked_request?(webmock_request, keypair)
# Webmock requests are rather barebones and our signature verification
# code works with `ActionDispatch::Request` objects.
# This method builds a test request from the webmock request first,
# but this currently does not cover requests with bodies.
# A better way would probably be to build a whole Rack env, but
# that code was a lot more straightforward, and sufficient for
# the added test.
request = ActionDispatch::TestRequest.create
request.request_uri = webmock_request.uri
request.path = webmock_request.uri.path
request.request_method = webmock_request.method
request.headers.merge!(webmock_request.headers)
SignedRequest.new(request).verified?(keypair)
end
end
@@ -66,10 +66,12 @@ RSpec.describe SoftwareUpdateCheckService do
end
context 'when the server returns new versions' do
let(:deprecation_date) { nil }
let(:server_json) do
{
currentVersion: {
endOfSupport: nil,
endOfSupport: deprecation_date&.iso8601,
},
updatesAvailable: [
{
@@ -104,6 +106,91 @@ RSpec.describe SoftwareUpdateCheckService do
expect { subject.call }.to change { SoftwareUpdate.pluck(:version).sort }.from(['3.5.0', '42.13.12', 'Malformed']).to(['4.2.1', '4.3.0', '5.0.0'])
end
context 'when server returns deprecation in the distant future' do
let(:deprecation_date) { 5.years.from_now.to_date }
it 'updates the software deprecation info' do
expect { subject.call }
.to change { SoftwareDeprecation.pluck(:end_of_support, :warning_issued) }.from([]).to([[deprecation_date, 'none']])
end
context 'when an irrelevant deprecation was stored' do
before do
SoftwareDeprecation.create!(branch: '4.3', end_of_support: '2026-05-06'.to_date, warning_issued: :out_of_support_warning)
end
it 'updates the software deprecation info' do
expect { subject.call }
.to change { SoftwareDeprecation.pluck(:end_of_support, :warning_issued) }.from([['2026-05-06'.to_date, 'out_of_support_warning']]).to([[deprecation_date, 'none']])
end
end
end
context 'when server returns deprecation in 2 months' do
let(:deprecation_date) { 2.months.from_now.to_date }
it 'updates the software deprecation info' do
expect { subject.call }
.to change { SoftwareDeprecation.pluck(:end_of_support, :warning_issued) }.from([]).to([[deprecation_date, 'three_months_warning']])
end
context 'when an irrelevant deprecation was stored' do
before do
SoftwareDeprecation.create!(branch: '4.3', end_of_support: '2026-05-06'.to_date, warning_issued: :out_of_support_warning)
end
it 'updates the software deprecation info and sends email' do
expect { subject.call }
.to change { SoftwareDeprecation.pluck(:end_of_support, :warning_issued) }.from([['2026-05-06'.to_date, 'out_of_support_warning']]).to([[deprecation_date, 'three_months_warning']])
.and(have_enqueued_mail(AdminMailer, :end_of_support_three_months_warning).with(hash_including(params: { recipient: owner_user.account })).once)
end
end
end
context 'when server returns deprecation in 1 week' do
let(:deprecation_date) { 1.week.from_now.to_date }
it 'updates the software deprecation info' do
expect { subject.call }
.to change { SoftwareDeprecation.pluck(:end_of_support, :warning_issued) }.from([]).to([[deprecation_date, 'two_weeks_warning']])
.and(have_enqueued_mail(AdminMailer, :end_of_support_two_weeks_warning).with(hash_including(params: { recipient: owner_user.account })).once)
end
context 'when an irrelevant deprecation was stored' do
before do
SoftwareDeprecation.create!(branch: '4.3', end_of_support: '2026-05-06'.to_date, warning_issued: :out_of_support_warning)
end
it 'updates the software deprecation info and sends email' do
expect { subject.call }
.to change { SoftwareDeprecation.pluck(:end_of_support, :warning_issued) }.from([['2026-05-06'.to_date, 'out_of_support_warning']]).to([[deprecation_date, 'two_weeks_warning']])
.and(have_enqueued_mail(AdminMailer, :end_of_support_two_weeks_warning).with(hash_including(params: { recipient: owner_user.account })).once)
end
end
end
context 'when server returns deprecation in the past' do
let(:deprecation_date) { 1.week.ago.to_date }
it 'updates the software deprecation info' do
expect { subject.call }
.to change { SoftwareDeprecation.pluck(:end_of_support, :warning_issued) }.from([]).to([[deprecation_date, 'out_of_support_warning']])
.and(have_enqueued_mail(AdminMailer, :end_of_support_out_of_support_warning).with(hash_including(params: { recipient: owner_user.account })).once)
end
context 'when an irrelevant deprecation was stored' do
before do
SoftwareDeprecation.create!(branch: '4.3', end_of_support: '2026-05-06'.to_date, warning_issued: :out_of_support_warning)
end
it 'updates the software deprecation info and sends email' do
expect { subject.call }
.to change { SoftwareDeprecation.pluck(:end_of_support, :warning_issued) }.from([['2026-05-06'.to_date, 'out_of_support_warning']]).to([[deprecation_date, 'out_of_support_warning']])
.and(have_enqueued_mail(AdminMailer, :end_of_support_out_of_support_warning).with(hash_including(params: { recipient: owner_user.account })).once)
end
end
end
context 'when no update is urgent' do
it 'sends e-mail notifications according to settings', :aggregate_failures do
expect { subject.call }.to have_enqueued_mail(AdminMailer, :new_software_updates)