From 6dd6f534deb3344e526ebba5a33df4be0059e9f1 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 31 Jul 2026 09:46:28 +0200 Subject: [PATCH 1/4] Update dependency jsdom to v30 (#39966) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- streaming/package.json | 2 +- yarn.lock | 122 ++++++++++++++++++++--------------------- 2 files changed, 60 insertions(+), 64 deletions(-) diff --git a/streaming/package.json b/streaming/package.json index be9a55e478..9ecd0dd1b0 100644 --- a/streaming/package.json +++ b/streaming/package.json @@ -21,7 +21,7 @@ "dotenv": "^17.0.0", "express": "^5.1.0", "ioredis": "^5.3.2", - "jsdom": "^29.0.0", + "jsdom": "^30.0.0", "pg": "^8.5.0", "pg-connection-string": "^2.6.0", "pino": "^10.0.0", diff --git a/yarn.lock b/yarn.lock index eda8c8d9e7..7f31aaec50 100644 --- a/yarn.lock +++ b/yarn.lock @@ -26,43 +26,28 @@ __metadata: languageName: node linkType: hard -"@asamuzakjp/css-color@npm:^5.1.11": - version: 5.1.11 - resolution: "@asamuzakjp/css-color@npm:5.1.11" +"@asamuzakjp/css-color@npm:^6.0.5": + version: 6.0.5 + resolution: "@asamuzakjp/css-color@npm:6.0.5" dependencies: - "@asamuzakjp/generational-cache": "npm:^1.0.1" - "@csstools/css-calc": "npm:^3.2.0" - "@csstools/css-color-parser": "npm:^4.1.0" + "@csstools/css-calc": "npm:^3.2.1" + "@csstools/css-color-parser": "npm:^4.1.9" "@csstools/css-parser-algorithms": "npm:^4.0.0" "@csstools/css-tokenizer": "npm:^4.0.0" - checksum: 10c0/32720bdff8daea6a8847aba6cdfae55baa3b4a2690b51d21db7f0382bbd183f3d9f2d5126df50afd889062635684b2819e47113629ee2e80c99389e75f48d060 + lru-cache: "npm:^11.5.2" + checksum: 10c0/c08cc6bcea92c5e04fac208fbdbd125ed89e0eeca258df48819878347c75f90c3eb3a52940049fcb580ac9afe83c1d6bbf4e4caee0f8c2655cf47286f6ce3f09 languageName: node linkType: hard -"@asamuzakjp/dom-selector@npm:^7.1.1": - version: 7.1.1 - resolution: "@asamuzakjp/dom-selector@npm:7.1.1" +"@asamuzakjp/dom-selector@npm:^8.3.0": + version: 8.3.0 + resolution: "@asamuzakjp/dom-selector@npm:8.3.0" dependencies: - "@asamuzakjp/generational-cache": "npm:^1.0.1" - "@asamuzakjp/nwsapi": "npm:^2.3.9" bidi-js: "npm:^1.0.3" css-tree: "npm:^3.2.1" is-potential-custom-element-name: "npm:^1.0.1" - checksum: 10c0/8cec1c618781c94de5836a215bbe5aafb4d8b835b18c51faf8547f4574afa39f92def3951e40123860062467613dd825f1e1600ff32e8045cc099a91796dcfb8 - languageName: node - linkType: hard - -"@asamuzakjp/generational-cache@npm:^1.0.1": - version: 1.0.1 - resolution: "@asamuzakjp/generational-cache@npm:1.0.1" - checksum: 10c0/1de62de43764e13fca3b9a31b7ea9b1bf0780fe053d266e40378a19ff8c66b543e011e6a0df02d410cd59bf981126706f176cdbb938985165202c4a079fe1057 - languageName: node - linkType: hard - -"@asamuzakjp/nwsapi@npm:^2.3.9": - version: 2.3.9 - resolution: "@asamuzakjp/nwsapi@npm:2.3.9" - checksum: 10c0/869b81382e775499c96c45c6dbe0d0766a6da04bcf0abb79f5333535c4e19946851acaa43398f896e2ecc5a1de9cf3db7cf8c4b1afac1ee3d15e21584546d74d + lru-cache: "npm:^11.5.2" + checksum: 10c0/3f541cb7dd4ab1c6762802c0c908487ddbf5a2434b3ddf91b145c84272f0110fa6b02fc9baf879aa5bc3c2968dc702fdbaadfa3b58ee5f42645cb0e2949cbbf6 languageName: node linkType: hard @@ -1267,7 +1252,7 @@ __metadata: languageName: node linkType: hard -"@csstools/css-color-parser@npm:^4.1.0, @csstools/css-color-parser@npm:^4.1.9": +"@csstools/css-color-parser@npm:^4.1.9": version: 4.1.9 resolution: "@csstools/css-color-parser@npm:4.1.9" dependencies: @@ -1289,15 +1274,15 @@ __metadata: languageName: node linkType: hard -"@csstools/css-syntax-patches-for-csstree@npm:^1.1.3": - version: 1.1.3 - resolution: "@csstools/css-syntax-patches-for-csstree@npm:1.1.3" +"@csstools/css-syntax-patches-for-csstree@npm:^1.1.3, @csstools/css-syntax-patches-for-csstree@npm:^1.1.7": + version: 1.1.7 + resolution: "@csstools/css-syntax-patches-for-csstree@npm:1.1.7" peerDependencies: css-tree: ^3.2.1 peerDependenciesMeta: css-tree: optional: true - checksum: 10c0/3b8a686710a46bb460f9d560d52ce0de315828e6d452002b692013e95fbf53669d7a71e28c9b6b1333fa9f37f058fad93e5db3b8516444907713cb9aad299ce1 + checksum: 10c0/cdebc36196f951f4436132f5346927c8aeff2917a1c2af42ad36eb87a2b1883c8cd21cb6b3105e951ae0fa964d2ebda6309bae476d232d27f0ec657199df6bb6 languageName: node linkType: hard @@ -2461,15 +2446,15 @@ __metadata: languageName: node linkType: hard -"@exodus/bytes@npm:^1.11.0, @exodus/bytes@npm:^1.15.0, @exodus/bytes@npm:^1.6.0": - version: 1.15.0 - resolution: "@exodus/bytes@npm:1.15.0" +"@exodus/bytes@npm:^1.11.0, @exodus/bytes@npm:^1.15.1, @exodus/bytes@npm:^1.6.0": + version: 1.15.1 + resolution: "@exodus/bytes@npm:1.15.1" peerDependencies: "@noble/hashes": ^1.8.0 || ^2.0.0 peerDependenciesMeta: "@noble/hashes": optional: true - checksum: 10c0/b48aad9729653385d6ed055c28cfcf0b1b1481cf5d83f4375c12abd7988f1d20f69c80b5f95d4a1cc24d9abe32b9efc352a812d53884c26efea172aca8b6356d + checksum: 10c0/333056a6953bbf875d9f3b86c32314de29458d842e5f56f6ef8034b18c2d9660184550093d1bae5de0064043d5e23f54cc03148798d9d29cf5167ac03f2e9f8c languageName: node linkType: hard @@ -3132,7 +3117,7 @@ __metadata: express: "npm:^5.1.0" globals: "npm:^17.3.0" ioredis: "npm:^5.3.2" - jsdom: "npm:^29.0.0" + jsdom: "npm:^30.0.0" pg: "npm:^8.5.0" pg-connection-string: "npm:^2.6.0" pino: "npm:^10.0.0" @@ -9438,37 +9423,37 @@ __metadata: languageName: node linkType: hard -"jsdom@npm:^29.0.0": - version: 29.1.1 - resolution: "jsdom@npm:29.1.1" +"jsdom@npm:^30.0.0": + version: 30.0.1 + resolution: "jsdom@npm:30.0.1" dependencies: - "@asamuzakjp/css-color": "npm:^5.1.11" - "@asamuzakjp/dom-selector": "npm:^7.1.1" + "@asamuzakjp/css-color": "npm:^6.0.5" + "@asamuzakjp/dom-selector": "npm:^8.3.0" "@bramus/specificity": "npm:^2.4.2" - "@csstools/css-syntax-patches-for-csstree": "npm:^1.1.3" - "@exodus/bytes": "npm:^1.15.0" + "@csstools/css-syntax-patches-for-csstree": "npm:^1.1.7" + "@exodus/bytes": "npm:^1.15.1" css-tree: "npm:^3.2.1" data-urls: "npm:^7.0.0" decimal.js: "npm:^10.6.0" html-encoding-sniffer: "npm:^6.0.0" is-potential-custom-element-name: "npm:^1.0.1" - lru-cache: "npm:^11.3.5" + lru-cache: "npm:^11.5.2" parse5: "npm:^8.0.1" saxes: "npm:^6.0.0" symbol-tree: "npm:^3.2.4" - tough-cookie: "npm:^6.0.1" - undici: "npm:^7.25.0" + tough-cookie: "npm:^6.0.2" + undici: "npm:^8.9.0" w3c-xmlserializer: "npm:^5.0.0" webidl-conversions: "npm:^8.0.1" whatwg-mimetype: "npm:^5.0.0" - whatwg-url: "npm:^16.0.1" + whatwg-url: "npm:^17.1.0" xml-name-validator: "npm:^5.0.0" peerDependencies: - canvas: ^3.0.0 + canvas: ^3.2.3 peerDependenciesMeta: canvas: optional: true - checksum: 10c0/20e2174b09d9d06393cb48e1392b7a1cb7191d6656a6f7b3b8fbf9853b4ab0ef60b4a42c2c55f71b55ca5da50ffa75bcdc6986210963182e7993c6f9cd4f499b + checksum: 10c0/2e3c04c30da46f373259b33ffb1a7786d351370aada3bfa3d7766dc97956659727dc78f49e01813b313e873d32851c842dc319b89d099f9e9decb55339dca155 languageName: node linkType: hard @@ -9937,10 +9922,10 @@ __metadata: languageName: node linkType: hard -"lru-cache@npm:^11.0.0, lru-cache@npm:^11.3.5": - version: 11.3.5 - resolution: "lru-cache@npm:11.3.5" - checksum: 10c0/5b54ef7b88afb4bd25b7a778f1b2b1cde32d9770913e530da34ab203cf0442413bcaa6e372800cbab9562557a4480e4d8bf32e3a368bb5a91b12218eca085c66 +"lru-cache@npm:^11.0.0, lru-cache@npm:^11.5.2": + version: 11.5.2 + resolution: "lru-cache@npm:11.5.2" + checksum: 10c0/ece1ad731f5b655e85d67047d04bfc13823dc77aa61c5454924a9869ba600a0104e39cc33d726021feef812bc347ca34a5608a5eb1972a5dd0870b7ecd42c3f2 languageName: node linkType: hard @@ -13966,12 +13951,12 @@ __metadata: languageName: node linkType: hard -"tough-cookie@npm:^6.0.0, tough-cookie@npm:^6.0.1": - version: 6.0.1 - resolution: "tough-cookie@npm:6.0.1" +"tough-cookie@npm:^6.0.0, tough-cookie@npm:^6.0.2": + version: 6.0.2 + resolution: "tough-cookie@npm:6.0.2" dependencies: tldts: "npm:^7.0.5" - checksum: 10c0/ec70bd6b1215efe4ed31a158f0be3e4c9088fcbd8620edc23a5860d4f3d85c757b77e274baaa700f7b25e409f4181552ed189603c2b2e1a9f88104da3a61a37d + checksum: 10c0/5ff521a476a3c540821352125a5d481c8d2fe16035de7e0efda4df120f290c95500a0e9b51ea0aa56343955be482e014c30f5ba73e04b93ba138e4e855cb9e89 languageName: node linkType: hard @@ -14269,10 +14254,10 @@ __metadata: languageName: node linkType: hard -"undici@npm:^7.25.0": - version: 7.25.0 - resolution: "undici@npm:7.25.0" - checksum: 10c0/02a0b45dc14eb91bc488948750232450fe52f27a6b08086d6ac6736bb47908d600fe3a96d346f12eab24729c782e5c2f693bc8e8eca6696d4e4c09b1ed4cb4ec +"undici@npm:^8.9.0": + version: 8.9.0 + resolution: "undici@npm:8.9.0" + checksum: 10c0/e3d9fa35a9aa8360d9f56e66bd372f451ee053e25066a97fd9fab3816267035660f67870c6d709a58a5411551657af78c4475be5b31c113b04f70251309900d0 languageName: node linkType: hard @@ -14797,7 +14782,7 @@ __metadata: languageName: node linkType: hard -"whatwg-url@npm:^16.0.0, whatwg-url@npm:^16.0.1": +"whatwg-url@npm:^16.0.0": version: 16.0.1 resolution: "whatwg-url@npm:16.0.1" dependencies: @@ -14808,6 +14793,17 @@ __metadata: languageName: node linkType: hard +"whatwg-url@npm:^17.1.0": + version: 17.1.0 + resolution: "whatwg-url@npm:17.1.0" + dependencies: + "@exodus/bytes": "npm:^1.15.1" + tr46: "npm:^6.0.0" + webidl-conversions: "npm:^8.0.1" + checksum: 10c0/08fe809e90e1d20f6de631c9cdf312623fe5526731dc176ad38967c7d0f34e6e9700cbc0bad5ecd3d5ea8c62737a487883948e85937432f3a598746d8e05e80e + languageName: node + linkType: hard + "whatwg-url@npm:^5.0.0": version: 5.0.0 resolution: "whatwg-url@npm:5.0.0" From d264425975b4074d31e3abddbc8177ff6b9d5885 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 31 Jul 2026 07:47:06 +0000 Subject: [PATCH 2/4] Update Yarn to v4.18.0 (#39989) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- package.json | 2 +- streaming/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 921b2ea6d4..3cbca6116f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@mastodon/mastodon", "license": "AGPL-3.0-or-later", - "packageManager": "yarn@4.17.1", + "packageManager": "yarn@4.18.0", "engines": { "node": ">=22" }, diff --git a/streaming/package.json b/streaming/package.json index 9ecd0dd1b0..8909e0462a 100644 --- a/streaming/package.json +++ b/streaming/package.json @@ -1,7 +1,7 @@ { "name": "@mastodon/streaming", "license": "AGPL-3.0-or-later", - "packageManager": "yarn@4.17.1", + "packageManager": "yarn@4.18.0", "engines": { "node": ">=22" }, From 1ea3bbcce88b6214360110e31d5fd12ececec61e Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 31 Jul 2026 11:14:06 +0200 Subject: [PATCH 3/4] New Crowdin Translations (automated) (#40007) Co-authored-by: GitHub Actions --- app/javascript/mastodon/locales/de.json | 8 +-- app/javascript/mastodon/locales/lt.json | 89 +++++++++++++++++-------- config/locales/lt.yml | 4 +- config/locales/simple_form.lt.yml | 2 +- 4 files changed, 71 insertions(+), 32 deletions(-) diff --git a/app/javascript/mastodon/locales/de.json b/app/javascript/mastodon/locales/de.json index bec3c2a4d7..c3dc7d74bb 100644 --- a/app/javascript/mastodon/locales/de.json +++ b/app/javascript/mastodon/locales/de.json @@ -114,7 +114,7 @@ "account.name.copy": "Adresse kopieren", "account.name.help.domain": "{domain} ist der Server, auf dem dieser Profilname registriert ist und dessen Inhalte sich befinden.", "account.name.help.domain_self": "{domain} ist der Server, auf dem du registriert bist und deine Beiträge verwaltet werden.", - "account.name.help.footer": "So wie du E-Mails an andere trotz unterschiedlicher E-Mail-Provider senden kannst, so kannst du auch mit anderen Profilen auf unterschiedlichen Mastodon Servern interagieren – das funktioniert auch bei allen Fediverse Apps.", + "account.name.help.footer": "So wie du E-Mails an andere trotz unterschiedlicher E-Mail-Provider senden kannst, so kannst du auch mit anderen Profilen auf unterschiedlichen Mastodon-Servern interagieren – das funktioniert auch bei allen Fediverse-Apps!", "account.name.help.header": "Die Fediverse-Adresse ähnelt einer E-Mail-Adresse", "account.name.help.username": "{username} ist ein einmaliger Profilname auf diesem Server. Es ist möglich, dass jemand auf einem anderen Server den gleichen Profilnamen hat.", "account.name.help.username_self": "{username} ist dein Profilname auf diesem Server. Es ist möglich, dass jemand auf einem anderen Server den gleichen Profilnamen hat.", @@ -242,8 +242,8 @@ "account_edit.upload_modal.title_add.header": "Titelbild hinzufügen", "account_edit.upload_modal.title_replace.avatar": "Profilbild ersetzen", "account_edit.upload_modal.title_replace.header": "Titelbild ersetzen", - "account_edit.verified_modal.details": "Beweise die Echtheit deines Mastodon Profils, indem du verifizierte Links zu deinen persönlichen Websites ergänzt. So funktioniert’s:", - "account_edit.verified_modal.invisible_link.details": "Füge den Link zu deiner Kopfzeile hinzu. Der wichtige Teil ist rel=\"me\", was Identitätsdiebstahl auf Websites mit nutzergenerierten Inhalten verhindert. Du kannst sogar ein Link-Tag im Header der Seite anstelle von {tag} verwenden, aber das HTML muss ohne die Ausführung von JavaScript zugänglich sein.", + "account_edit.verified_modal.details": "Beweise die Echtheit deines Mastodon-Profils, indem du verifizierte Links zu deinen persönlichen Websites ergänzt. So funktioniert’s:", + "account_edit.verified_modal.invisible_link.details": "Füge den Link in den Header ein. Der wichtige Teil ist rel=\"me\". Du kannst auch den Tag link im Header (statt {tag}) verwenden, jedoch muss die Internetseite ohne JavaScript abrufbar sein.", "account_edit.verified_modal.invisible_link.summary": "Wie blende ich den Link aus?", "account_edit.verified_modal.step1.header": "Kopiere den unten stehenden HTML-Code und füge ihn in den Header deiner Website ein", "account_edit.verified_modal.step2.details": "Wenn du deine Website bereits in ein Zusatzfeld eingetragen hast, musst du es noch einmal löschen und sie neu hinzufügen, damit die Verifizierung startet.", @@ -393,7 +393,7 @@ "collections.create_collection": "Sammlung erstellen", "collections.delete_collection": "Sammlung löschen", "collections.description_length_hint": "Maximal 100 Zeichen", - "collections.detail.author_added_you_on_date": "{author} Fügte dich am {date} hinzu", + "collections.detail.author_added_you_on_date": "{author} fügte dich am {date} hinzu", "collections.detail.loading": "Sammlung wird geladen …", "collections.detail.revoke_inclusion": "Mich entfernen", "collections.detail.sensitive_content": "Inhaltswarnung", diff --git a/app/javascript/mastodon/locales/lt.json b/app/javascript/mastodon/locales/lt.json index 1bb65329ef..5a266216e6 100644 --- a/app/javascript/mastodon/locales/lt.json +++ b/app/javascript/mastodon/locales/lt.json @@ -69,6 +69,9 @@ "account.hide_reblogs": "Slėpti pasidalinimus iš @{name}", "account.in_memoriam": "Atminimui.", "account.join_modal.day": "Diena", + "account.join_modal.share.celebrate": "Bendrinti kolaboracinį įrašą", + "account.join_modal.share.intro": "Pasidalinkite įvadiniu įrašu", + "account.join_modal.share.welcome": "Pasidalinkite sveikinimo įrašu", "account.joined_short": "Prisijungė", "account.languages": "Keisti prenumeruojamas kalbas", "account.link_verified_on": "Šios nuorodos nuosavybė buvo patikrinta {date}", @@ -82,6 +85,7 @@ "account.menu.copy": "Kopijuoti nuorodą", "account.menu.note.description": "Matoma tik jums", "account.menu.report": "Pranešti apie paskyrą", + "account.menu.share": "Bendrinti…", "account.menu.unblock": "Atblokuoti paskyrą", "account.menu.unblock_domain": "Atblokuoti {domain}", "account.moved_to": "{name} nurodė, kad dabar jų nauja paskyra yra:", @@ -210,16 +214,19 @@ "annual_report.summary.new_posts.new_posts": "nauji įrašai", "annual_report.summary.percentile.text": "Tai reiškia, kad esate tarppopuliariausių {domain} naudotojų.", "annual_report.summary.percentile.we_wont_tell_bernie": "Mes nesakysime Bernie.", + "annual_report.summary.share_elsewhere": "Bendrinti kitur", "annual_report.summary.share_message": "Aš gavau „{archetype}“!", + "annual_report.summary.share_on_mastodon": "Skelbti platformoje „Mastodon“", "attachments_list.unprocessed": "(neapdorotas)", "audio.hide": "Slėpti garsą", "block_modal.remote_users_caveat": "Paprašysime serverio {domain} gerbti tavo sprendimą. Tačiau atitiktis negarantuojama, nes kai kurie serveriai gali skirtingai tvarkyti blokavimus. Vieši įrašai vis tiek gali būti matomi neprisijungusiems naudotojams.", "block_modal.show_less": "Rodyti mažiau", "block_modal.show_more": "Rodyti daugiau", + "block_modal.they_cant_mention": "Jūs negalite vienas kito paminėti, sekti ar dalintis įrašais.", "block_modal.they_will_know": "Jie gali matyti, kad yra užblokuoti.", "block_modal.title": "Blokuoti naudotoją?", "boost_modal.combo": "Galima paspausti {combo}, kad praleisti tai kitą kartą", - "boost_modal.reblog": "Pasidalinti įrašą?", + "boost_modal.reblog": "Dalintis įrašu?", "boost_modal.undo_reblog": "Nebepasidalinti įrašo?", "bundle_column_error.copy_stacktrace": "Kopijuoti klaidos ataskaitą", "bundle_column_error.error.body": "Paprašytos puslapio nepavyko atvaizduoti. Tai gali būti dėl mūsų kodo klaidos arba naršyklės suderinamumo problemos.", @@ -242,16 +249,45 @@ "closed_registrations_modal.find_another_server": "Rasti kitą serverį", "closed_registrations_modal.preamble": "„Mastodon“ yra decentralizuotas, todėl nesvarbu, kur susikursi paskyrą, galėsi sekti ir bendrauti su bet kuriuo šiame serveryje esančiu asmeniu. Jį gali net savarankiškai talpinti!", "closed_registrations_modal.title": "Užsiregistruoti platformoje „Mastodon“", + "collection.share_modal.share_link_label": "Bendrinti nuorodą", + "collection.share_modal.share_via_post": "Skelbti platformoje „Mastodon“", + "collection.share_modal.share_via_system": "Bendrinti į...", + "collection.share_modal.title": "Bendrinti kolekciją", + "collection.share_modal.title_new": "Bendrinti savo naują kolekciją!", + "collection.share_template_other": "Pažvelkite į šią nuostabią kolekciją:", + "collection.share_template_own": "Pažvelkite į mano naują kolekciją:", + "collections.create.steps": "Žingsnis {step}/{total}", + "collections.create_collection": "Sukurti kolekciją", + "collections.delete_collection": "Ištrinti kolekciją", "collections.description_length_hint": "100 simbolių limitas", + "collections.detail.author_added_you_on_date": "{author} pridėjo tave {date}", + "collections.detail.loading": "Įkeliama kolekcija…", + "collections.detail.revoke_inclusion": "Pašalinti mane", + "collections.detail.sensitive_content": "Jautrus turinys", + "collections.detail.sensitive_note": "Aprašymas ir paskyros gali būti netinkami visiems lankytojams.", + "collections.detail.share": "Bendrinkite šią kolekciją", + "collections.detail.you_are_in_this_collection": "Esate įtrauktas į šią kolekciją", + "collections.edit_details": "Keisti detales", + "collections.error_loading_collections": "Bandant įkelti šias kolekcijas įvyko klaida.", + "collections.hidden_accounts_description": "Jūs užblokavote arba nutildėte {count, plural, one {šią paskyrą} few {šias paskyras} many {paskyrų} other {šias paskyras}}", + "collections.hints.accounts_counter": "{count}/{max} paskyrų", + "collections.last_updated_at": "Paskutinį kartą atnaujinta: {date}", + "collections.list.collections_with_count": "{count, plural, one {# Kolekcija} few {# Kolekcijos} many {# Kolekcijų} other {# Kolekcijos}}", + "collections.list.created_by_author": "Sukūrė {name}", + "collections.list.created_by_you": "Sukūrėte jūs", + "collections.list.featuring_you": "Jūs įtraukti", + "collections.manage_accounts": "Tvarkyti paskyras", + "collections.mark_as_sensitive": "Pažymėti kaip jautrią informaciją", "collections.name_length_hint": "40 simbolių limitas", "collections.search_accounts_label": "Ieškokite paskyros, kurią norite pridėti", + "collections.share_short": "Bendrinti", "collections.topic_special_chars_hint": "Išsaugant bus pašalinti specialieji simboliai", "column.about": "Apie", "column.blocks": "Užblokuoti naudotojai", "column.bookmarks": "Žymės", "column.community": "Vietinė laiko skalė", "column.create_list": "Kurti sąrašą", - "column.direct": "Paminėjimai", + "column.direct": "Žinutės", "column.directory": "Naršyti profilius", "column.domain_blocks": "Užblokuoti serveriai", "column.edit_list": "Redaguoti sąrašą", @@ -341,7 +377,7 @@ "confirmations.quiet_post_quote_info.dismiss": "Daugiau man nepriminti", "confirmations.quiet_post_quote_info.got_it": "Supratau", "confirmations.quiet_post_quote_info.message": "Kai norite komentuoti užtildytą viešą įrašą, jūsų įrašas bus paslėptas „Populiaru“ sąrašuose.", - "confirmations.quiet_post_quote_info.title": "Kai paminite tylius viešus įrašus", + "confirmations.quiet_post_quote_info.title": "Kai cituojate nutildytus viešus įrašus", "confirmations.redraft.confirm": "Ištrinti ir iš naujo parengti", "confirmations.redraft.message": "Ar tikrai nori ištrinti šį įrašą ir parengti jį iš naujo? Bus prarasti mėgstami ir pasidalinimai, o atsakymai į originalų įrašą bus panaikinti.", "confirmations.redraft.title": "Ištrinti ir iš naujo parengti įrašą?", @@ -520,8 +556,8 @@ "hints.profiles.see_more_followers": "Žiūrėti daugiau sekėjų serveryje {domain}", "hints.profiles.see_more_follows": "Žiūrėti daugiau sekimų serveryje {domain}", "hints.profiles.see_more_posts": "Žiūrėti daugiau įrašų serveryje {domain}", - "home.column_settings.show_quotes": "Rodyti komentarus", - "home.column_settings.show_reblogs": "Rodyti pakėlimus", + "home.column_settings.show_quotes": "Rodyti citavimus", + "home.column_settings.show_reblogs": "Rodyti pasidalinimus", "home.column_settings.show_replies": "Rodyti atsakymus", "home.hide_announcements": "Slėpti skelbimus", "home.pending_critical_update.body": "Kuo greičiau atnaujink savo Mastodon serverį.", @@ -575,7 +611,7 @@ "keyboard_shortcuts.open_media": "Atidaryti mediją", "keyboard_shortcuts.pinned": "Atverti prisegtų įrašų sąrašą", "keyboard_shortcuts.profile": "Atidaryti autoriaus (-ės) profilį", - "keyboard_shortcuts.quote": "Komentuoti įrašą", + "keyboard_shortcuts.quote": "Cituoti įrašą", "keyboard_shortcuts.reply": "Atsakyti į įrašą", "keyboard_shortcuts.requests": "Atidaryti sekimo prašymų sąrašą", "keyboard_shortcuts.search": "Fokusuoti paieškos juostą", @@ -643,7 +679,7 @@ "navigation_bar.automated_deletion": "Automatinis įrašų ištrynimas", "navigation_bar.blocks": "Užblokuoti naudotojai", "navigation_bar.bookmarks": "Žymės", - "navigation_bar.direct": "Paminėjimai", + "navigation_bar.direct": "Žinutės", "navigation_bar.domain_blocks": "Užblokuoti domenai", "navigation_bar.favourites": "Mėgstami", "navigation_bar.filters": "Nutildyti žodžiai", @@ -688,7 +724,7 @@ "notification.label.mention": "Paminėjimas", "notification.label.private_mention": "Privatus paminėjimas", "notification.label.private_reply": "Privatus atsakymas", - "notification.label.quote": "{name} pakomentavo jūsų įrašą", + "notification.label.quote": "{name} pacitavo jūsų įrašą", "notification.label.reply": "Atsakymas", "notification.mention": "Paminėjimas", "notification.mentioned_you": "{name} paminėjo jus", @@ -703,7 +739,7 @@ "notification.moderation_warning.action_suspend": "Tavo paskyra buvo sustabdyta.", "notification.own_poll": "Tavo apklausa baigėsi", "notification.poll": "Baigėsi apklausa, kurioje balsavai", - "notification.quoted_update": "{name} redagavo jūsų pakomentuotą įrašą", + "notification.quoted_update": "{name} redagavo jūsų pacituotą įrašą", "notification.reblog": "{name} dalinosi tavo įrašu", "notification.reblog.name_and_others_with_link": "{name} ir {count, plural,one {dar kažkas} few {# kiti} other {# kitų}} pasidalino tavo įrašu", "notification.relationships_severance_event": "Prarasti sąryšiai su {name}", @@ -744,10 +780,10 @@ "notifications.column_settings.follow": "Nauji sekėjai:", "notifications.column_settings.follow_request": "Nauji sekimo prašymai:", "notifications.column_settings.group": "Grupė", - "notifications.column_settings.mention": "Paminėjimai:", + "notifications.column_settings.mention": "Žinutės:", "notifications.column_settings.poll": "Balsavimo rezultatai:", "notifications.column_settings.push": "Tiesioginiai pranešimai", - "notifications.column_settings.quote": "Komentarai:", + "notifications.column_settings.quote": "Citavimai:", "notifications.column_settings.reblog": "Pasidalinimai:", "notifications.column_settings.show": "Rodyti stulpelyje", "notifications.column_settings.sound": "Paleisti garsą", @@ -783,7 +819,7 @@ "notifications.policy.filter_not_following_hint": "Kol jų nepatvirtinsi rankiniu būdu", "notifications.policy.filter_not_following_title": "Žmonių, kuriuos neseki", "notifications.policy.filter_private_mentions_hint": "Filtruojama, išskyrus atsakymus į tavo paties paminėjimą arba jei seki siuntėją", - "notifications.policy.filter_private_mentions_title": "Nepageidaujami asmens paminėjimai", + "notifications.policy.filter_private_mentions_title": "Nepageidaujamos žinutės", "notifications.policy.title": "Tvarkyti pranešimus iš…", "notifications_permission_banner.enable": "Įjungti darbalaukio pranešimus", "notifications_permission_banner.how_to_control": "Jei nori gauti pranešimus, kai Mastodon nėra atidarytas, įjunk darbalaukio pranešimus. Įjungęs (-usi) darbalaukio pranešimus, gali tiksliai valdyti, kokių tipų sąveikos generuoja darbalaukio pranešimus, naudojant pirmiau esančiu mygtuku {icon}.", @@ -821,16 +857,16 @@ "privacy.private.short": "Sekėjai", "privacy.public.long": "Bet kas iš Mastodon ir ne Mastodon", "privacy.public.short": "Vieša", - "privacy.quote.anyone": "{visibility}, komentarai galimi", - "privacy.quote.disabled": "{visibility}, komentavimas išjungtas", - "privacy.quote.limited": "{visibility}, komentavimas apribotas", + "privacy.quote.anyone": "{visibility}, citavimai galimi", + "privacy.quote.disabled": "{visibility}, išjungtas citavimas", + "privacy.quote.limited": "{visibility}, apribotas citavimas", "privacy.unlisted.additional": "Tai veikia lygiai taip pat, kaip ir vieša, tik įrašas nebus rodomas tiesioginiuose srautuose, grotažymėse, naršyme ar Mastodon paieškoje, net jei esi įtraukęs (-usi) visą paskyrą.", "privacy.unlisted.long": "Paslėptas nuo „Mastodon“ paieškos rezultatų, tendencijų ir viešų įrašų sienų", "privacy.unlisted.short": "Tyliai vieša", "privacy_policy.last_updated": "Paskutinį kartą atnaujinta {date}", "privacy_policy.title": "Privatumo politika", - "quote_error.edit": "Komentuoti negalima, kai keičiamas įrašas.", - "quote_error.poll": "Komentuoti apklausose negalima.", + "quote_error.edit": "Cituoti negalima, kai keičiamas įrašas.", + "quote_error.poll": "Cituoti apklausose negalima.", "quote_error.private_mentions": "Komentuoti privačius paminėjimus nėra leidžiama.", "quote_error.quote": "Leidžiama pateikti tik vieną komentarą vienu metu.", "quote_error.unauthorized": "Jums neleidžiama komentuoti šio įrašo.", @@ -852,7 +888,7 @@ "relative_time.today": "šiandien", "remove_quote_hint.button_label": "Supratau", "remove_quote_hint.message": "Tai galite padaryti iš {icon} parinkčių meniu.", - "remove_quote_hint.title": "Norite pašalinti savo komentarą?", + "remove_quote_hint.title": "Norite pašalinti savo komentarą prie cituojamo įrašo?", "reply_indicator.attachments": "{count, plural, one {# priedas} few {# priedai} many {# priedo} other {# priedų}}", "reply_indicator.cancel": "Atšaukti", "reply_indicator.poll": "Apklausa", @@ -942,7 +978,7 @@ "status.admin_account": "Atidaryti prižiūrėjimo sąsają @{name}", "status.admin_domain": "Atidaryti prižiūrėjimo sąsają {domain}", "status.admin_status": "Atidaryti šį įrašą prižiūrėjimo sąsajoje", - "status.all_disabled": "Įrašo pasidalijimai ir komentavimai išjungti", + "status.all_disabled": "Įrašo pasidalijimai ir citavimai išjungti", "status.block": "Blokuoti @{name}", "status.bookmark": "Žymė", "status.cancel_reblog_private": "Nesidalinti", @@ -979,10 +1015,11 @@ "status.more": "Daugiau", "status.mute": "Nutildyti @{name}", "status.mute_conversation": "Nutildyti pokalbį", + "status.not_quoted": "Šiame įraše Jūs nesate paminėtas", "status.open": "Išskleisti šį įrašą", "status.pin": "Prisegti prie profilio", - "status.quote": "Komentuoti", - "status.quote.cancel": "Atšaukti komentarą", + "status.quote": "Cituoti su komentaru", + "status.quote.cancel": "Atšaukti citavimą", "status.quote_error.blocked_account_hint.title": "Šis įrašas yra paslėptas, nes jūs esate užblokavę @{name}.", "status.quote_error.blocked_domain_hint.title": "Šis įrašas yra paslėptas, nes jūs užblokavote {domain}.", "status.quote_error.filtered": "Paslėpta dėl vieno iš jūsų filtrų", @@ -995,13 +1032,13 @@ "status.quote_error.revoked": "Autorius pašalino įrašą", "status.quote_followers_only": "Tik sekėjai gali cituoti šį įrašą", "status.quote_manual_review": "Autorius atskirai įvertins paskelbimą", - "status.quote_noun": "Paminėjimas", + "status.quote_noun": "Citata", "status.quote_policy_change": "Keisti, kas gali cituoti", "status.quote_post_author": "Paminėjo įrašą iš @{name}", "status.quote_private": "Privačių įrašų negalima komentuoti", "status.quotes.empty": "Šio įrašo dar niekas nepakomentavo. Kai kas nors tai padarys, jie bus rodomi čia.", - "status.quotes.local_other_disclaimer": "Autoriaus atmesti įrašo komentavimai nebus rodomi.", - "status.quotes.remote_other_disclaimer": "Čia bus rodoma tik komentavimai iš {domain}. Autoriaus atmesti įrašo komentavimai nebus rodomi.", + "status.quotes.local_other_disclaimer": "Autoriaus atmesti įrašo citavimai nebus rodomi.", + "status.quotes.remote_other_disclaimer": "Čia bus rodoma tik citavimai iš {domain}. Autoriaus atmesti įrašo komentarai nebus rodomi.", "status.quotes_count": "{count, plural, one {{counter} komentaras} few {{counter} komentarai} many {{counter} komentarų} other {{counter} komentarai}}", "status.read_more": "Skaityti daugiau", "status.reblog": "Dalintis", @@ -1058,7 +1095,7 @@ "upload_button.label": "Pridėti vaizdų, vaizdo įrašą arba garso failą", "upload_error.limit": "Viršyta failo įkėlimo riba.", "upload_error.poll": "Failų įkėlimas neleidžiamas su apklausomis.", - "upload_error.quote": "Komentuojant įrašą failo įkėlimas negalimas.", + "upload_error.quote": "Cituojant įrašą, failo įkėlimas negalimas.", "upload_form.drag_and_drop.instructions": "Kad paimtum medijos priedą, paspausk tarpo arba įvedimo klavišą. Tempant naudok rodyklių klavišus, kad perkeltum medijos priedą bet kuria kryptimi. Dar kartą paspausk tarpo arba įvedimo klavišą, kad nuleistum medijos priedą naujoje vietoje, arba paspausk grįžimo klavišą, kad atšauktum.", "upload_form.drag_and_drop.on_drag_cancel": "Nutempimas buvo atšauktas. Medijos priedas {item} buvo nuleistas.", "upload_form.drag_and_drop.on_drag_end": "Medijos priedas {item} buvo nuleistas.", @@ -1084,7 +1121,7 @@ "video.volume_up": "Pagarsinti", "visibility_modal.button_title": "Nustatyti matomumą", "visibility_modal.direct_quote_warning.text": "Jei išsaugosite dabartinius nustatymus, įterptas (embeded) komentaras bus konvertuotas į nuorodą.", - "visibility_modal.direct_quote_warning.title": "Komentarai negali būti įterpiami į privačius paminėjimus", + "visibility_modal.direct_quote_warning.title": "Citavimai negali būti įterpiami į privačius paminėjimus", "visibility_modal.header": "Matomumas ir sąveika", "visibility_modal.helper.direct_quoting": "Privatūs paminėjimai su žyma @, parašyti platformoje „Mastodon“, negali būti komentuojami kitų.", "visibility_modal.helper.privacy_editing": "Matomumo nustatymai negali būti keičiami po to, kai įrašas yra paskelbtas.", diff --git a/config/locales/lt.yml b/config/locales/lt.yml index 92f95ca493..2ea234f7f1 100644 --- a/config/locales/lt.yml +++ b/config/locales/lt.yml @@ -659,7 +659,7 @@ lt: no_status_selected: Jokie įrašai nebuvo pakeisti, nes nė vienas buvo pasirinktas open: Atidaryti įrašą original_status: Originalus įrašas - quotes: Paminėjimai + quotes: Citavimai replied_to_html: Atsakyta į %{acct_link} status_title: Paskelbė @%{name} title: Paskyros įrašai – @%{name} @@ -1131,6 +1131,8 @@ lt: body: 'Tavo įrašą paminėjo %{name}:' subject: "%{name} paminėjo jūsų įrašą" title: Naujas paminėjimas + quoted_update: + subject: "%{name} redagavo jūsų pasidalintą įrašą" reblog: body: 'Tavo įrašą dalinosi %{name}:' subject: "%{name} dalinosi tavo įrašu" diff --git a/config/locales/simple_form.lt.yml b/config/locales/simple_form.lt.yml index de27b2e756..16e3d95a23 100644 --- a/config/locales/simple_form.lt.yml +++ b/config/locales/simple_form.lt.yml @@ -83,7 +83,7 @@ lt: app_icon: WEBP, PNG, GIF arba JPG. Pakeičia numatytąją programos piktogramą mobiliuosiuose įrenginiuose pasirinktine piktograma. backups_retention_period: Naudotojai gali generuoti savo įrašų archyvus, kuriuos vėliau galės atsisiųsti. Nustačius teigiamą reikšmę, šie archyvai po nurodyto dienų skaičiaus bus automatiškai ištrinti iš saugyklos. bootstrap_timeline_accounts: Šios paskyros bus rekomenduojamos naujiems naudotojams Rekomenduojami sekimai skyrelyje. Pateikite rekomenduojamas paskyras, atskirtas kableliais. - content_cache_retention_period: Visi įrašai iš kitų serverių (įskaitant pakėlimus ir atsakymus) bus ištrinti po nurodyto dienų skaičiaus, neatsižvelgiant į bet kokią vietinio naudotojo sąveiką su tais įrašais. Tai taikoma ir tiems įrašams, kuriuos vietinis naudotojas yra pažymėjęs kaip žymes ar mėgstamus. Privačios paminėjimai tarp naudotojų iš skirtingų instancijų taip pat bus prarastos ir jų bus neįmanoma atkurti. Šis nustatymas skirtas naudoti ypatingos paskirties instancijose, o įgyvendinus jį bendram naudojimui, pažeidžiami daugelio naudotojų lūkesčiai. + content_cache_retention_period: Visi įrašai iš kitų serverių (įskaitant pakėlimus ir atsakymus) bus ištrinti po nurodyto dienų skaičiaus, neatsižvelgiant į bet kokią vietinio naudotojo sąveiką su tais įrašais. Tai taikoma ir tiems įrašams, kuriuos vietinis naudotojas yra pažymėjęs kaip žymes ar mėgstamus. Privačios žinutės tarp naudotojų iš skirtingų instancijų taip pat bus prarastos ir jų bus neįmanoma atkurti. Šis nustatymas skirtas naudoti ypatingos paskirties instancijose, o įgyvendinus jį bendram naudojimui, pažeidžiami daugelio naudotojų lūkesčiai. favicon: WEBP, PNG, GIF arba JPG. Pakeičia numatytąją Mastodon svetaines piktogramą pasirinktine piktograma. mascot: Pakeičia išplėstinės žiniatinklio sąsajos iliustraciją. media_cache_retention_period: Nuotolinių naudotojų įrašytų įrašų medijos failai talpinami tavo serveryje. Nustačius teigiamą reikšmę, medijos bus ištrinamos po nurodyto dienų skaičiaus. Jei medijos duomenų bus paprašyta po to, kai jie bus ištrinti, jie bus atsiųsti iš naujo, jei šaltinio turinys vis dar prieinamas. Dėl apribojimų, susijusių su nuorodų peržiūros kortelių apklausos dažnumu trečiųjų šalių svetainėse, rekomenduojama nustatyti šią reikšmę ne trumpesnę kaip 14 dienų, kitaip nuorodų peržiūros kortelės nebus atnaujinamos pagal pareikalavimą iki to laiko. From ad245adf510cf56953ebb8a7dfc5db16c0f58403 Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 31 Jul 2026 15:55:33 +0200 Subject: [PATCH 4/4] Add `requested_deletion_at` attribute to `Account` for deleted-but-not-suspended accounts (#23617) --- .github/workflows/test-migrations.yml | 4 +- .../activitypub/base_controller.rb | 4 ++ .../activitypub/inboxes_controller.rb | 4 ++ .../api/v1/accounts/base_controller.rb | 9 +++ .../v1/accounts/endorsements_controller.rb | 6 +- .../v1/accounts/featured_tags_controller.rb | 6 +- .../accounts/follower_accounts_controller.rb | 6 +- .../accounts/following_accounts_controller.rb | 6 +- .../v1/accounts/identity_proofs_controller.rb | 7 --- .../api/v1/accounts/lists_controller.rb | 8 +-- .../api/v1/accounts/lookup_controller.rb | 1 + .../api/v1/accounts/notes_controller.rb | 6 +- .../v1/accounts/relationships_controller.rb | 2 +- .../api/v1/accounts/statuses_controller.rb | 6 +- app/controllers/api/v1/accounts_controller.rb | 2 +- .../api/v1/collection_items_controller.rb | 2 +- .../api/v1/collections_controller.rb | 2 +- .../api/v1/in_collections_controller.rb | 2 +- .../concerns/account_owned_concern.rb | 6 +- .../settings/deletes_controller.rb | 2 +- app/lib/activitypub/activity/flag.rb | 2 +- app/models/account.rb | 16 +++++ app/models/concerns/account/search.rb | 6 +- app/models/concerns/account/suspensions.rb | 13 +++- app/models/user.rb | 4 +- app/serializers/rest/account_serializer.rb | 4 +- app/services/delete_account_service.rb | 9 ++- app/views/admin/accounts/_buttons.html.haml | 4 ++ app/views/admin/accounts/_counters.html.haml | 6 +- app/views/admin/reports/index.html.haml | 2 + .../scheduler/self_destruct_scheduler.rb | 10 +-- config/locales/en.yml | 2 + ...7_add_requested_deletion_at_to_accounts.rb | 7 +++ ...3_update_account_summaries_to_version_3.rb | 26 ++++++++ ..._backfill_account_requested_deletion_at.rb | 29 +++++++++ db/schema.rb | 6 +- db/views/account_summaries_v03.sql | 24 +++++++ lib/tasks/db.rake | 6 +- lib/tasks/tests.rake | 46 ++++++++++---- .../application_controller_spec.rb | 18 +++++- .../auth/registrations_controller_spec.rb | 9 +++ .../auth/sessions_controller_spec.rb | 13 ++++ .../account_controller_concern_spec.rb | 24 ++++++- .../following_accounts_controller_spec.rb | 63 +++++++++++++++++++ spec/fabricators/account_fabricator.rb | 23 +++---- spec/models/user_spec.rb | 7 ++- spec/requests/accounts_spec.rb | 27 ++++++++ spec/requests/activitypub/collections_spec.rb | 27 ++++++++ spec/requests/activitypub/inboxes_spec.rb | 27 ++++++++ spec/requests/activitypub/outboxes_spec.rb | 54 ++++++++++++++++ spec/requests/activitypub/replies_spec.rb | 31 +++++++++ .../api/v1/accounts/follower_accounts_spec.rb | 25 ++++++++ .../v1/accounts/following_accounts_spec.rb | 25 ++++++++ spec/requests/api/v1/accounts/lists_spec.rb | 25 ++++++++ .../requests/api/v1/accounts/statuses_spec.rb | 29 +++++++++ spec/requests/api/v1/accounts_spec.rb | 25 ++++++++ spec/requests/settings/deletes_spec.rb | 22 +++++++ spec/requests/statuses_spec.rb | 27 ++++++++ spec/requests/well_known/webfinger_spec.rb | 27 +++++++- spec/services/account_search_service_spec.rb | 17 +++++ spec/services/notify_service_spec.rb | 5 ++ spec/system/settings/deletes_spec.rb | 4 +- .../scheduler/self_destruct_scheduler_spec.rb | 10 +-- 63 files changed, 757 insertions(+), 120 deletions(-) create mode 100644 app/controllers/api/v1/accounts/base_controller.rb create mode 100644 db/migrate/20260728124057_add_requested_deletion_at_to_accounts.rb create mode 100644 db/migrate/20260728145403_update_account_summaries_to_version_3.rb create mode 100644 db/post_migrate/20260728145507_backfill_account_requested_deletion_at.rb create mode 100644 db/views/account_summaries_v03.sql diff --git a/.github/workflows/test-migrations.yml b/.github/workflows/test-migrations.yml index f0a011e645..79268f3e60 100644 --- a/.github/workflows/test-migrations.yml +++ b/.github/workflows/test-migrations.yml @@ -104,8 +104,8 @@ jobs: bin/rails db:create SKIP_POST_DEPLOYMENT_MIGRATIONS=true bin/rails tests:migrations:prepare_database - # Migrate up to v4.2.0 breakpoint - bin/rails db:migrate VERSION=20230907150100 + # Migrate up to v4.3.0 breakpoint + bin/rails db:migrate VERSION=20241007071624 # Migrate the rest SKIP_POST_DEPLOYMENT_MIGRATIONS=true bin/rails db:migrate diff --git a/app/controllers/activitypub/base_controller.rb b/app/controllers/activitypub/base_controller.rb index c2563c492e..784604b93a 100644 --- a/app/controllers/activitypub/base_controller.rb +++ b/app/controllers/activitypub/base_controller.rb @@ -13,4 +13,8 @@ class ActivityPub::BaseController < Api::BaseController def skip_temporary_suspension_response? false end + + def skip_pending_deletion_response? + false + end end diff --git a/app/controllers/activitypub/inboxes_controller.rb b/app/controllers/activitypub/inboxes_controller.rb index b5926d94fd..d76b650a00 100644 --- a/app/controllers/activitypub/inboxes_controller.rb +++ b/app/controllers/activitypub/inboxes_controller.rb @@ -40,6 +40,10 @@ class ActivityPub::InboxesController < ActivityPub::BaseController true end + def skip_pending_deletion_response? + true + end + def body return @body if defined?(@body) diff --git a/app/controllers/api/v1/accounts/base_controller.rb b/app/controllers/api/v1/accounts/base_controller.rb new file mode 100644 index 0000000000..6931d07645 --- /dev/null +++ b/app/controllers/api/v1/accounts/base_controller.rb @@ -0,0 +1,9 @@ +# frozen_string_literal: true + +class Api::V1::Accounts::BaseController < Api::BaseController + private + + def set_account + @account = Account.without_requested_deletion.find(params[:account_id]) + end +end diff --git a/app/controllers/api/v1/accounts/endorsements_controller.rb b/app/controllers/api/v1/accounts/endorsements_controller.rb index 1e21994a90..eaa48c2c12 100644 --- a/app/controllers/api/v1/accounts/endorsements_controller.rb +++ b/app/controllers/api/v1/accounts/endorsements_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Api::V1::Accounts::EndorsementsController < Api::BaseController +class Api::V1::Accounts::EndorsementsController < Api::V1::Accounts::BaseController include Authorization before_action -> { authorize_if_got_token! :read, :'read:accounts' }, only: :index @@ -28,10 +28,6 @@ class Api::V1::Accounts::EndorsementsController < Api::BaseController private - def set_account - @account = Account.find(params[:account_id]) - end - def set_endorsed_accounts @endorsed_accounts = @account.unavailable? ? [] : paginated_endorsed_accounts end diff --git a/app/controllers/api/v1/accounts/featured_tags_controller.rb b/app/controllers/api/v1/accounts/featured_tags_controller.rb index f95846366c..40b35cd90a 100644 --- a/app/controllers/api/v1/accounts/featured_tags_controller.rb +++ b/app/controllers/api/v1/accounts/featured_tags_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Api::V1::Accounts::FeaturedTagsController < Api::BaseController +class Api::V1::Accounts::FeaturedTagsController < Api::V1::Accounts::BaseController before_action :set_account before_action :set_featured_tags @@ -12,10 +12,6 @@ class Api::V1::Accounts::FeaturedTagsController < Api::BaseController private - def set_account - @account = Account.find(params[:account_id]) - end - def set_featured_tags @featured_tags = @account.unavailable? ? [] : @account.featured_tags end diff --git a/app/controllers/api/v1/accounts/follower_accounts_controller.rb b/app/controllers/api/v1/accounts/follower_accounts_controller.rb index 3f2ecb892d..78415bd8e7 100644 --- a/app/controllers/api/v1/accounts/follower_accounts_controller.rb +++ b/app/controllers/api/v1/accounts/follower_accounts_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Api::V1::Accounts::FollowerAccountsController < Api::BaseController +class Api::V1::Accounts::FollowerAccountsController < Api::V1::Accounts::BaseController before_action -> { authorize_if_got_token! :read, :'read:accounts' } before_action :set_account after_action :insert_pagination_headers @@ -13,10 +13,6 @@ class Api::V1::Accounts::FollowerAccountsController < Api::BaseController private - def set_account - @account = Account.find(params[:account_id]) - end - def load_accounts return [] if hide_results? diff --git a/app/controllers/api/v1/accounts/following_accounts_controller.rb b/app/controllers/api/v1/accounts/following_accounts_controller.rb index 7c16a3487e..138e728991 100644 --- a/app/controllers/api/v1/accounts/following_accounts_controller.rb +++ b/app/controllers/api/v1/accounts/following_accounts_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Api::V1::Accounts::FollowingAccountsController < Api::BaseController +class Api::V1::Accounts::FollowingAccountsController < Api::V1::Accounts::BaseController before_action -> { authorize_if_got_token! :read, :'read:accounts' } before_action :set_account after_action :insert_pagination_headers @@ -13,10 +13,6 @@ class Api::V1::Accounts::FollowingAccountsController < Api::BaseController private - def set_account - @account = Account.find(params[:account_id]) - end - def load_accounts return [] if hide_results? diff --git a/app/controllers/api/v1/accounts/identity_proofs_controller.rb b/app/controllers/api/v1/accounts/identity_proofs_controller.rb index 02a45e8758..d01a8fb27e 100644 --- a/app/controllers/api/v1/accounts/identity_proofs_controller.rb +++ b/app/controllers/api/v1/accounts/identity_proofs_controller.rb @@ -6,15 +6,8 @@ class Api::V1::Accounts::IdentityProofsController < Api::BaseController deprecate_api '2022-03-30' before_action :require_user! - before_action :set_account def index render json: [] end - - private - - def set_account - @account = Account.find(params[:account_id]) - end end diff --git a/app/controllers/api/v1/accounts/lists_controller.rb b/app/controllers/api/v1/accounts/lists_controller.rb index c92f1f8a08..42a6bdff32 100644 --- a/app/controllers/api/v1/accounts/lists_controller.rb +++ b/app/controllers/api/v1/accounts/lists_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Api::V1::Accounts::ListsController < Api::BaseController +class Api::V1::Accounts::ListsController < Api::V1::Accounts::BaseController before_action -> { doorkeeper_authorize! :read, :'read:lists' } before_action :require_user! before_action :set_account @@ -9,10 +9,4 @@ class Api::V1::Accounts::ListsController < Api::BaseController @lists = @account.suspended? ? [] : @account.lists.where(account: current_account) render json: @lists, each_serializer: REST::ListSerializer end - - private - - def set_account - @account = Account.find(params[:account_id]) - end end diff --git a/app/controllers/api/v1/accounts/lookup_controller.rb b/app/controllers/api/v1/accounts/lookup_controller.rb index 6d63398781..db93817656 100644 --- a/app/controllers/api/v1/accounts/lookup_controller.rb +++ b/app/controllers/api/v1/accounts/lookup_controller.rb @@ -13,6 +13,7 @@ class Api::V1::Accounts::LookupController < Api::BaseController def set_account @account = ResolveAccountService.new.call(params[:acct], skip_webfinger: true) || raise(ActiveRecord::RecordNotFound) + raise ActiveRecord::RecordNotFound if @account.deleted? rescue Addressable::URI::InvalidURIError raise(ActiveRecord::RecordNotFound) end diff --git a/app/controllers/api/v1/accounts/notes_controller.rb b/app/controllers/api/v1/accounts/notes_controller.rb index b9b58b23d4..03d9a77a64 100644 --- a/app/controllers/api/v1/accounts/notes_controller.rb +++ b/app/controllers/api/v1/accounts/notes_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Api::V1::Accounts::NotesController < Api::BaseController +class Api::V1::Accounts::NotesController < Api::V1::Accounts::BaseController include Authorization before_action -> { doorkeeper_authorize! :write, :'write:accounts' } @@ -20,10 +20,6 @@ class Api::V1::Accounts::NotesController < Api::BaseController private - def set_account - @account = Account.find(params[:account_id]) - end - def relationships_presenter AccountRelationshipsPresenter.new([@account], current_user.account_id) end diff --git a/app/controllers/api/v1/accounts/relationships_controller.rb b/app/controllers/api/v1/accounts/relationships_controller.rb index d43832177a..b6af5e0291 100644 --- a/app/controllers/api/v1/accounts/relationships_controller.rb +++ b/app/controllers/api/v1/accounts/relationships_controller.rb @@ -5,7 +5,7 @@ class Api::V1::Accounts::RelationshipsController < Api::BaseController before_action :require_user! def index - @accounts = Account.where(id: account_ids).select(:id, :domain) + @accounts = Account.without_requested_deletion.where(id: account_ids).select(:id, :domain) @accounts.merge!(Account.without_suspended) unless truthy_param?(:with_suspended) render json: @accounts, each_serializer: REST::RelationshipSerializer, relationships: relationships end diff --git a/app/controllers/api/v1/accounts/statuses_controller.rb b/app/controllers/api/v1/accounts/statuses_controller.rb index c42f27776c..a297defd49 100644 --- a/app/controllers/api/v1/accounts/statuses_controller.rb +++ b/app/controllers/api/v1/accounts/statuses_controller.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -class Api::V1::Accounts::StatusesController < Api::BaseController +class Api::V1::Accounts::StatusesController < Api::V1::Accounts::BaseController before_action -> { authorize_if_got_token! :read, :'read:statuses' } before_action :set_account @@ -14,10 +14,6 @@ class Api::V1::Accounts::StatusesController < Api::BaseController private - def set_account - @account = Account.find(params[:account_id]) - end - def load_statuses @account.unavailable? ? [] : preloaded_account_statuses end diff --git a/app/controllers/api/v1/accounts_controller.rb b/app/controllers/api/v1/accounts_controller.rb index 8738da3c94..a7b06f2fa4 100644 --- a/app/controllers/api/v1/accounts_controller.rb +++ b/app/controllers/api/v1/accounts_controller.rb @@ -84,7 +84,7 @@ class Api::V1::AccountsController < Api::BaseController private def set_account - @account = Account.find(params[:id]) + @account = Account.without_requested_deletion.find(params[:id]) end def set_accounts diff --git a/app/controllers/api/v1/collection_items_controller.rb b/app/controllers/api/v1/collection_items_controller.rb index 6b7db97b06..a142bead8b 100644 --- a/app/controllers/api/v1/collection_items_controller.rb +++ b/app/controllers/api/v1/collection_items_controller.rb @@ -50,7 +50,7 @@ class Api::V1::CollectionItemsController < Api::BaseController def set_account return render(json: { error: '`account_id` parameter is missing' }, status: 422) if params[:account_id].blank? - @account = Account.find(params[:account_id]) + @account = Account.without_requested_deletion.find(params[:account_id]) end def set_collection_item diff --git a/app/controllers/api/v1/collections_controller.rb b/app/controllers/api/v1/collections_controller.rb index 08453a7ed6..b478d4f44e 100644 --- a/app/controllers/api/v1/collections_controller.rb +++ b/app/controllers/api/v1/collections_controller.rb @@ -69,7 +69,7 @@ class Api::V1::CollectionsController < Api::BaseController private def set_account - @account = Account.find(params[:account_id]) + @account = Account.without_requested_deletion.find(params[:account_id]) end def set_collections diff --git a/app/controllers/api/v1/in_collections_controller.rb b/app/controllers/api/v1/in_collections_controller.rb index c34845e463..1fc6639fa6 100644 --- a/app/controllers/api/v1/in_collections_controller.rb +++ b/app/controllers/api/v1/in_collections_controller.rb @@ -25,7 +25,7 @@ class Api::V1::InCollectionsController < Api::BaseController private def set_account - @account = Account.find(params[:account_id]) + @account = Account.without_requested_deletion.find(params[:account_id]) end def set_collections diff --git a/app/controllers/concerns/account_owned_concern.rb b/app/controllers/concerns/account_owned_concern.rb index 7b3cd4d3ea..6e94e22d96 100644 --- a/app/controllers/concerns/account_owned_concern.rb +++ b/app/controllers/concerns/account_owned_concern.rb @@ -40,7 +40,7 @@ module AccountOwnedConcern def check_account_suspension if @account.permanently_unavailable? permanent_unavailability_response - elsif @account.suspended? && !skip_temporary_suspension_response? + elsif (@account.suspended? && !skip_temporary_suspension_response?) || (@account.deleted? && !skip_pending_deletion_response?) temporary_suspension_response end end @@ -49,6 +49,10 @@ module AccountOwnedConcern false end + def skip_pending_deletion_response? + false + end + def permanent_unavailability_response expires_in(3.minutes, public: true) gone diff --git a/app/controllers/settings/deletes_controller.rb b/app/controllers/settings/deletes_controller.rb index 815d95ad83..c499c12831 100644 --- a/app/controllers/settings/deletes_controller.rb +++ b/app/controllers/settings/deletes_controller.rb @@ -37,7 +37,7 @@ class Settings::DeletesController < Settings::BaseController end def destroy_account! - current_account.suspend!(origin: :local, block_email: false) + current_account.mark_deleted! AccountDeletionWorker.perform_async(current_user.account_id) sign_out end diff --git a/app/lib/activitypub/activity/flag.rb b/app/lib/activitypub/activity/flag.rb index bc25e5c29f..ead25f12cc 100644 --- a/app/lib/activitypub/activity/flag.rb +++ b/app/lib/activitypub/activity/flag.rb @@ -15,7 +15,7 @@ class ActivityPub::Activity::Flag < ActivityPub::Activity target_collections = target_collections_by_account.fetch(target_account.id, []) replied_to_accounts = target_statuses.nil? ? [] : Account.local.where(id: target_statuses.filter_map(&:in_reply_to_account_id)) - next if target_account.suspended? || (!target_account.local? && replied_to_accounts.none?) + next if target_account.suspended? || target_account.permanently_deleted? || (!target_account.local? && replied_to_accounts.none?) ReportService.new.call( @account, diff --git a/app/models/account.rb b/app/models/account.rb index 2203c96ca6..a6a39fe4b4 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -43,6 +43,7 @@ # private_key :text # protocol :integer default("ostatus"), not null # public_key :text default(""), not null +# requested_deletion_at :datetime # requested_review_at :datetime # reviewed_at :datetime # sensitized_at :datetime @@ -285,6 +286,21 @@ class Account < ApplicationRecord ResolveAccountService.new.call(acct) unless local? end + def deleted? + requested_deletion_at.present? && !instance_actor? + end + + def permanently_deleted? + deleted? && deletion_request.nil? + end + + def mark_deleted!(date: Time.now.utc) + transaction do + create_deletion_request! + update!(requested_deletion_at: date) + end + end + def memorialize! update!(memorial: true) end diff --git a/app/models/concerns/account/search.rb b/app/models/concerns/account/search.rb index 077e5d57b1..3846c4baf1 100644 --- a/app/models/concerns/account/search.rb +++ b/app/models/concerns/account/search.rb @@ -57,7 +57,7 @@ module Account::Search LEFT JOIN users ON accounts.id = users.account_id LEFT JOIN account_stats AS s ON accounts.id = s.account_id WHERE to_tsquery('simple', :tsquery) @@ #{TEXT_SEARCH_RANKS} - AND accounts.suspended_at IS NULL + AND accounts.suspended_at IS NULL AND accounts.requested_deletion_at IS NULL AND accounts.moved_to_account_id IS NULL AND (accounts.domain IS NOT NULL OR (users.approved = TRUE AND users.confirmed_at IS NOT NULL)) ORDER BY rank DESC @@ -80,7 +80,7 @@ module Account::Search LEFT JOIN account_stats AS s ON accounts.id = s.account_id WHERE accounts.id IN (SELECT * FROM first_degree) AND to_tsquery('simple', :tsquery) @@ #{TEXT_SEARCH_RANKS} - AND accounts.suspended_at IS NULL + AND accounts.suspended_at IS NULL AND accounts.requested_deletion_at IS NULL AND accounts.moved_to_account_id IS NULL GROUP BY accounts.id, s.id ORDER BY rank DESC @@ -98,7 +98,7 @@ module Account::Search LEFT JOIN users ON accounts.id = users.account_id LEFT JOIN account_stats AS s ON accounts.id = s.account_id WHERE to_tsquery('simple', :tsquery) @@ #{TEXT_SEARCH_RANKS} - AND accounts.suspended_at IS NULL + AND accounts.suspended_at IS NULL AND accounts.requested_deletion_at IS NULL AND accounts.moved_to_account_id IS NULL AND (accounts.domain IS NOT NULL OR (users.approved = TRUE AND users.confirmed_at IS NOT NULL)) GROUP BY accounts.id, s.id diff --git a/app/models/concerns/account/suspensions.rb b/app/models/concerns/account/suspensions.rb index 28c6bb8c66..3baa946328 100644 --- a/app/models/concerns/account/suspensions.rb +++ b/app/models/concerns/account/suspensions.rb @@ -5,13 +5,13 @@ module Account::Suspensions included do scope :suspended, -> { where.not(suspended_at: nil) } - scope :without_suspended, -> { where(suspended_at: nil) } + scope :without_requested_deletion, -> { where(requested_deletion_at: nil) } + scope :without_suspended, -> { without_requested_deletion.where(suspended_at: nil) } end def suspended? suspended_at.present? && !instance_actor? end - alias unavailable? suspended? def suspended_locally? suspended? && suspension_origin_local? @@ -20,12 +20,19 @@ module Account::Suspensions def suspended_permanently? suspended? && deletion_request.nil? end - alias permanently_unavailable? suspended_permanently? def suspended_temporarily? suspended? && deletion_request.present? end + def unavailable? + deleted? || suspended? + end + + def permanently_unavailable? + unavailable? && deletion_request.nil? + end + def suspend!(date: Time.now.utc, origin: :local, block_email: true) transaction do create_deletion_request! diff --git a/app/models/user.rb b/app/models/user.rb index b1fbfbd9ff..1bddd36dc5 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -102,13 +102,13 @@ class User < ApplicationRecord validates :date_of_birth, presence: true, date_of_birth: true, on: :create, if: -> { Setting.min_age.present? && !bypass_registration_checks? } validate :validate_role_elevation - scope :account_not_suspended, -> { joins(:account).merge(Account.without_suspended) } + scope :account_available, -> { joins(:account).merge(Account.without_suspended.without_requested_deletion) } scope :recent, -> { order(id: :desc) } scope :pending, -> { where(approved: false) } scope :approved, -> { where(approved: true) } scope :enabled, -> { where(disabled: false) } scope :disabled, -> { where(disabled: true) } - scope :active, -> { confirmed.signed_in_recently.account_not_suspended } + scope :active, -> { confirmed.signed_in_recently.account_available } scope :matches_email, ->(value) { where(arel_table[:email].matches("#{value}%")) } scope :matches_ip, ->(value) { left_joins(:ips).merge(UserIp.contained_by(value)).group(users: [:id]) } diff --git a/app/serializers/rest/account_serializer.rb b/app/serializers/rest/account_serializer.rb index e24cdfab85..76b822e521 100644 --- a/app/serializers/rest/account_serializer.rb +++ b/app/serializers/rest/account_serializer.rb @@ -15,7 +15,7 @@ class REST::AccountSerializer < ActiveModel::Serializer has_many :emojis, serializer: REST::CustomEmojiSerializer - attribute :suspended, if: :suspended? + attribute :suspended, if: :unavailable? attribute :silenced, key: :limited, if: :silenced? attribute :noindex, if: :local? @@ -164,7 +164,7 @@ class REST::AccountSerializer < ActiveModel::Serializer object.user_prefers_noindex? end - delegate :suspended?, :silenced?, :local?, :memorial?, to: :object + delegate :unavailable?, :silenced?, :local?, :memorial?, to: :object def moved_and_not_nested? object.moved? diff --git a/app/services/delete_account_service.rb b/app/services/delete_account_service.rb index e9ae117ceb..a9ecc8be98 100644 --- a/app/services/delete_account_service.rb +++ b/app/services/delete_account_service.rb @@ -226,9 +226,14 @@ class DeleteAccountService < BaseService return unless keep_account_record? + if @options[:suspended_at] + @account.suspended_at = @options[:suspended_at] + @account.suspension_origin = :local + else + @account.requested_deletion_at ||= Time.now.utc + end + @account.silenced_at = nil - @account.suspended_at = @options[:suspended_at] || Time.now.utc - @account.suspension_origin = :local @account.locked = false @account.memorial = false @account.discoverable = false diff --git a/app/views/admin/accounts/_buttons.html.haml b/app/views/admin/accounts/_buttons.html.haml index 2aaca8962c..5564d27251 100644 --- a/app/views/admin/accounts/_buttons.html.haml +++ b/app/views/admin/accounts/_buttons.html.haml @@ -8,6 +8,10 @@ = link_to t('admin.accounts.redownload'), redownload_admin_account_path(account.id), method: :post, class: 'button' if can?(:redownload, account) && account.suspension_origin_remote? - if deletion_request.present? && can?(:destroy, account) = link_to t('admin.accounts.delete'), admin_account_path(account.id), method: :delete, class: 'button button--destructive', data: { confirm: t('admin.accounts.are_you_sure') } +- elsif account.deleted? + %hr.spacer/ + + %p.muted-hint= deletion_request.present? ? t('admin.accounts.deletion_reversible_hint_html', date: content_tag(:strong, l(deletion_request.due_at.to_date))) : t('admin.accounts.deletion_irreversible') - else .action-buttons %div diff --git a/app/views/admin/accounts/_counters.html.haml b/app/views/admin/accounts/_counters.html.haml index 3c99da9f2c..94946d54e2 100644 --- a/app/views/admin/accounts/_counters.html.haml +++ b/app/views/admin/accounts/_counters.html.haml @@ -22,12 +22,12 @@ %div = link_to admin_action_logs_path(target_account_id: account.id) do .dashboard__counters__text - - if account.local? && account.user.nil? + - if account.suspended? + = t('admin.accounts.suspended') + - elsif account.deleted? || (account.local? && account.user.nil?) = t('admin.accounts.deleted') - elsif account.memorial? = t('admin.accounts.memorialized') - - elsif account.suspended? - = t('admin.accounts.suspended') - elsif account.silenced? = t('admin.accounts.silenced') - elsif account.local? && account.user_disabled? diff --git a/app/views/admin/reports/index.html.haml b/app/views/admin/reports/index.html.haml index b6b25c190e..4ce0de4d24 100644 --- a/app/views/admin/reports/index.html.haml +++ b/app/views/admin/reports/index.html.haml @@ -39,6 +39,8 @@ %br/ - if target_account.suspended? %span.red= t('admin.accounts.suspended') + - elsif target_account.deleted? + %span.red= t('admin.accounts.deleted') - elsif target_account.silenced? %span.red= t('admin.accounts.silenced') - elsif target_account.user_disabled? diff --git a/app/workers/scheduler/self_destruct_scheduler.rb b/app/workers/scheduler/self_destruct_scheduler.rb index 4d8ee2cd85..05bca4f540 100644 --- a/app/workers/scheduler/self_destruct_scheduler.rb +++ b/app/workers/scheduler/self_destruct_scheduler.rb @@ -36,7 +36,7 @@ class Scheduler::SelfDestructScheduler # deletion request. # This targets accounts that have not been deleted nor marked for deletion yet - Account.local.without_suspended.reorder(id: :asc).take(MAX_ACCOUNT_DELETIONS_PER_JOB).each do |account| + Account.local.without_requested_deletion.reorder(id: :asc).take(MAX_ACCOUNT_DELETIONS_PER_JOB).each do |account| delete_account!(account) end @@ -44,9 +44,8 @@ class Scheduler::SelfDestructScheduler # This targets accounts that have been marked for deletion but have not been # deleted yet - Account.local.suspended.joins(:deletion_request).take(MAX_ACCOUNT_DELETIONS_PER_JOB).each do |account| + Account.local.joins(:deletion_request).take(MAX_ACCOUNT_DELETIONS_PER_JOB).each do |account| delete_account!(account) - account.deletion_request&.destroy end end @@ -64,8 +63,9 @@ class Scheduler::SelfDestructScheduler [json, account.id, inbox_url] end - # Do not call `Account#suspend!` because we don't want to issue a deletion request - account.update!(suspended_at: Time.now.utc, suspension_origin: :local) + # Do not call `Account#mark_deleted!` because we don't want to issue a deletion request + account.update!(requested_deletion_at: Time.now.utc) + account.deletion_request&.destroy end def deletion_payload(account) diff --git a/config/locales/en.yml b/config/locales/en.yml index 8b3aca6b68..0b9115aba1 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -64,6 +64,8 @@ en: custom: Custom delete: Delete data deleted: Deleted + deletion_irreversible: The data of this account has been irreversibly deleted. + deletion_reversible_hint_html: This account is pending deletion, and the data will be fully removed on %{date}. demote: Demote destroyed_msg: "%{username}'s data is now queued to be deleted imminently" disable: Freeze diff --git a/db/migrate/20260728124057_add_requested_deletion_at_to_accounts.rb b/db/migrate/20260728124057_add_requested_deletion_at_to_accounts.rb new file mode 100644 index 0000000000..85fd7d0e61 --- /dev/null +++ b/db/migrate/20260728124057_add_requested_deletion_at_to_accounts.rb @@ -0,0 +1,7 @@ +# frozen_string_literal: true + +class AddRequestedDeletionAtToAccounts < ActiveRecord::Migration[8.0] + def change + add_column :accounts, :requested_deletion_at, :datetime + end +end diff --git a/db/migrate/20260728145403_update_account_summaries_to_version_3.rb b/db/migrate/20260728145403_update_account_summaries_to_version_3.rb new file mode 100644 index 0000000000..748ba16a5b --- /dev/null +++ b/db/migrate/20260728145403_update_account_summaries_to_version_3.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +class UpdateAccountSummariesToVersion3 < ActiveRecord::Migration[8.0] + def up + reapplication_global_follow_recommendations_v1 do + drop_view :account_summaries, materialized: true + create_view :account_summaries, version: 3, materialized: { no_data: true } + safety_assured { add_index :account_summaries, :account_id, unique: true } + end + end + + def down + reapplication_global_follow_recommendations_v1 do + drop_view :account_summaries, materialized: true + create_view :account_summaries, version: 2, materialized: { no_data: true } + safety_assured { add_index :account_summaries, :account_id, unique: true } + end + end + + def reapplication_global_follow_recommendations_v1 + drop_view :global_follow_recommendations, materialized: true + yield + create_view :global_follow_recommendations, version: 1, materialized: { no_data: true } + safety_assured { add_index :global_follow_recommendations, :account_id, unique: true } + end +end diff --git a/db/post_migrate/20260728145507_backfill_account_requested_deletion_at.rb b/db/post_migrate/20260728145507_backfill_account_requested_deletion_at.rb new file mode 100644 index 0000000000..9c0b4583a5 --- /dev/null +++ b/db/post_migrate/20260728145507_backfill_account_requested_deletion_at.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +class BackfillAccountRequestedDeletionAt < ActiveRecord::Migration[8.1] + def up + safety_assured do + execute <<~SQL + UPDATE + accounts + SET + requested_deletion_at = suspended_at, suspended_at = NULL, suspension_origin = NULL + WHERE + -- rule out remote accounts, as deleted remote accounts are deleted locally + domain IS NULL + -- only care about accounts marked as suspended (which prior to this migration applies to both suspended and self-deleted accounts) + AND suspended_at IS NOT NULL + -- rule accounts that were not self-deleted (might still include suspended but self-deleted accounts) + AND NOT EXISTS (SELECT 1 FROM users WHERE account_id = accounts.id) AND NOT EXISTS (SELECT 1 FROM canonical_email_blocks WHERE reference_account_id = accounts.id) + -- rule out accounts that have a canonical email block: sign they were suspended and not unsuspended + AND NOT EXISTS (SELECT 1 FROM canonical_email_blocks WHERE reference_account_id = accounts.id) + SQL + end + end + + def down + safety_assured do + execute 'UPDATE accounts SET suspended_at = requested_deletion_at WHERE domain is NULL AND suspended_at IS NULL AND requested_deletion_at IS NOT NULL' + end + end +end diff --git a/db/schema.rb b/db/schema.rb index 4062dba353..69310f47e7 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -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_20_124731) do +ActiveRecord::Schema[8.1].define(version: 2026_07_28_145507) do # These are extensions that must be enabled in order to support this database enable_extension "pg_catalog.plpgsql" @@ -192,6 +192,7 @@ ActiveRecord::Schema[8.1].define(version: 2026_07_20_124731) do t.text "private_key" t.integer "protocol", default: 0, null: false t.text "public_key", default: "", null: false + t.datetime "requested_deletion_at" t.datetime "requested_review_at", precision: nil t.datetime "reviewed_at", precision: nil t.datetime "sensitized_at", precision: nil @@ -1632,10 +1633,9 @@ ActiveRecord::Schema[8.1].define(version: 2026_07_20_124731) do WHERE ((statuses.account_id = accounts.id) AND (statuses.deleted_at IS NULL) AND (statuses.reblog_of_id IS NULL)) ORDER BY statuses.id DESC LIMIT 20) t0) - WHERE ((accounts.suspended_at IS NULL) AND (accounts.silenced_at IS NULL) AND (accounts.moved_to_account_id IS NULL) AND (accounts.discoverable = true) AND (accounts.locked = false)) + WHERE ((accounts.suspended_at IS NULL) AND (accounts.requested_deletion_at IS NULL) AND (accounts.silenced_at IS NULL) AND (accounts.moved_to_account_id IS NULL) AND (accounts.discoverable = true) AND (accounts.locked = false)) GROUP BY accounts.id; SQL - add_index "account_summaries", ["account_id", "language", "sensitive"], name: "idx_on_account_id_language_sensitive_250461e1eb" add_index "account_summaries", ["account_id"], name: "index_account_summaries_on_account_id", unique: true create_view "global_follow_recommendations", materialized: true, sql_definition: <<-SQL diff --git a/db/views/account_summaries_v03.sql b/db/views/account_summaries_v03.sql new file mode 100644 index 0000000000..bcccb10dcf --- /dev/null +++ b/db/views/account_summaries_v03.sql @@ -0,0 +1,24 @@ +SELECT + accounts.id AS account_id, + mode() WITHIN GROUP (ORDER BY language ASC) AS language, + mode() WITHIN GROUP (ORDER BY sensitive ASC) AS sensitive +FROM accounts +CROSS JOIN LATERAL ( + SELECT + statuses.account_id, + statuses.language, + statuses.sensitive + FROM statuses + WHERE statuses.account_id = accounts.id + AND statuses.deleted_at IS NULL + AND statuses.reblog_of_id IS NULL + ORDER BY statuses.id DESC + LIMIT 20 +) t0 +WHERE accounts.suspended_at IS NULL + AND accounts.requested_deletion_at IS NULL + AND accounts.silenced_at IS NULL + AND accounts.moved_to_account_id IS NULL + AND accounts.discoverable = 't' + AND accounts.locked = 'f' +GROUP BY accounts.id diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index e5ca6ac2ac..e9b7d6a6b4 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -66,9 +66,9 @@ namespace :db do abort 'This version of Mastodon requires PostgreSQL 14.0 or newer. Please update PostgreSQL before updating Mastodon.' if pg_version < 140_000 schema_version = ActiveRecord::Migrator.current_version - abort <<~MESSAGE if ENV['SKIP_POST_DEPLOYMENT_MIGRATIONS'] && schema_version < 2023_09_07_150100 - Zero-downtime migrations from Mastodon versions earlier than 4.2.0 are not supported. - Please update to Mastodon 4.2.x first or upgrade by stopping all services and running migrations without `SKIP_POST_DEPLOYMENT_MIGRATIONS`. + abort <<~MESSAGE if ENV['SKIP_POST_DEPLOYMENT_MIGRATIONS'] && schema_version < 2024_10_07_071624 + Zero-downtime migrations from Mastodon versions earlier than 4.3.0 are not supported. + Please update to Mastodon 4.3.x first or upgrade by stopping all services and running migrations without `SKIP_POST_DEPLOYMENT_MIGRATIONS`. MESSAGE end diff --git a/lib/tasks/tests.rake b/lib/tasks/tests.rake index 73fa2dfd22..238a5025ac 100644 --- a/lib/tasks/tests.rake +++ b/lib/tasks/tests.rake @@ -117,6 +117,21 @@ namespace :tests do exit(1) end + unless Account.find_by(username: 'suspended', domain: nil).suspended? + puts 'Unexpected value for Account#suspended? for user @suspended' + exit(1) + end + + if Account.find_by(username: 'deleted', domain: nil).suspended? + puts 'Unexpected value for Account#suspended? for user @deleted' + exit(1) + end + + unless Account.find_by(username: 'deleted', domain: nil).deleted? + puts 'Unexpected value for Account#deleted? for user @deleted' + exit(1) + end + unless Identity.where(provider: 'foo', uid: 0).one? puts 'Identities not deduplicated as expected' exit(1) @@ -226,11 +241,11 @@ namespace :tests do INSERT INTO "accounts" (id, username, domain, uri, private_key, public_key, created_at, updated_at, last_webfingered_at) VALUES - (12, 'alice', 'social.example.com', 'https://social.example.com/alice', NULL, #{user_public_key}, '2021-01-01'::date, now(), '2021-01-09'::date), - (13, 'alice', 'example.com', 'https://social.example.com/alice', NULL, #{user_public_key}, '2021-01-10'::date, now(), '2021-01-11'::date), - (14, 'bogus1', 'example.com', '', NULL, '', now(), now(), now()), - (15, 'bogus2', 'example.com', '', NULL, '', now(), now(), now()), - (16, 'bogus3', 'example.com', '', NULL, '', now(), now(), now()); + (14, 'alice', 'social.example.com', 'https://social.example.com/alice', NULL, #{user_public_key}, '2021-01-01'::date, now(), '2021-01-09'::date), + (15, 'alice', 'example.com', 'https://social.example.com/alice', NULL, #{user_public_key}, '2021-01-10'::date, now(), '2021-01-11'::date), + (16, 'bogus1', 'example.com', '', NULL, '', now(), now(), now()), + (17, 'bogus2', 'example.com', '', NULL, '', now(), now(), now()), + (18, 'bogus3', 'example.com', '', NULL, '', now(), now(), now()); SQL end @@ -291,20 +306,20 @@ namespace :tests do INSERT INTO "accounts" (id, username, domain, private_key, public_key, created_at, updated_at) VALUES - (10, 'kmruser', NULL, #{user_private_key}, #{user_public_key}, now(), now()), - (11, 'qcuser', NULL, #{user_private_key}, #{user_public_key}, now(), now()); + (12, 'kmruser', NULL, #{user_private_key}, #{user_public_key}, now(), now()), + (13, 'qcuser', NULL, #{user_private_key}, #{user_public_key}, now(), now()); INSERT INTO "users" (id, account_id, email, created_at, updated_at, admin, locale, chosen_languages) VALUES - (4, 10, 'kmruser@localhost', now(), now(), false, 'ku', '{en,kmr,ku,ckb}'); + (5, 12, 'kmruser@localhost', now(), now(), false, 'ku', '{en,kmr,ku,ckb}'); INSERT INTO "users" (id, account_id, email, created_at, updated_at, locale, encrypted_otp_secret, encrypted_otp_secret_iv, encrypted_otp_secret_salt, otp_required_for_login) VALUES - (5, 11, 'qcuser@localhost', now(), now(), 'fr-QC', + (6, 13, 'qcuser@localhost', now(), now(), 'fr-QC', E'Fttsy7QAa0edaDfdfSz094rRLAxc8cJweDQ4BsWH/zozcdVA8o9GLqcKhn2b\nGi/V\n', 'rys3THICkr60BoWC', '_LMkAGvdg7a+sDIKjI3mR2Q==', @@ -313,7 +328,7 @@ namespace :tests do INSERT INTO "settings" (id, thing_type, thing_id, var, value, created_at, updated_at) VALUES - (5, 'User', 4, 'default_language', E'--- kmr\n', now(), now()), + (5, 'User', 5, 'default_language', E'--- kmr\n', now(), now()), (6, 'User', 1, 'interactions', E'--- !ruby/hash:ActiveSupport::HashWithIndifferentAccess\nmust_be_follower: false\nmust_be_following: true\nmust_be_following_dm: false\n', now(), now()); INSERT INTO "identities" @@ -390,18 +405,25 @@ namespace :tests do 'https://activitypub.com/users/evil/inbox', 'https://activitypub.com/users/evil/outbox', 'https://activitypub.com/users/evil/followers', true); + INSERT INTO "accounts" + (id, username, domain, private_key, public_key, created_at, updated_at, suspended) + VALUES + (10, 'suspended', NULL, #{admin_private_key}, #{admin_public_key}, now(), now(), true), + (11, 'deleted', NULL, #{user_private_key}, #{user_public_key}, now(), now(), true); + -- users INSERT INTO "users" (id, account_id, email, created_at, updated_at, admin) VALUES (1, 1, 'admin@localhost', now(), now(), true), - (2, 2, 'user@localhost', now(), now(), false); + (2, 2, 'user@localhost', now(), now(), false), + (3, 10, 'suspended@localhost', now(), now(), false); INSERT INTO "users" (id, account_id, email, created_at, updated_at, admin, locale) VALUES - (3, 8, 'ptuser@localhost', now(), now(), false, 'pt'); + (4, 8, 'ptuser@localhost', now(), now(), false, 'pt'); -- conversations INSERT INTO "conversations" (id, created_at, updated_at) VALUES (1, now(), now()); diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index 898edb3e23..a0365eb5c9 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -54,7 +54,7 @@ RSpec.describe ApplicationController do end end - describe 'before_action :check_suspension' do + describe 'before_action :require_functional!' do before do routes.draw { get 'success' => 'anonymous#success' } end @@ -64,17 +64,29 @@ RSpec.describe ApplicationController do expect(response).to have_http_status(200) end - it 'does nothing if user who signed in is not suspended' do + it 'does nothing if user who signed in is functional' do sign_in(Fabricate(:account, suspended: false).user) get 'success' expect(response).to have_http_status(200) end - it 'redirects to account status page' do + it 'redirects to account status page if the account is suspended' do sign_in(Fabricate(:account, suspended: true).user) get 'success' expect(response).to redirect_to(edit_user_registration_path) end + + it 'redirects to account status page if the account is pending deletion' do + sign_in(Fabricate(:account, requested_deletion: true).user) + get 'success' + expect(response).to redirect_to(edit_user_registration_path) + end + + it 'redirects to auth setup page if the account is unconfirmed' do + sign_in(Fabricate(:user, confirmed_at: nil)) + get 'success' + expect(response).to redirect_to(auth_setup_path) + end end describe 'raise_not_found' do diff --git a/spec/controllers/auth/registrations_controller_spec.rb b/spec/controllers/auth/registrations_controller_spec.rb index 6531608a01..3b474dc2ea 100644 --- a/spec/controllers/auth/registrations_controller_spec.rb +++ b/spec/controllers/auth/registrations_controller_spec.rb @@ -141,6 +141,15 @@ RSpec.describe Auth::RegistrationsController do expect(response).to have_http_status(403) end end + + context 'when deleted' do + let(:user) { Fabricate(:user, account_attributes: { username: 'test', requested_deletion_at: Time.now.utc }) } + + it 'returns http forbidden' do + put :update + expect(response).to have_http_status(403) + end + end end describe 'GET #new' do diff --git a/spec/controllers/auth/sessions_controller_spec.rb b/spec/controllers/auth/sessions_controller_spec.rb index d8d640a058..88c5f508d5 100644 --- a/spec/controllers/auth/sessions_controller_spec.rb +++ b/spec/controllers/auth/sessions_controller_spec.rb @@ -48,6 +48,19 @@ RSpec.describe Auth::SessionsController do expect(response).to redirect_to(new_user_session_path) end end + + context 'with a deleted user' do + before do + user.account.mark_deleted! + end + + it 'redirects to home after sign out' do + sign_in(user, scope: :user) + delete :destroy + + expect(response).to redirect_to(new_user_session_path) + end + end end describe 'POST #create' do diff --git a/spec/controllers/concerns/account_controller_concern_spec.rb b/spec/controllers/concerns/account_controller_concern_spec.rb index 2f7e230d48..ace3d8e93b 100644 --- a/spec/controllers/concerns/account_controller_concern_spec.rb +++ b/spec/controllers/concerns/account_controller_concern_spec.rb @@ -33,7 +33,7 @@ RSpec.describe AccountControllerConcern do end end - context 'when account is suspended' do + context 'when account is permanently suspended' do it 'returns http gone' do account = Fabricate(:account, suspended: true) get 'success', params: { account_username: account.username } @@ -41,14 +41,32 @@ RSpec.describe AccountControllerConcern do end end - context 'when account is deleted by owner' do + context 'when account is temporarily suspended' do + it 'returns http forbidden' do + account = Fabricate(:account) + account.suspend! + get 'success', params: { account_username: account.username } + expect(response).to have_http_status(403) + end + end + + context 'when account is permanently deleted' do it 'returns http gone' do - account = Fabricate(:account, suspended: true, user: nil) + account = Fabricate(:account, requested_deletion: true) get 'success', params: { account_username: account.username } expect(response).to have_http_status(410) end end + context 'when account is pending deletion' do + it 'returns http forbidden' do + account = Fabricate(:account) + account.mark_deleted! + get 'success', params: { account_username: account.username } + expect(response).to have_http_status(403) + end + end + context 'when account is not suspended' do let(:account) { Fabricate(:account, username: 'username') } diff --git a/spec/controllers/following_accounts_controller_spec.rb b/spec/controllers/following_accounts_controller_spec.rb index 7f11a50395..ba514eb8bd 100644 --- a/spec/controllers/following_accounts_controller_spec.rb +++ b/spec/controllers/following_accounts_controller_spec.rb @@ -36,6 +36,27 @@ RSpec.describe FollowingAccountsController do expect(response).to have_http_status(403) end end + + context 'when account is permanently deleted' do + before do + alice.mark_deleted! + alice.deletion_request.destroy + end + + it 'returns http gone' do + expect(response).to have_http_status(410) + end + end + + context 'when account is pending deletion' do + before do + alice.mark_deleted! + end + + it 'returns http forbidden' do + expect(response).to have_http_status(403) + end + end end context 'when format is json' do @@ -108,6 +129,27 @@ RSpec.describe FollowingAccountsController do expect(response).to have_http_status(403) end end + + context 'when account is permanently deleted' do + before do + alice.mark_deleted! + alice.deletion_request.destroy + end + + it 'returns http gone' do + expect(response).to have_http_status(410) + end + end + + context 'when account is pending deletion' do + before do + alice.mark_deleted! + end + + it 'returns http forbidden' do + expect(response).to have_http_status(403) + end + end end context 'without page' do @@ -161,6 +203,27 @@ RSpec.describe FollowingAccountsController do expect(response).to have_http_status(403) end end + + context 'when account is permanently deleted' do + before do + alice.mark_deleted! + alice.deletion_request.destroy + end + + it 'returns http gone' do + expect(response).to have_http_status(410) + end + end + + context 'when account is pending deletion' do + before do + alice.mark_deleted! + end + + it 'returns http forbidden' do + expect(response).to have_http_status(403) + end + end end end end diff --git a/spec/fabricators/account_fabricator.rb b/spec/fabricators/account_fabricator.rb index 4280b7f7d6..6a5218cee9 100644 --- a/spec/fabricators/account_fabricator.rb +++ b/spec/fabricators/account_fabricator.rb @@ -3,17 +3,18 @@ require_relative '../support/signing_keys_helpers' Fabricator(:account) do - transient :suspended, :silenced, :legacy_keypair - username { sequence(:username) { |i| "#{Faker::Internet.user_name(separators: %w(_))}#{i}" } } - last_webfingered_at { Time.now.utc } - public_key { |attrs| attrs[:legacy_keypair] ? SigningKeysHelpers::PUBLIC_RSA_TEST_KEY : '' } - private_key { |attrs| attrs[:legacy_keypair] && attrs[:domain].nil? ? SigningKeysHelpers::PRIVATE_RSA_TEST_KEY : nil } - suspended_at { |attrs| attrs[:suspended] ? Time.now.utc : nil } - silenced_at { |attrs| attrs[:silenced] ? Time.now.utc : nil } - user { |attrs| attrs[:domain].nil? ? Fabricate.build(:user, account: nil) : nil } - uri { |attrs| attrs[:domain].nil? ? nil : "https://#{attrs[:domain]}/users/#{attrs[:username]}" } - discoverable true - indexable true + transient :suspended, :silenced, :legacy_keypair, :requested_deletion + username { sequence(:username) { |i| "#{Faker::Internet.user_name(separators: %w(_))}#{i}" } } + last_webfingered_at { Time.now.utc } + public_key { |attrs| attrs[:legacy_keypair] ? SigningKeysHelpers::PUBLIC_RSA_TEST_KEY : '' } + private_key { |attrs| attrs[:legacy_keypair] && attrs[:domain].nil? ? SigningKeysHelpers::PRIVATE_RSA_TEST_KEY : nil } + suspended_at { |attrs| attrs[:suspended] ? Time.now.utc : nil } + silenced_at { |attrs| attrs[:silenced] ? Time.now.utc : nil } + requested_deletion_at { |attrs| attrs[:requested_deletion] ? Time.now.utc : nil } + user { |attrs| attrs[:domain].nil? ? Fabricate.build(:user, account: nil) : nil } + uri { |attrs| attrs[:domain].nil? ? nil : "https://#{attrs[:domain]}/users/#{attrs[:username]}" } + discoverable true + indexable true # This is not strictly needed but this avoids generating multiple keys # and, when `store_private_key` is passed, stores private keys for use in request specs diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 35f0b98761..708c2a02d9 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -74,16 +74,19 @@ RSpec.describe User do end end - describe 'account_not_suspended' do + describe 'account_available' do it 'returns with linked accounts that are not suspended' do suspended_account = Fabricate(:account, suspended_at: 10.days.ago) non_suspended_account = Fabricate(:account, suspended_at: nil) suspended_user = Fabricate(:user, account: suspended_account) non_suspended_user = Fabricate(:user, account: non_suspended_account) + deleted_account = Fabricate(:account, requested_deletion_at: 10.days.ago) + deleted_user = Fabricate(:user, account: deleted_account) - expect(described_class.account_not_suspended) + expect(described_class.account_available) .to include(non_suspended_user) .and not_include(suspended_user) + .and not_include(deleted_user) end end diff --git a/spec/requests/accounts_spec.rb b/spec/requests/accounts_spec.rb index cd67e89d45..26f8f577b0 100644 --- a/spec/requests/accounts_spec.rb +++ b/spec/requests/accounts_spec.rb @@ -62,6 +62,33 @@ RSpec.describe 'Accounts show response' do end end + describe 'permanently deleted account check' do + before do + account.mark_deleted! + account.deletion_request.destroy + end + + it 'returns appropriate http response code' do + { html: 410, json: 410, rss: 410 }.each do |format, code| + get short_account_path(username: account.username), as: format + + expect(response).to have_http_status(code) + end + end + end + + describe 'pending deletion account check' do + before { account.mark_deleted! } + + it 'returns appropriate http response code' do + { html: 403, json: 403, rss: 403 }.each do |format, code| + get short_account_path(username: account.username), as: format + + expect(response).to have_http_status(code) + end + end + end + describe 'GET to short username paths' do context 'with existing statuses' do context 'with HTML' do diff --git a/spec/requests/activitypub/collections_spec.rb b/spec/requests/activitypub/collections_spec.rb index 39bd2252e7..b10f7c868b 100644 --- a/spec/requests/activitypub/collections_spec.rb +++ b/spec/requests/activitypub/collections_spec.rb @@ -62,6 +62,33 @@ RSpec.describe 'ActivityPub Collections' do .to have_http_status(403) end end + + context 'when account is permanently deleted' do + before do + account.mark_deleted! + account.deletion_request.destroy + end + + it 'returns http gone' do + subject + + expect(response) + .to have_http_status(410) + end + end + + context 'when account is pending deletion' do + before do + account.mark_deleted! + end + + it 'returns http forbidden' do + subject + + expect(response) + .to have_http_status(403) + end + end end context 'with signature' do diff --git a/spec/requests/activitypub/inboxes_spec.rb b/spec/requests/activitypub/inboxes_spec.rb index fd013f38d6..fd9f9ad554 100644 --- a/spec/requests/activitypub/inboxes_spec.rb +++ b/spec/requests/activitypub/inboxes_spec.rb @@ -62,6 +62,33 @@ RSpec.describe 'ActivityPub Inboxes' do .to have_http_status(202) end end + + context 'when account is permanently deleted' do + before do + account.mark_deleted! + account.deletion_request.destroy + end + + it 'returns http gone' do + subject + + expect(response) + .to have_http_status(410) + end + end + + context 'when account is pending deletion' do + before do + account.mark_deleted! + end + + it 'returns http accepted' do + subject + + expect(response) + .to have_http_status(202) + end + end end end diff --git a/spec/requests/activitypub/outboxes_spec.rb b/spec/requests/activitypub/outboxes_spec.rb index cb6c460f9e..b2af762ed9 100644 --- a/spec/requests/activitypub/outboxes_spec.rb +++ b/spec/requests/activitypub/outboxes_spec.rb @@ -61,6 +61,33 @@ RSpec.describe 'ActivityPub Outboxes' do .to have_http_status(403) end end + + context 'when account is permanently deleted' do + before do + account.mark_deleted! + account.deletion_request.destroy + end + + it 'returns http gone' do + subject + + expect(response) + .to have_http_status(410) + end + end + + context 'when account is pending deletion' do + before do + account.mark_deleted! + end + + it 'returns http forbidden' do + subject + + expect(response) + .to have_http_status(403) + end + end end context 'with page requested' do @@ -110,6 +137,33 @@ RSpec.describe 'ActivityPub Outboxes' do .to have_http_status(403) end end + + context 'when account is permanently deleted' do + before do + account.mark_deleted! + account.deletion_request.destroy + end + + it 'returns http gone' do + subject + + expect(response) + .to have_http_status(410) + end + end + + context 'when account is pending deletion' do + before do + account.mark_deleted! + end + + it 'returns http forbidden' do + subject + + expect(response) + .to have_http_status(403) + end + end end end diff --git a/spec/requests/activitypub/replies_spec.rb b/spec/requests/activitypub/replies_spec.rb index 95bc1afe61..a002f702af 100644 --- a/spec/requests/activitypub/replies_spec.rb +++ b/spec/requests/activitypub/replies_spec.rb @@ -77,6 +77,37 @@ RSpec.describe 'ActivityPub Replies' do end end + context 'when account is permanently deleted' do + let(:parent_visibility) { :public } + + before do + status.account.mark_deleted! + status.account.deletion_request.destroy + end + + it 'returns http gone' do + subject + + expect(response) + .to have_http_status(410) + end + end + + context 'when account is pending deletion' do + let(:parent_visibility) { :public } + + before do + status.account.mark_deleted! + end + + it 'returns http forbidden' do + subject + + expect(response) + .to have_http_status(403) + end + end + context 'when status is public' do let(:parent_visibility) { :public } diff --git a/spec/requests/api/v1/accounts/follower_accounts_spec.rb b/spec/requests/api/v1/accounts/follower_accounts_spec.rb index 1f0779701b..ed21769aa8 100644 --- a/spec/requests/api/v1/accounts/follower_accounts_spec.rb +++ b/spec/requests/api/v1/accounts/follower_accounts_spec.rb @@ -66,5 +66,30 @@ RSpec.describe 'API V1 Accounts FollowerAccounts' do ) end end + + context 'when request account is permanently deleted' do + before do + account.mark_deleted! + account.deletion_request.destroy + end + + it 'returns http not found' do + get "/api/v1/accounts/#{account.id}/followers", params: { limit: 2 }, headers: headers + + expect(response).to have_http_status(404) + end + end + + context 'when request account is pending deletion' do + before do + account.mark_deleted! + end + + it 'returns http not found' do + get "/api/v1/accounts/#{account.id}/followers", params: { limit: 2 }, headers: headers + + expect(response).to have_http_status(404) + end + end end end diff --git a/spec/requests/api/v1/accounts/following_accounts_spec.rb b/spec/requests/api/v1/accounts/following_accounts_spec.rb index 193cf2196f..4df93c5cfe 100644 --- a/spec/requests/api/v1/accounts/following_accounts_spec.rb +++ b/spec/requests/api/v1/accounts/following_accounts_spec.rb @@ -66,5 +66,30 @@ RSpec.describe 'API V1 Accounts FollowingAccounts' do ) end end + + context 'when request account is permanently deleted' do + before do + account.mark_deleted! + account.deletion_request.destroy + end + + it 'returns http not found' do + get "/api/v1/accounts/#{account.id}/following", params: { limit: 2 }, headers: headers + + expect(response).to have_http_status(404) + end + end + + context 'when request account is pending deletion' do + before do + account.mark_deleted! + end + + it 'returns http not found' do + get "/api/v1/accounts/#{account.id}/following", params: { limit: 2 }, headers: headers + + expect(response).to have_http_status(404) + end + end end end diff --git a/spec/requests/api/v1/accounts/lists_spec.rb b/spec/requests/api/v1/accounts/lists_spec.rb index 63b1dc7816..4e2dc65365 100644 --- a/spec/requests/api/v1/accounts/lists_spec.rb +++ b/spec/requests/api/v1/accounts/lists_spec.rb @@ -22,4 +22,29 @@ RSpec.describe 'Accounts Lists API' do .to start_with('application/json') end end + + context 'when requested account is permanently deleted' do + before do + account.mark_deleted! + account.deletion_request.destroy + end + + it 'returns http not found' do + get "/api/v1/accounts/#{account.id}/lists", headers: headers + + expect(response).to have_http_status(404) + end + end + + context 'when requested account is pending deletion' do + before do + account.mark_deleted! + end + + it 'returns http not found' do + get "/api/v1/accounts/#{account.id}/lists", headers: headers + + expect(response).to have_http_status(404) + end + end end diff --git a/spec/requests/api/v1/accounts/statuses_spec.rb b/spec/requests/api/v1/accounts/statuses_spec.rb index 6ba3b47ff0..7202558f50 100644 --- a/spec/requests/api/v1/accounts/statuses_spec.rb +++ b/spec/requests/api/v1/accounts/statuses_spec.rb @@ -152,5 +152,34 @@ RSpec.describe 'API V1 Accounts Statuses' do end end end + + context 'when requested account is permanently deleted' do + let(:account) { Fabricate(:account) } + + before do + account.mark_deleted! + account.deletion_request.destroy + end + + it 'returns http not found' do + get "/api/v1/accounts/#{account.id}/statuses", params: { limit: 2 }, headers: headers + + expect(response).to have_http_status(404) + end + end + + context 'when requested account is pending deletion' do + let(:account) { Fabricate(:account) } + + before do + account.mark_deleted! + end + + it 'returns http not found' do + get "/api/v1/accounts/#{account.id}/statuses", params: { limit: 2 }, headers: headers + + expect(response).to have_http_status(404) + end + end end end diff --git a/spec/requests/api/v1/accounts_spec.rb b/spec/requests/api/v1/accounts_spec.rb index 0ea5c3921e..6d6b8f7db5 100644 --- a/spec/requests/api/v1/accounts_spec.rb +++ b/spec/requests/api/v1/accounts_spec.rb @@ -48,6 +48,31 @@ RSpec.describe '/api/v1/accounts' do end end + context 'when requesting a permanently deleted account' do + let(:other_account) { Fabricate(:account, requested_deletion: true) } + + before do + get "/api/v1/accounts/#{other_account.id}" + end + + it 'returns http not found' do + expect(response).to have_http_status(404) + end + end + + context 'when requesting an account pending deletion' do + let(:other_account) { Fabricate(:account) } + + before do + other_account.mark_deleted! + get "/api/v1/accounts/#{other_account.id}" + end + + it 'returns http not found' do + expect(response).to have_http_status(404) + end + end + context 'when logged in' do subject do get "/api/v1/accounts/#{account.id}", headers: headers diff --git a/spec/requests/settings/deletes_spec.rb b/spec/requests/settings/deletes_spec.rb index c277181999..2b15fd7230 100644 --- a/spec/requests/settings/deletes_spec.rb +++ b/spec/requests/settings/deletes_spec.rb @@ -26,6 +26,17 @@ RSpec.describe 'Settings Deletes' do .to have_http_status(403) end end + + context 'when already deleted' do + let(:user) { Fabricate(:user, account_attributes: { requested_deletion_at: Time.now.utc }) } + + it 'returns http forbidden' do + delete settings_delete_path + + expect(response) + .to have_http_status(403) + end + end end context 'when not signed in' do @@ -54,6 +65,17 @@ RSpec.describe 'Settings Deletes' do .to include('private, no-store') end end + + context 'when already deleted' do + let(:user) { Fabricate(:user, account_attributes: { requested_deletion_at: Time.now.utc }) } + + it 'returns http forbidden' do + get settings_delete_path + + expect(response) + .to have_http_status(403) + end + end end context 'when not signed in' do diff --git a/spec/requests/statuses_spec.rb b/spec/requests/statuses_spec.rb index d12f4f28cf..ec329739cf 100644 --- a/spec/requests/statuses_spec.rb +++ b/spec/requests/statuses_spec.rb @@ -33,6 +33,33 @@ RSpec.describe 'Statuses' do end end + context 'when account is permanently deleted' do + before do + account.mark_deleted! + account.deletion_request.destroy + end + + it 'returns http gone' do + get "/@#{account.username}/#{status.id}" + + expect(response) + .to have_http_status(410) + end + end + + context 'when account is temporarily deleted' do + before do + account.mark_deleted! + end + + it 'returns http forbidden' do + get "/@#{account.username}/#{status.id}" + + expect(response) + .to have_http_status(403) + end + end + context 'when status is a reblog' do let(:original_account) { Fabricate(:account, domain: 'example.com') } let(:original_status) { Fabricate(:status, account: original_account, url: 'https://example.com/123') } diff --git a/spec/requests/well_known/webfinger_spec.rb b/spec/requests/well_known/webfinger_spec.rb index 593cecbb89..9606a78a47 100644 --- a/spec/requests/well_known/webfinger_spec.rb +++ b/spec/requests/well_known/webfinger_spec.rb @@ -53,7 +53,18 @@ RSpec.describe 'The /.well-known/webfinger endpoint' do it_behaves_like 'a successful response' end - context 'when an account is permanently suspended or deleted' do + context 'when an account is pending deletion' do + let(:resource) { alice.to_webfinger_s } + + before do + alice.mark_deleted! + perform_request! + end + + it_behaves_like 'a successful response' + end + + context 'when an account is permanently suspended' do let(:resource) { alice.to_webfinger_s } before do @@ -67,6 +78,20 @@ RSpec.describe 'The /.well-known/webfinger endpoint' do end end + context 'when an account is permanently deleted' do + let(:resource) { alice.to_webfinger_s } + + before do + alice.mark_deleted! + alice.deletion_request.destroy + perform_request! + end + + it 'returns http gone' do + expect(response).to have_http_status(410) + end + end + context 'when an account is not found' do let(:resource) { 'acct:not@existing.com' } diff --git a/spec/services/account_search_service_spec.rb b/spec/services/account_search_service_spec.rb index 6295d2f8ff..a7a4ceae70 100644 --- a/spec/services/account_search_service_spec.rb +++ b/spec/services/account_search_service_spec.rb @@ -78,6 +78,15 @@ RSpec.describe AccountSearchService do expect(results).to eq [partial] end + it 'returns the fuzzy match first, and does not return deleted exacts' do + partial = Fabricate(:account, username: 'exactness') + Fabricate(:account, username: 'exact', requested_deletion: true) + results = subject.call('exact', nil, limit: 10) + + expect(results.size).to eq 1 + expect(results).to eq [partial] + end + it 'does not return suspended remote accounts' do Fabricate(:account, username: 'a', domain: 'remote', display_name: 'e', suspended: true) results = subject.call('a@example.com', nil, limit: 2) @@ -85,6 +94,14 @@ RSpec.describe AccountSearchService do expect(results.size).to eq 0 expect(results).to eq [] end + + it 'does not return deleted remote accounts' do + Fabricate(:account, username: 'a', domain: 'remote', display_name: 'e', requested_deletion: true) + results = subject.call('a@example.com', nil, limit: 2) + + expect(results.size).to eq 0 + expect(results).to eq [] + end end context 'when elasticsearch is enabled', :search do diff --git a/spec/services/notify_service_spec.rb b/spec/services/notify_service_spec.rb index df51bce8bf..bbb0674e0e 100644 --- a/spec/services/notify_service_spec.rb +++ b/spec/services/notify_service_spec.rb @@ -50,6 +50,11 @@ RSpec.describe NotifyService do expect { subject }.to_not change(Notification, :count) end + it 'does not notify when recipient is deleted' do + recipient.mark_deleted! + expect { subject }.to_not change(Notification, :count) + end + describe 'reblogs' do let(:status) { Fabricate(:status, account: Fabricate(:account)) } let(:activity) { Fabricate(:status, account: sender, reblog: status) } diff --git a/spec/system/settings/deletes_spec.rb b/spec/system/settings/deletes_spec.rb index 2a18a27694..e8acee73d7 100644 --- a/spec/system/settings/deletes_spec.rb +++ b/spec/system/settings/deletes_spec.rb @@ -27,10 +27,8 @@ RSpec.describe 'Settings Deletes' do .to have_text(I18n.t('deletes.success_msg')) expect(page) .to have_title(I18n.t('auth.login')) - expect(User.find_by(id: user.id)) - .to be_nil expect(user.account.reload) - .to be_suspended + .to be_deleted expect(CanonicalEmailBlock.block?(user.email)) .to be(false) end diff --git a/spec/workers/scheduler/self_destruct_scheduler_spec.rb b/spec/workers/scheduler/self_destruct_scheduler_spec.rb index 0ff0faf05a..bf9c989fcf 100644 --- a/spec/workers/scheduler/self_destruct_scheduler_spec.rb +++ b/spec/workers/scheduler/self_destruct_scheduler_spec.rb @@ -41,14 +41,14 @@ RSpec.describe Scheduler::SelfDestructScheduler do context 'when sidekiq is operational' do let!(:other_account) { Fabricate :account, inbox_url: 'https://host.example/inbox', domain: 'host.example', protocol: :activitypub } - it 'suspends local non-suspended accounts' do + it 'deletes local non-deleted accounts' do worker.perform - expect(account.reload.suspended_at).to_not be_nil + expect(account.reload.requested_deletion_at).to_not be_nil end - it 'suspends local suspended accounts marked for deletion' do - account.update(suspended_at: 10.days.ago) + it 'deletes local accounts marked for deletion' do + account.update(requested_deletion_at: 10.days.ago) deletion_request = Fabricate(:account_deletion_request, account: account) worker.perform @@ -56,7 +56,7 @@ RSpec.describe Scheduler::SelfDestructScheduler do expect(ActivityPub::DeliveryWorker) .to have_enqueued_sidekiq_job(match_json_values(type: 'Delete', signature: be_present), account.id, other_account.inbox_url) - expect(account.reload.suspended_at).to be > 1.day.ago + expect(account.reload.requested_deletion_at).to be > 1.day.ago expect { deletion_request.reload }.to raise_error(ActiveRecord::RecordNotFound) end end