From 0c163659913f1d9d02cd8b5e45913846f2039c96 Mon Sep 17 00:00:00 2001 From: Jake Anto <64896514+jake-anto@users.noreply.github.com> Date: Tue, 8 Oct 2024 02:03:14 +0530 Subject: [PATCH 01/47] Prefer native apps over PWA (#27254) --- app/serializers/manifest_serializer.rb | 27 +++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/app/serializers/manifest_serializer.rb b/app/serializers/manifest_serializer.rb index cf0164c24a..3496f329f8 100644 --- a/app/serializers/manifest_serializer.rb +++ b/app/serializers/manifest_serializer.rb @@ -8,7 +8,8 @@ class ManifestSerializer < ActiveModel::Serializer attributes :id, :name, :short_name, :icons, :theme_color, :background_color, :display, :start_url, :scope, - :share_target, :shortcuts + :share_target, :shortcuts, + :prefer_related_applications, :related_applications def id # This is set to `/home` because that was the old value of `start_url` and @@ -89,4 +90,28 @@ class ManifestSerializer < ActiveModel::Serializer }, ] end + + def prefer_related_applications + true + end + + def related_applications + [ + { + platform: 'play', + url: 'https://play.google.com/store/apps/details?id=org.joinmastodon.android', + id: 'org.joinmastodon.android', + }, + { + platform: 'itunes', + url: 'https://apps.apple.com/us/app/mastodon-for-iphone/id1571998974', + id: 'id1571998974', + }, + { + platform: 'f-droid', + url: 'https://f-droid.org/en/packages/org.joinmastodon.android/', + id: 'org.joinmastodon.android', + }, + ] + end end From c60d4ecc82ce3dd2f2a00eaccf5231f03f24c31d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2024 09:38:43 +0200 Subject: [PATCH 02/47] Update dependency @reduxjs/toolkit to v2.2.8 (#32296) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 35fca2f8ad..5fc15f27e0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3110,8 +3110,8 @@ __metadata: linkType: hard "@reduxjs/toolkit@npm:^2.0.1": - version: 2.2.7 - resolution: "@reduxjs/toolkit@npm:2.2.7" + version: 2.2.8 + resolution: "@reduxjs/toolkit@npm:2.2.8" dependencies: immer: "npm:^10.0.3" redux: "npm:^5.0.1" @@ -3125,7 +3125,7 @@ __metadata: optional: true react-redux: optional: true - checksum: 10c0/7761a91adac2b5e1d50a8163ba5441480bb86a3a80b7583037c27a88463394b132dd7592862fc2be03aa7ab98a6e1710549889986dc0d3f033c169a3ba2cb02e + checksum: 10c0/bf1356d71bfb82e5a181692c79c19b7bc19355260a9966f6562604c995f0cd0ce1154177ccd14095e8b319e73f64cfe86a4e46a83d24edba7876d4ae71fd5ae0 languageName: node linkType: hard From 562105c69a9166d3a7f8eb09f2221e3571697ba0 Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 8 Oct 2024 10:00:05 +0200 Subject: [PATCH 03/47] Fix source strings being uploaded to crowdin in merge groups (#32298) --- .github/workflows/crowdin-upload.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/crowdin-upload.yml b/.github/workflows/crowdin-upload.yml index 62ad1150bc..4f4d917d15 100644 --- a/.github/workflows/crowdin-upload.yml +++ b/.github/workflows/crowdin-upload.yml @@ -1,7 +1,6 @@ name: Crowdin / Upload translations on: - merge_group: push: branches: - 'main' From ff3e2c9cfa857b5091a9119337728bf972763856 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 8 Oct 2024 08:10:39 +0000 Subject: [PATCH 04/47] New Crowdin Translations (automated) (#32295) Co-authored-by: GitHub Actions --- app/javascript/mastodon/locales/be.json | 1 + app/javascript/mastodon/locales/de.json | 2 +- config/locales/ca.yml | 1 + config/locales/da.yml | 1 + config/locales/de.yml | 1 + config/locales/eo.yml | 1 + config/locales/es-AR.yml | 1 + config/locales/es-MX.yml | 1 + config/locales/es.yml | 1 + config/locales/fi.yml | 1 + config/locales/fo.yml | 1 + config/locales/gl.yml | 1 + config/locales/he.yml | 1 + config/locales/is.yml | 1 + config/locales/ja.yml | 1 + config/locales/ko.yml | 1 + config/locales/nl.yml | 1 + config/locales/nn.yml | 1 + config/locales/pl.yml | 1 + config/locales/pt-BR.yml | 1 + config/locales/tr.yml | 1 + config/locales/uk.yml | 1 + config/locales/vi.yml | 1 + config/locales/zh-CN.yml | 1 + config/locales/zh-TW.yml | 1 + 25 files changed, 25 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/locales/be.json b/app/javascript/mastodon/locales/be.json index 797d8cc22e..d3a29eae40 100644 --- a/app/javascript/mastodon/locales/be.json +++ b/app/javascript/mastodon/locales/be.json @@ -85,6 +85,7 @@ "alert.rate_limited.title": "Ліміт перавышаны", "alert.unexpected.message": "Узнікла нечаканая памылка.", "alert.unexpected.title": "Вой!", + "alt_text_badge.title": "Альтернативный текст", "announcement.announcement": "Аб'ява", "attachments_list.unprocessed": "(неапрацаваны)", "audio.hide": "Схаваць аўдыя", diff --git a/app/javascript/mastodon/locales/de.json b/app/javascript/mastodon/locales/de.json index 3d8b57db4a..b807d93ab3 100644 --- a/app/javascript/mastodon/locales/de.json +++ b/app/javascript/mastodon/locales/de.json @@ -62,7 +62,7 @@ "account.requested_follow": "{name} möchte dir folgen", "account.share": "Profil von @{name} teilen", "account.show_reblogs": "Geteilte Beiträge von @{name} anzeigen", - "account.statuses_counter": "{count, plural, one {{counter} post} other {{counter} posts}}", + "account.statuses_counter": "{count, plural, one {{counter} Beitrag} other {{counter} Beiträge}}", "account.unblock": "Blockierung von @{name} aufheben", "account.unblock_domain": "Blockierung von {domain} aufheben", "account.unblock_short": "Blockierung aufheben", diff --git a/config/locales/ca.yml b/config/locales/ca.yml index bb81aaa59c..cc2da496a6 100644 --- a/config/locales/ca.yml +++ b/config/locales/ca.yml @@ -21,6 +21,7 @@ ca: one: Tut other: Tuts posts_tab_heading: Tuts + self_follow_error: No es permet seguir el compte propi admin: account_actions: action: Realitza l'acció diff --git a/config/locales/da.yml b/config/locales/da.yml index 1f80503e91..923102c11f 100644 --- a/config/locales/da.yml +++ b/config/locales/da.yml @@ -21,6 +21,7 @@ da: one: Indlæg other: Indlæg posts_tab_heading: Indlæg + self_follow_error: Det er ikke tilladt at følge sin egen konto admin: account_actions: action: Udfør handling diff --git a/config/locales/de.yml b/config/locales/de.yml index 5f0b4ae353..cfd0d6510e 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -21,6 +21,7 @@ de: one: Beitrag other: Beiträge posts_tab_heading: Beiträge + self_follow_error: Es ist nicht erlaubt, deinem eigenen Konto zu folgen admin: account_actions: action: Aktion ausführen diff --git a/config/locales/eo.yml b/config/locales/eo.yml index 10b297f1a8..1e683b1725 100644 --- a/config/locales/eo.yml +++ b/config/locales/eo.yml @@ -21,6 +21,7 @@ eo: one: Afiŝo other: Mesaĝoj posts_tab_heading: Afiŝoj + self_follow_error: Sekvi vian propran konton ne estas permesita admin: account_actions: action: Plenumi agon diff --git a/config/locales/es-AR.yml b/config/locales/es-AR.yml index cfc24ce270..04ff7880a1 100644 --- a/config/locales/es-AR.yml +++ b/config/locales/es-AR.yml @@ -21,6 +21,7 @@ es-AR: one: Mensaje other: Mensajes posts_tab_heading: Mensajes + self_follow_error: No está permitido seguir tu propia cuenta admin: account_actions: action: Ejecutar acción diff --git a/config/locales/es-MX.yml b/config/locales/es-MX.yml index 4e7ee657e6..2c18465a26 100644 --- a/config/locales/es-MX.yml +++ b/config/locales/es-MX.yml @@ -21,6 +21,7 @@ es-MX: one: Toot other: Toots posts_tab_heading: Toots + self_follow_error: No se permite seguir tu propia cuenta admin: account_actions: action: Realizar acción diff --git a/config/locales/es.yml b/config/locales/es.yml index bb9e5daff5..47d32c62c8 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -21,6 +21,7 @@ es: one: Publicación other: Publicaciones posts_tab_heading: Publicaciones + self_follow_error: No está permitido seguir tu propia cuenta admin: account_actions: action: Realizar acción diff --git a/config/locales/fi.yml b/config/locales/fi.yml index 1767f9e63e..52ea0b374c 100644 --- a/config/locales/fi.yml +++ b/config/locales/fi.yml @@ -21,6 +21,7 @@ fi: one: Julkaisu other: viestiä posts_tab_heading: Julkaisut + self_follow_error: Oman tilisi seuraaminen ei ole sallittua admin: account_actions: action: Suorita toimi diff --git a/config/locales/fo.yml b/config/locales/fo.yml index 55104eb6ff..fcf3eb031e 100644 --- a/config/locales/fo.yml +++ b/config/locales/fo.yml @@ -21,6 +21,7 @@ fo: one: Uppslag other: Uppsløg posts_tab_heading: Uppsløg + self_follow_error: Tað er ikki loyvt at fylgja tíni egnu kontu admin: account_actions: action: Frem atgerð diff --git a/config/locales/gl.yml b/config/locales/gl.yml index 8460902a68..cdc9421324 100644 --- a/config/locales/gl.yml +++ b/config/locales/gl.yml @@ -21,6 +21,7 @@ gl: one: Publicación other: Publicacións posts_tab_heading: Publicacións + self_follow_error: Non está permitido seguir a túa propia conta admin: account_actions: action: Executar acción diff --git a/config/locales/he.yml b/config/locales/he.yml index f2732678b5..54b6b6f38d 100644 --- a/config/locales/he.yml +++ b/config/locales/he.yml @@ -25,6 +25,7 @@ he: other: הודעות two: הודעותיים posts_tab_heading: הודעות + self_follow_error: בלתי אפשרי לך לעקוב אחרי חשבונך admin: account_actions: action: בצע/י פעולה diff --git a/config/locales/is.yml b/config/locales/is.yml index 6eefaf1b0e..f181470e49 100644 --- a/config/locales/is.yml +++ b/config/locales/is.yml @@ -21,6 +21,7 @@ is: one: Færsla other: Færslur posts_tab_heading: Færslur + self_follow_error: Ekki er leyft að fylgjast með eigin aðgangi admin: account_actions: action: Framkvæma aðgerð diff --git a/config/locales/ja.yml b/config/locales/ja.yml index 54b7fb5412..bda5b2d8f6 100644 --- a/config/locales/ja.yml +++ b/config/locales/ja.yml @@ -19,6 +19,7 @@ ja: posts: other: 投稿 posts_tab_heading: 投稿 + self_follow_error: 自分のアカウントをフォローすることはできません admin: account_actions: action: アクションを実行 diff --git a/config/locales/ko.yml b/config/locales/ko.yml index d20d67e4c3..615783738a 100644 --- a/config/locales/ko.yml +++ b/config/locales/ko.yml @@ -19,6 +19,7 @@ ko: posts: other: 게시물 posts_tab_heading: 게시물 + self_follow_error: 본인의 계정을 팔로우할 수는 없습니다 admin: account_actions: action: 조치 취하기 diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 52ec4c89ce..968dcc3e7c 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -21,6 +21,7 @@ nl: one: Toot other: Berichten posts_tab_heading: Berichten + self_follow_error: Het volgen van je eigen account is niet toegestaan admin: account_actions: action: Actie uitvoeren diff --git a/config/locales/nn.yml b/config/locales/nn.yml index ec3db6520f..b28cf30162 100644 --- a/config/locales/nn.yml +++ b/config/locales/nn.yml @@ -21,6 +21,7 @@ nn: one: Tut other: Tut posts_tab_heading: Tut + self_follow_error: Det er ikkje tillate å følgje din eigen konto admin: account_actions: action: Utfør diff --git a/config/locales/pl.yml b/config/locales/pl.yml index aaf8a9e722..ba1f4812e9 100644 --- a/config/locales/pl.yml +++ b/config/locales/pl.yml @@ -25,6 +25,7 @@ pl: one: wpis other: Wpisów posts_tab_heading: Wpisy + self_follow_error: Nie możesz obserwować swojego konta admin: account_actions: action: Wykonaj działanie diff --git a/config/locales/pt-BR.yml b/config/locales/pt-BR.yml index 427703f57e..8e806f670c 100644 --- a/config/locales/pt-BR.yml +++ b/config/locales/pt-BR.yml @@ -21,6 +21,7 @@ pt-BR: one: Publicação other: Publicações posts_tab_heading: Publicações + self_follow_error: Seguir sua conta não é permitido admin: account_actions: action: Tomar uma atitude diff --git a/config/locales/tr.yml b/config/locales/tr.yml index df55aa5a29..ee74f237ee 100644 --- a/config/locales/tr.yml +++ b/config/locales/tr.yml @@ -21,6 +21,7 @@ tr: one: Gönderi other: Gönderiler posts_tab_heading: Gönderiler + self_follow_error: Kendi hesabınızı takip etmenize izin yok admin: account_actions: action: Eylemi gerçekleştir diff --git a/config/locales/uk.yml b/config/locales/uk.yml index 47732198f1..dec4299fb9 100644 --- a/config/locales/uk.yml +++ b/config/locales/uk.yml @@ -25,6 +25,7 @@ uk: one: Допис other: Дописів posts_tab_heading: Дописів + self_follow_error: Ви не можете стежити за власним обліковим записом admin: account_actions: action: Виконати дію diff --git a/config/locales/vi.yml b/config/locales/vi.yml index 17edfba70a..7c30c5b127 100644 --- a/config/locales/vi.yml +++ b/config/locales/vi.yml @@ -19,6 +19,7 @@ vi: posts: other: Tút posts_tab_heading: Tút + self_follow_error: Bạn không thể tự theo dõi chính bạn admin: account_actions: action: Thực hiện hành động diff --git a/config/locales/zh-CN.yml b/config/locales/zh-CN.yml index 7be8fb5a58..2654804697 100644 --- a/config/locales/zh-CN.yml +++ b/config/locales/zh-CN.yml @@ -19,6 +19,7 @@ zh-CN: posts: other: 嘟文 posts_tab_heading: 嘟文 + self_follow_error: 不可以关注自己 admin: account_actions: action: 执行操作 diff --git a/config/locales/zh-TW.yml b/config/locales/zh-TW.yml index 96aedf0a1c..c461aabcdc 100644 --- a/config/locales/zh-TW.yml +++ b/config/locales/zh-TW.yml @@ -19,6 +19,7 @@ zh-TW: posts: other: 嘟文 posts_tab_heading: 嘟文 + self_follow_error: 無法跟隨您自己的帳號 admin: account_actions: action: 執行動作 From c3a38c7d8c123f5bf736e20e0417fb3d70022391 Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 8 Oct 2024 14:24:59 +0200 Subject: [PATCH 05/47] Update changelog and security policy (#32300) --- CHANGELOG.md | 26 ++++++++++++++++---------- SECURITY.md | 11 ++++++----- docker-compose.yml | 6 +++--- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5eef082ccc..566c474356 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to this project will be documented in this file. -## [4.3.0] - UNRELEASED +## [4.3.0] - 2024-10-08 The following changelog entries focus on changes visible to users, administrators, client developers or federated software developers, but there has also been a lot of code modernization, refactoring, and tooling work, in particular by @mjankowski. @@ -11,12 +11,12 @@ The following changelog entries focus on changes visible to users, administrator - **Add confirmation interstitial instead of silently redirecting logged-out visitors to remote resources** (#27792, #28902, and #30651 by @ClearlyClaire and @Gargron)\ This fixes a longstanding open redirect in Mastodon, at the cost of added friction when local links to remote resources are shared. - Fix ReDoS vulnerability on some Ruby versions ([GHSA-jpxp-r43f-rhvx](https://github.com/mastodon/mastodon/security/advisories/GHSA-jpxp-r43f-rhvx)) -- Change `form-action` Content-Security-Policy directive to be more restrictive (#26897 by @ClearlyClaire) +- Change `form-action` Content-Security-Policy directive to be more restrictive (#26897 and #32241 by @ClearlyClaire) - Update dependencies ### Added -- **Add server-side notification grouping** (#29889, #30576, #30685, #30688, #30707, #30776, #30779, #30781, #30440, #31062, #31098, #31076, #31111, #31123, #31223, #31214, #31224, #31299, #31325, #31347, #31304, #31326, #31384, #31403, #31433, #31509, #31486, #31513, #31592, #31594, #31638, #31746, #31652, #31709, #31725, #31745, #31613, #31657, #31840, #31610, #31929, #32089 and #32085 by @ClearlyClaire, @Gargron, @mgmn, and @renchap)\ +- **Add server-side notification grouping** (#29889, #30576, #30685, #30688, #30707, #30776, #30779, #30781, #30440, #31062, #31098, #31076, #31111, #31123, #31223, #31214, #31224, #31299, #31325, #31347, #31304, #31326, #31384, #31403, #31433, #31509, #31486, #31513, #31592, #31594, #31638, #31746, #31652, #31709, #31725, #31745, #31613, #31657, #31840, #31610, #31929, #32089, #32085, #32243, #32179 and #32254 by @ClearlyClaire, @Gargron, @mgmn, and @renchap)\ Group notifications of the same type for the same target, so that your notifications no longer get cluttered by boost and favorite notifications as soon as a couple of your posts get traction.\ This is done server-side so that clients can efficiently get relevant groups without having to go through numerous pages of individual notifications.\ As part of this, the visual design of the entire notifications feature has been revamped.\ @@ -28,7 +28,7 @@ The following changelog entries focus on changes visible to users, administrator - `GET /api/v2/notifications/:group_key/accounts`: https://docs.joinmastodon.org/methods/grouped_notifications/#get-group-accounts - `POST /api/v2/notifications/:group_key/dimsiss`: https://docs.joinmastodon.org/methods/grouped_notifications/#dismiss-group - `GET /api/v2/notifications/:unread_count`: https://docs.joinmastodon.org/methods/grouped_notifications/#unread-group-count -- **Add notification policies, filtered notifications and notification requests** (#29366, #29529, #29433, #29565, #29567, #29572, #29575, #29588, #29646, #29652, #29658, #29666, #29693, #29699, #29737, #29706, #29570, #29752, #29810, #29826, #30114, #30251, #30559, #29868, #31008, #31011, #30996, #31149, #31220, #31222, #31225, #31242, #31262, #31250, #31273, #31310, #31316, #31322, #31329, #31324, #31331, #31343, #31342, #31309, #31358, #31378, #31406, #31256, #31456, #31419, #31457, #31508, #31540, #31541, #31723 and #32062 by @ClearlyClaire, @Gargron, @TheEssem, @mgmn, @oneiros, and @renchap)\ +- **Add notification policies, filtered notifications and notification requests** (#29366, #29529, #29433, #29565, #29567, #29572, #29575, #29588, #29646, #29652, #29658, #29666, #29693, #29699, #29737, #29706, #29570, #29752, #29810, #29826, #30114, #30251, #30559, #29868, #31008, #31011, #30996, #31149, #31220, #31222, #31225, #31242, #31262, #31250, #31273, #31310, #31316, #31322, #31329, #31324, #31331, #31343, #31342, #31309, #31358, #31378, #31406, #31256, #31456, #31419, #31457, #31508, #31540, #31541, #31723, #32062 and #32281 by @ClearlyClaire, @Gargron, @TheEssem, @mgmn, @oneiros, and @renchap)\ The old “Block notifications from non-followers”, “Block notifications from people you don't follow” and “Block direct messages from people you don't follow” notification settings have been replaced by a new set of settings found directly in the notification column.\ You can now separately filter or drop notifications from people you don't follow, people who don't follow you, accounts created within the past 30 days, as well as unsolicited private mentions, and accounts limited by the moderation.\ Instead of being outright dropped, notifications that you chose to filter are put in a separate “Filtered notifications” box that you can review separately without it clogging your main notifications.\ @@ -61,7 +61,7 @@ The following changelog entries focus on changes visible to users, administrator - **Add timeline of public posts about a trending link** (#30381 and #30840 by @Gargron)\ You can now see public posts mentioning currently-trending articles from people who have opted into discovery features.\ This adds a new REST API endpoint: https://docs.joinmastodon.org/methods/timelines/#link -- **Add author highlight for news articles whose authors are on the fediverse** (#30398, #30670, #30521, #30846, #31819, and #31900 by @Gargron and @oneiros)\ +- **Add author highlight for news articles whose authors are on the fediverse** (#30398, #30670, #30521, #30846, #31819, #31900 and #32188 by @Gargron, @mjankowski and @oneiros)\ This adds a mechanism to [highlight the author of news articles](https://blog.joinmastodon.org/2024/07/highlighting-journalism-on-mastodon/) shared on Mastodon.\ Articles hosted outside the fediverse can indicate a fediverse author with a meta tag: ```html @@ -150,10 +150,12 @@ The following changelog entries focus on changes visible to users, administrator - Add groundwork for annual reports for accounts (#28693 by @Gargron)\ This lays the groundwork for a “year-in-review”/“wrapped” style report for local users, but is currently not in use. - Add notification email on invalid second authenticator (#28822 by @ClearlyClaire) +- Add date of account deletion in list of accounts in the admin interface (#25640 by @tribela) - Add new emojis from `jdecked/twemoji` 15.0 (#28404 by @TheEssem) - Add configurable error handling in attachment batch deletion (#28184 by @vmstan)\ This makes the S3 batch size configurable through the `S3_BATCH_DELETE_LIMIT` environment variable (defaults to 1000), and adds some retry logic, configurable through the `S3_BATCH_DELETE_RETRY` environment variable (defaults to 3). - Add VAPID public key to instance serializer (#28006 by @ThisIsMissEm) +- Add support for serving JRD `/.well-known/host-meta.json` in addition to XRD host-meta (#32206 by @c960657) - Add `nodeName` and `nodeDescription` to nodeinfo `metadata` (#28079 by @6543) - Add Thai diacritics and tone marks in `HASHTAG_INVALID_CHARS_RE` (#26576 by @ppnplus) - Add variable delay before link verification of remote account links (#27774 by @ClearlyClaire) @@ -168,7 +170,7 @@ The following changelog entries focus on changes visible to users, administrator ### Changed -- **Change icons throughout the web interface** (#27385, #27539, #27555, #27579, #27700, #27817, #28519, #28709, #28064, #28775, #28780, #27924, #29294, #29395, #29537, #29569, #29610, #29612, #29649, #29844, #27780, #30974, #30963, #30962, #30961, #31362, #31363, #31359, #31371, #31360, #31512, #31511, and #31525 by @ClearlyClaire, @Gargron, @arbolitoloco1, @mjankowski, @nclm, @renchap, @ronilaukkarinen, and @zunda)\ +- **Change icons throughout the web interface** (#27385, #27539, #27555, #27579, #27700, #27817, #28519, #28709, #28064, #28775, #28780, #27924, #29294, #29395, #29537, #29569, #29610, #29612, #29649, #29844, #27780, #30974, #30963, #30962, #30961, #31362, #31363, #31359, #31371, #31360, #31512, #31511, #31525, #32153, and #32201 by @ClearlyClaire, @Gargron, @arbolitoloco1, @mjankowski, @nclm, @renchap, @ronilaukkarinen, and @zunda)\ This changes all the interface icons from FontAwesome to Material Symbols for a more modern look, consistent with the official Mastodon Android app.\ In addition, better care is given to pixel alignment, and icon variants are used to better highlight active/inactive state. - **Change design of compose form in web UI** (#28119, #29059, #29248, #29372, #29384, #29417, #29456, #29406, #29651, #29659, #31889 and #32033 by @ClearlyClaire, @Gargron, @eai04191, @hinaloe, and @ronilaukkarinen)\ @@ -192,9 +194,9 @@ The following changelog entries focus on changes visible to users, administrator Administrators may need to update their setup accordingly. - Change how content warnings and filters are displayed in web UI (#31365, and #31761 by @Gargron) - Change preview card processing to ignore `undefined` as canonical url (#31882 by @oneiros) -- Change embedded posts to use web UI (#31766 and #32135 by @Gargron) +- Change embedded posts to use web UI (#31766, #32135 and #32271 by @Gargron) - Change inner borders in media galleries in web UI (#31852 by @Gargron) -- Change design of media attachments and profile media tab in web UI (#31807, #32048, and #31967 by @Gargron) +- Change design of media attachments and profile media tab in web UI (#31807, #32048, #31967, #32217, #32224 and #32257 by @ClearlyClaire and @Gargron) - Change labels on thread indicators in web UI (#31806 by @Gargron) - Change label of "Data export" menu item in settings interface (#32099 by @c960657) - Change responsive break points on navigation panel in web UI (#32034 by @Gargron) @@ -284,9 +286,10 @@ The following changelog entries focus on changes visible to users, administrator - Fix error when accepting an appeal for sensitive posts deleted in the meantime (#32037 by @ClearlyClaire) - Fix error when encountering reblog of deleted post in feed rebuild (#32001 by @ClearlyClaire) - Fix Safari browser glitch related to horizontal scrolling (#31960 by @Gargron) +- Fix unresolvable mentions sometimes preventing processing incoming posts (#29215 by @tribela and @ClearlyClaire) - Fix too many requests caused by relationship look-ups in web UI (#32042 by @Gargron) - Fix links for reblogs in moderation interface (#31979 by @ClearlyClaire) -- Fix the appearance of avatars when they do not load (#31966 by @renchap) +- Fix the appearance of avatars when they do not load (#31966 and #32270 by @Gargron and @renchap) - Fix spurious error notifications for aborted requests in web UI (#31952 by @c960657) - Fix HTTP 500 error in `/api/v1/polls/:id/votes` when required `choices` parameter is missing (#25598 by @danielmbrasil) - Fix security context sometimes not being added in LD-Signed activities (#31871 by @ClearlyClaire) @@ -309,10 +312,12 @@ The following changelog entries focus on changes visible to users, administrator - Fix “Redirect URI” field not being marked as required in “New application” form (#30311 by @ThisIsMissEm) - Fix right-to-left text in preview cards (#30930 by @ClearlyClaire) - Fix rack attack `match_type` value typo in logging config (#30514 by @mjankowski) -- Fix various cases of duplicate, missing, or inconsistent borders or scrollbar styles (#31068, #31286, #31268, #31275, #31284, #31305, #31346, #31372, #31373, #31389, #31432, #31391, #31445 and #32091 by @ClearlyClaire, @valtlai and @vmstan) +- Fix various cases of duplicate, missing, or inconsistent borders or scrollbar styles (#31068, #31286, #31268, #31275, #31284, #31305, #31346, #31372, #31373, #31389, #31432, #31391, #31445, #32091, #32147 and #32137 by @ClearlyClaire, @mjankowski, @valtlai and @vmstan) +- Fix editing description of media uploads with custom thumbnails (#32221 by @ClearlyClaire) - Fix race condition in `POST /api/v1/push/subscription` (#30166 by @ClearlyClaire) - Fix post deletion not being delayed when those are part of an account warning (#30163 by @ClearlyClaire) - Fix rendering error on `/start` when not logged in (#30023 by @timothyjrogers) +- Fix unneeded requests to blocked domains when receiving relayed signed activities from them (#31161 by @ClearlyClaire) - Fix logo pushing header buttons out of view on certain conditions in mobile layout (#29787 by @ClearlyClaire) - Fix notification-related records not being reattributed when merging accounts (#29694 by @ClearlyClaire) - Fix results/query in `api/v1/featured_tags/suggestions` (#29597 by @mjankowski) @@ -322,6 +327,7 @@ The following changelog entries focus on changes visible to users, administrator - Fix full date display not respecting the locale 12/24h format (#29448 by @renchap) - Fix filters title and keywords overflow (#29396 by @GeopJr) - Fix incorrect date format in “Follows and followers” (#29390 by @JasonPunyon) +- Fix navigation item active highlight for some paths (#32159 by @mjankowski) - Fix “Edit media” modal sizing and layout when space-constrained (#27095 by @ronilaukkarinen) - Fix modal container bounds (#29185 by @nico3333fr) - Fix inefficient HTTP signature parsing using regexps and `StringScanner` (#29133 by @ClearlyClaire) diff --git a/SECURITY.md b/SECURITY.md index 156954ce02..43ab4454c4 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -13,8 +13,9 @@ A "vulnerability in Mastodon" is a vulnerability in the code distributed through ## Supported Versions -| Version | Supported | -| ------- | --------- | -| 4.2.x | Yes | -| 4.1.x | Yes | -| < 4.1 | No | +| Version | Supported | +| ------- | ---------------- | +| 4.3.x | Yes | +| 4.2.x | Yes | +| 4.1.x | Until 2025-04-08 | +| < 4.1 | No | diff --git a/docker-compose.yml b/docker-compose.yml index 41876d26f9..37cb16497f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -59,7 +59,7 @@ services: web: # You can uncomment the following line if you want to not use the prebuilt image, for example if you have local code changes # build: . - image: ghcr.io/mastodon/mastodon:v4.3.0-rc.1 + image: ghcr.io/mastodon/mastodon:v4.3.0 restart: always env_file: .env.production command: bundle exec puma -C config/puma.rb @@ -83,7 +83,7 @@ services: # build: # dockerfile: ./streaming/Dockerfile # context: . - image: ghcr.io/mastodon/mastodon-streaming:v4.3.0-rc.1 + image: ghcr.io/mastodon/mastodon-streaming:v4.3.0 restart: always env_file: .env.production command: node ./streaming/index.js @@ -101,7 +101,7 @@ services: sidekiq: build: . - image: ghcr.io/mastodon/mastodon:v4.3.0-rc.1 + image: ghcr.io/mastodon/mastodon:v4.3.0 restart: always env_file: .env.production command: bundle exec sidekiq From 022c1ae6f2911db8c479e0b6b88cff1e3a79c47e Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 8 Oct 2024 08:52:52 -0400 Subject: [PATCH 06/47] Remove unused deprecator configuration (#32288) --- config/application.rb | 4 ---- 1 file changed, 4 deletions(-) diff --git a/config/application.rb b/config/application.rb index 0013c78858..5e2f44453d 100644 --- a/config/application.rb +++ b/config/application.rb @@ -96,10 +96,6 @@ module Mastodon config.middleware.use Rack::Attack config.middleware.use Mastodon::RackMiddleware - initializer :deprecator do |app| - app.deprecators[:mastodon] = ActiveSupport::Deprecation.new('4.3', 'mastodon/mastodon') - end - config.before_configuration do require 'mastodon/redis_configuration' ::REDIS_CONFIGURATION = Mastodon::RedisConfiguration.new From d20a899bb90c78c2290a947e36f19fff6654ad47 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 8 Oct 2024 09:21:36 -0400 Subject: [PATCH 07/47] Bring icon vertical middle to applications list style (#32293) --- app/javascript/styles/mastodon/admin.scss | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/javascript/styles/mastodon/admin.scss b/app/javascript/styles/mastodon/admin.scss index 0712a0d3f4..c7b32a9c9e 100644 --- a/app/javascript/styles/mastodon/admin.scss +++ b/app/javascript/styles/mastodon/admin.scss @@ -1029,6 +1029,12 @@ a.name-tag, color: var(--user-role-accent); } +.applications-list { + .icon { + vertical-align: middle; + } +} + .announcements-list, .filters-list { border: 1px solid var(--background-border-color); From 3cf2d35c4947cb8fb12cb33c22b2832f823cb3a4 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 8 Oct 2024 09:23:30 -0400 Subject: [PATCH 08/47] Reference `IpBlock.severities` keys from CLI option check (#32291) --- lib/mastodon/cli/ip_blocks.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mastodon/cli/ip_blocks.rb b/lib/mastodon/cli/ip_blocks.rb index 3c5fdb275c..ef24f2e047 100644 --- a/lib/mastodon/cli/ip_blocks.rb +++ b/lib/mastodon/cli/ip_blocks.rb @@ -5,7 +5,7 @@ require_relative 'base' module Mastodon::CLI class IpBlocks < Base - option :severity, required: true, enum: %w(no_access sign_up_requires_approval sign_up_block), desc: 'Severity of the block' + option :severity, required: true, enum: IpBlock.severities.keys, desc: 'Severity of the block' option :comment, aliases: [:c], desc: 'Optional comment' option :duration, aliases: [:d], type: :numeric, desc: 'Duration of the block in seconds' option :force, type: :boolean, aliases: [:f], desc: 'Overwrite existing blocks' From f49161ab1d57969b105bd115af8c827fc817db61 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 8 Oct 2024 09:30:54 -0400 Subject: [PATCH 09/47] Oauth system spec cleanup / helper method extraction (#32287) --- spec/system/oauth_spec.rb | 96 +++++++++++++++++++++++---------------- 1 file changed, 56 insertions(+), 40 deletions(-) diff --git a/spec/system/oauth_spec.rb b/spec/system/oauth_spec.rb index 64ac75879e..14ffc163f0 100644 --- a/spec/system/oauth_spec.rb +++ b/spec/system/oauth_spec.rb @@ -24,28 +24,28 @@ RSpec.describe 'Using OAuth from an external app' do subject # It presents the user with an authorization page - expect(page).to have_content(I18n.t('doorkeeper.authorizations.buttons.authorize')) - - # Upon authorizing, it redirects to the apps' callback URL - click_on I18n.t('doorkeeper.authorizations.buttons.authorize') - expect(page).to have_current_path(/\A#{client_app.redirect_uri}/, url: true) + expect(page).to have_content(oauth_authorize_text) # It grants the app access to the account - expect(Doorkeeper::AccessGrant.exists?(application: client_app, resource_owner_id: user.id)).to be true + expect { click_on oauth_authorize_text } + .to change { user_has_grant_with_client_app? }.to(true) + + # Upon authorizing, it redirects to the apps' callback URL + expect(page).to redirect_to_callback_url end it 'when rejecting the authorization request' do subject # It presents the user with an authorization page - expect(page).to have_content(I18n.t('doorkeeper.authorizations.buttons.deny')) - - # Upon denying, it redirects to the apps' callback URL - click_on I18n.t('doorkeeper.authorizations.buttons.deny') - expect(page).to have_current_path(/\A#{client_app.redirect_uri}/, url: true) + expect(page).to have_content(oauth_deny_text) # It does not grant the app access to the account - expect(Doorkeeper::AccessGrant.exists?(application: client_app, resource_owner_id: user.id)).to be false + expect { click_on oauth_deny_text } + .to_not change { user_has_grant_with_client_app? }.from(false) + + # Upon denying, it redirects to the apps' callback URL + expect(page).to redirect_to_callback_url end # The tests in this context ensures that requests without PKCE parameters @@ -133,7 +133,6 @@ RSpec.describe 'Using OAuth from an external app' do end it 'when accepting the authorization request' do - params = { client_id: client_app.uid, response_type: 'code', redirect_uri: client_app.redirect_uri, scope: 'read' } visit "/oauth/authorize?#{params.to_query}" # It presents the user with a log-in page @@ -145,18 +144,17 @@ RSpec.describe 'Using OAuth from an external app' do # Logging in redirects to an authorization page fill_in_auth_details(email, password) - expect(page).to have_content(I18n.t('doorkeeper.authorizations.buttons.authorize')) - - # Upon authorizing, it redirects to the apps' callback URL - click_on I18n.t('doorkeeper.authorizations.buttons.authorize') - expect(page).to have_current_path(/\A#{client_app.redirect_uri}/, url: true) + expect(page).to have_content(oauth_authorize_text) # It grants the app access to the account - expect(Doorkeeper::AccessGrant.exists?(application: client_app, resource_owner_id: user.id)).to be true + expect { click_on oauth_authorize_text } + .to change { user_has_grant_with_client_app? }.to(true) + + # Upon authorizing, it redirects to the apps' callback URL + expect(page).to redirect_to_callback_url end it 'when rejecting the authorization request' do - params = { client_id: client_app.uid, response_type: 'code', redirect_uri: client_app.redirect_uri, scope: 'read' } visit "/oauth/authorize?#{params.to_query}" # It presents the user with a log-in page @@ -168,21 +166,20 @@ RSpec.describe 'Using OAuth from an external app' do # Logging in redirects to an authorization page fill_in_auth_details(email, password) - expect(page).to have_content(I18n.t('doorkeeper.authorizations.buttons.authorize')) - - # Upon denying, it redirects to the apps' callback URL - click_on I18n.t('doorkeeper.authorizations.buttons.deny') - expect(page).to have_current_path(/\A#{client_app.redirect_uri}/, url: true) + expect(page).to have_content(oauth_authorize_text) # It does not grant the app access to the account - expect(Doorkeeper::AccessGrant.exists?(application: client_app, resource_owner_id: user.id)).to be false + expect { click_on oauth_deny_text } + .to_not change { user_has_grant_with_client_app? }.from(false) + + # Upon denying, it redirects to the apps' callback URL + expect(page).to redirect_to_callback_url end context 'when the user has set up TOTP' do let(:user) { Fabricate(:user, email: email, password: password, otp_required_for_login: true, otp_secret: User.generate_otp_secret) } it 'when accepting the authorization request' do - params = { client_id: client_app.uid, response_type: 'code', redirect_uri: client_app.redirect_uri, scope: 'read' } visit "/oauth/authorize?#{params.to_query}" # It presents the user with a log-in page @@ -202,18 +199,17 @@ RSpec.describe 'Using OAuth from an external app' do # Filling in the correct TOTP code redirects to an app authorization page fill_in_otp_details(user.current_otp) - expect(page).to have_content(I18n.t('doorkeeper.authorizations.buttons.authorize')) - - # Upon authorizing, it redirects to the apps' callback URL - click_on I18n.t('doorkeeper.authorizations.buttons.authorize') - expect(page).to have_current_path(/\A#{client_app.redirect_uri}/, url: true) + expect(page).to have_content(oauth_authorize_text) # It grants the app access to the account - expect(Doorkeeper::AccessGrant.exists?(application: client_app, resource_owner_id: user.id)).to be true + expect { click_on oauth_authorize_text } + .to change { user_has_grant_with_client_app? }.to(true) + + # Upon authorizing, it redirects to the apps' callback URL + expect(page).to redirect_to_callback_url end it 'when rejecting the authorization request' do - params = { client_id: client_app.uid, response_type: 'code', redirect_uri: client_app.redirect_uri, scope: 'read' } visit "/oauth/authorize?#{params.to_query}" # It presents the user with a log-in page @@ -233,14 +229,14 @@ RSpec.describe 'Using OAuth from an external app' do # Filling in the correct TOTP code redirects to an app authorization page fill_in_otp_details(user.current_otp) - expect(page).to have_content(I18n.t('doorkeeper.authorizations.buttons.authorize')) - - # Upon denying, it redirects to the apps' callback URL - click_on I18n.t('doorkeeper.authorizations.buttons.deny') - expect(page).to have_current_path(/\A#{client_app.redirect_uri}/, url: true) + expect(page).to have_content(oauth_authorize_text) # It does not grant the app access to the account - expect(Doorkeeper::AccessGrant.exists?(application: client_app, resource_owner_id: user.id)).to be false + expect { click_on oauth_deny_text } + .to_not change { user_has_grant_with_client_app? }.from(false) + + # Upon denying, it redirects to the apps' callback URL + expect(page).to redirect_to_callback_url end end # TODO: external auth @@ -252,4 +248,24 @@ RSpec.describe 'Using OAuth from an external app' do fill_in 'user_otp_attempt', with: value click_on I18n.t('auth.login') end + + def oauth_authorize_text + I18n.t('doorkeeper.authorizations.buttons.authorize') + end + + def oauth_deny_text + I18n.t('doorkeeper.authorizations.buttons.deny') + end + + def redirect_to_callback_url + have_current_path(/\A#{client_app.redirect_uri}/, url: true) + end + + def user_has_grant_with_client_app? + Doorkeeper::AccessGrant + .exists?( + application: client_app, + resource_owner_id: user.id + ) + end end From e8ec6667bd24028422abb68525db5b8f6a44c801 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 8 Oct 2024 09:53:35 -0400 Subject: [PATCH 10/47] Extract wrapper constant for `HTTP::*` error classes (#32285) --- app/controllers/application_controller.rb | 2 +- app/controllers/concerns/api/error_handling.rb | 2 +- app/controllers/concerns/signature_verification.rb | 2 +- app/controllers/media_proxy_controller.rb | 2 +- app/lib/activitypub/activity/create.rb | 4 ++-- app/models/account_alias.rb | 2 +- app/models/account_migration.rb | 2 +- app/models/concerns/remotable.rb | 2 +- app/models/form/redirect.rb | 2 +- app/models/remote_follow.rb | 2 +- app/services/activitypub/process_account_service.rb | 6 +++--- app/services/activitypub/process_status_update_service.rb | 2 +- app/services/fetch_link_card_service.rb | 2 +- app/services/fetch_resource_service.rb | 2 +- app/services/import_service.rb | 2 +- app/services/process_mentions_service.rb | 2 +- app/services/software_update_check_service.rb | 2 +- app/services/verify_link_service.rb | 2 +- app/workers/refollow_worker.rb | 2 +- lib/exceptions.rb | 6 ++++++ lib/mastodon/cli/accounts.rb | 2 +- 21 files changed, 29 insertions(+), 23 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 62e3355ae6..40cae15b48 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -32,7 +32,7 @@ class ApplicationController < ActionController::Base rescue_from ActionController::InvalidAuthenticityToken, with: :unprocessable_entity rescue_from Mastodon::RateLimitExceededError, with: :too_many_requests - rescue_from HTTP::Error, OpenSSL::SSL::SSLError, with: :internal_server_error + rescue_from(*Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError, with: :internal_server_error) rescue_from Mastodon::RaceConditionError, Stoplight::Error::RedLight, ActiveRecord::SerializationFailure, with: :service_unavailable rescue_from Seahorse::Client::NetworkingError do |e| diff --git a/app/controllers/concerns/api/error_handling.rb b/app/controllers/concerns/api/error_handling.rb index ad559fe2d7..9ce4795b02 100644 --- a/app/controllers/concerns/api/error_handling.rb +++ b/app/controllers/concerns/api/error_handling.rb @@ -20,7 +20,7 @@ module Api::ErrorHandling render json: { error: 'Record not found' }, status: 404 end - rescue_from HTTP::Error, Mastodon::UnexpectedResponseError do + rescue_from(*Mastodon::HTTP_CONNECTION_ERRORS, Mastodon::UnexpectedResponseError) do render json: { error: 'Remote data could not be fetched' }, status: 503 end diff --git a/app/controllers/concerns/signature_verification.rb b/app/controllers/concerns/signature_verification.rb index 68f09ee023..6773c11099 100644 --- a/app/controllers/concerns/signature_verification.rb +++ b/app/controllers/concerns/signature_verification.rb @@ -80,7 +80,7 @@ module SignatureVerification fail_with! "Verification failed for #{actor.to_log_human_identifier} #{actor.uri} using rsa-sha256 (RSASSA-PKCS1-v1_5 with SHA-256)", signed_string: compare_signed_string, signature: signature_params['signature'] rescue SignatureVerificationError => e fail_with! e.message - rescue HTTP::Error, OpenSSL::SSL::SSLError => e + rescue *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError => e fail_with! "Failed to fetch remote data: #{e.message}" rescue Mastodon::UnexpectedResponseError fail_with! 'Failed to fetch remote data (got unexpected reply from server)' diff --git a/app/controllers/media_proxy_controller.rb b/app/controllers/media_proxy_controller.rb index c4230d62c3..09a28c7e37 100644 --- a/app/controllers/media_proxy_controller.rb +++ b/app/controllers/media_proxy_controller.rb @@ -13,7 +13,7 @@ class MediaProxyController < ApplicationController rescue_from ActiveRecord::RecordInvalid, with: :not_found rescue_from Mastodon::UnexpectedResponseError, with: :not_found rescue_from Mastodon::NotPermittedError, with: :not_found - rescue_from HTTP::TimeoutError, HTTP::ConnectionError, OpenSSL::SSL::SSLError, with: :internal_server_error + rescue_from(*Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError, with: :internal_server_error) def show with_redis_lock("media_download:#{params[:id]}") do diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb index 928803cd64..fd836f2305 100644 --- a/app/lib/activitypub/activity/create.rb +++ b/app/lib/activitypub/activity/create.rb @@ -199,7 +199,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity return if account.nil? @mentions << Mention.new(account: account, silent: false) - rescue Mastodon::UnexpectedResponseError, HTTP::TimeoutError, HTTP::ConnectionError, OpenSSL::SSL::SSLError + rescue Mastodon::UnexpectedResponseError, *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError @unresolved_mentions << tag['href'] end @@ -250,7 +250,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity media_attachment.download_file! media_attachment.download_thumbnail! media_attachment.save - rescue Mastodon::UnexpectedResponseError, HTTP::TimeoutError, HTTP::ConnectionError, OpenSSL::SSL::SSLError + rescue Mastodon::UnexpectedResponseError, *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError RedownloadMediaWorker.perform_in(rand(30..600).seconds, media_attachment.id) rescue Seahorse::Client::NetworkingError => e Rails.logger.warn "Error storing media attachment: #{e}" diff --git a/app/models/account_alias.rb b/app/models/account_alias.rb index 3b75919afe..a4a7427e24 100644 --- a/app/models/account_alias.rb +++ b/app/models/account_alias.rb @@ -35,7 +35,7 @@ class AccountAlias < ApplicationRecord def set_uri target_account = ResolveAccountService.new.call(acct) self.uri = ActivityPub::TagManager.instance.uri_for(target_account) unless target_account.nil? - rescue Webfinger::Error, HTTP::Error, OpenSSL::SSL::SSLError, Mastodon::Error + rescue Webfinger::Error, *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError, Mastodon::Error # Validation will take care of it end diff --git a/app/models/account_migration.rb b/app/models/account_migration.rb index 7a01e250e2..5df857e3ba 100644 --- a/app/models/account_migration.rb +++ b/app/models/account_migration.rb @@ -61,7 +61,7 @@ class AccountMigration < ApplicationRecord def set_target_account self.target_account = ResolveAccountService.new.call(acct, skip_cache: true) - rescue Webfinger::Error, HTTP::Error, OpenSSL::SSL::SSLError, Mastodon::Error, Addressable::URI::InvalidURIError + rescue Webfinger::Error, *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError, Mastodon::Error, Addressable::URI::InvalidURIError # Validation will take care of it end diff --git a/app/models/concerns/remotable.rb b/app/models/concerns/remotable.rb index 8382c91599..80a99b35df 100644 --- a/app/models/concerns/remotable.rb +++ b/app/models/concerns/remotable.rb @@ -26,7 +26,7 @@ module Remotable public_send(:"#{attachment_name}=", ResponseWithLimit.new(response, limit)) end - rescue Mastodon::UnexpectedResponseError, HTTP::TimeoutError, HTTP::ConnectionError, OpenSSL::SSL::SSLError => e + rescue Mastodon::UnexpectedResponseError, *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError => e Rails.logger.debug { "Error fetching remote #{attachment_name}: #{e}" } public_send(:"#{attachment_name}=", nil) if public_send(:"#{attachment_name}_file_name").present? raise e unless suppress_errors diff --git a/app/models/form/redirect.rb b/app/models/form/redirect.rb index 3cd5731e6d..ecacaa4d94 100644 --- a/app/models/form/redirect.rb +++ b/app/models/form/redirect.rb @@ -32,7 +32,7 @@ class Form::Redirect def set_target_account @target_account = ResolveAccountService.new.call(acct, skip_cache: true) - rescue Webfinger::Error, HTTP::Error, OpenSSL::SSL::SSLError, Mastodon::Error, Addressable::URI::InvalidURIError + rescue Webfinger::Error, *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError, Mastodon::Error, Addressable::URI::InvalidURIError # Validation will take care of it end diff --git a/app/models/remote_follow.rb b/app/models/remote_follow.rb index fa0586f57e..f9719b8670 100644 --- a/app/models/remote_follow.rb +++ b/app/models/remote_follow.rb @@ -66,7 +66,7 @@ class RemoteFollow def acct_resource @acct_resource ||= Webfinger.new("acct:#{acct}").perform - rescue Webfinger::Error, HTTP::ConnectionError + rescue Webfinger::Error, *Mastodon::HTTP_CONNECTION_ERRORS nil end diff --git a/app/services/activitypub/process_account_service.rb b/app/services/activitypub/process_account_service.rb index a7422b5d02..d9482efac1 100644 --- a/app/services/activitypub/process_account_service.rb +++ b/app/services/activitypub/process_account_service.rb @@ -127,13 +127,13 @@ class ActivityPub::ProcessAccountService < BaseService begin @account.avatar_remote_url = image_url('icon') || '' unless skip_download? @account.avatar = nil if @account.avatar_remote_url.blank? - rescue Mastodon::UnexpectedResponseError, HTTP::TimeoutError, HTTP::ConnectionError, OpenSSL::SSL::SSLError + rescue Mastodon::UnexpectedResponseError, *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError RedownloadAvatarWorker.perform_in(rand(30..600).seconds, @account.id) end begin @account.header_remote_url = image_url('image') || '' unless skip_download? @account.header = nil if @account.header_remote_url.blank? - rescue Mastodon::UnexpectedResponseError, HTTP::TimeoutError, HTTP::ConnectionError, OpenSSL::SSL::SSLError + rescue Mastodon::UnexpectedResponseError, *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError RedownloadHeaderWorker.perform_in(rand(30..600).seconds, @account.id) end @account.statuses_count = outbox_total_items if outbox_total_items.present? @@ -276,7 +276,7 @@ class ActivityPub::ProcessAccountService < BaseService total_items = collection.is_a?(Hash) && collection['totalItems'].present? && collection['totalItems'].is_a?(Numeric) ? collection['totalItems'] : nil has_first_page = collection.is_a?(Hash) && collection['first'].present? @collections[type] = [total_items, has_first_page] - rescue HTTP::Error, OpenSSL::SSL::SSLError, Mastodon::LengthValidationError + rescue *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError, Mastodon::LengthValidationError @collections[type] = [nil, nil] end diff --git a/app/services/activitypub/process_status_update_service.rb b/app/services/activitypub/process_status_update_service.rb index 1dbed27f28..9ec3f2b430 100644 --- a/app/services/activitypub/process_status_update_service.rb +++ b/app/services/activitypub/process_status_update_service.rb @@ -109,7 +109,7 @@ class ActivityPub::ProcessStatusUpdateService < BaseService media_attachment.download_file! if media_attachment.remote_url_previously_changed? media_attachment.download_thumbnail! if media_attachment.thumbnail_remote_url_previously_changed? media_attachment.save - rescue Mastodon::UnexpectedResponseError, HTTP::TimeoutError, HTTP::ConnectionError, OpenSSL::SSL::SSLError + rescue Mastodon::UnexpectedResponseError, *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError RedownloadMediaWorker.perform_in(rand(30..600).seconds, media_attachment.id) rescue Seahorse::Client::NetworkingError => e Rails.logger.warn "Error storing media attachment: #{e}" diff --git a/app/services/fetch_link_card_service.rb b/app/services/fetch_link_card_service.rb index 7662fc1f29..bb526099d6 100644 --- a/app/services/fetch_link_card_service.rb +++ b/app/services/fetch_link_card_service.rb @@ -29,7 +29,7 @@ class FetchLinkCardService < BaseService end attach_card if @card&.persisted? - rescue HTTP::Error, OpenSSL::SSL::SSLError, Addressable::URI::InvalidURIError, Mastodon::HostValidationError, Mastodon::LengthValidationError, Encoding::UndefinedConversionError, ActiveRecord::RecordInvalid => e + rescue *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError, Addressable::URI::InvalidURIError, Mastodon::HostValidationError, Mastodon::LengthValidationError, Encoding::UndefinedConversionError, ActiveRecord::RecordInvalid => e Rails.logger.debug { "Error fetching link #{@original_url}: #{e}" } nil end diff --git a/app/services/fetch_resource_service.rb b/app/services/fetch_resource_service.rb index b69015a5e9..949c289b6a 100644 --- a/app/services/fetch_resource_service.rb +++ b/app/services/fetch_resource_service.rb @@ -12,7 +12,7 @@ class FetchResourceService < BaseService return if url.blank? process(url) - rescue HTTP::Error, OpenSSL::SSL::SSLError, Addressable::URI::InvalidURIError, Mastodon::HostValidationError, Mastodon::LengthValidationError => e + rescue *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError, Addressable::URI::InvalidURIError, Mastodon::HostValidationError, Mastodon::LengthValidationError => e Rails.logger.debug { "Error fetching resource #{@url}: #{e}" } nil end diff --git a/app/services/import_service.rb b/app/services/import_service.rb index 6dafb5a0bb..26fabacb96 100644 --- a/app/services/import_service.rb +++ b/app/services/import_service.rb @@ -115,7 +115,7 @@ class ImportService < BaseService next if status.nil? && ActivityPub::TagManager.instance.local_uri?(uri) status || ActivityPub::FetchRemoteStatusService.new.call(uri) - rescue HTTP::Error, OpenSSL::SSL::SSLError, Mastodon::UnexpectedResponseError + rescue *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError, Mastodon::UnexpectedResponseError nil rescue => e Rails.logger.warn "Unexpected error when importing bookmark: #{e}" diff --git a/app/services/process_mentions_service.rb b/app/services/process_mentions_service.rb index 1c4c7805f1..2d3c766304 100644 --- a/app/services/process_mentions_service.rb +++ b/app/services/process_mentions_service.rb @@ -44,7 +44,7 @@ class ProcessMentionsService < BaseService if mention_undeliverable?(mentioned_account) begin mentioned_account = ResolveAccountService.new.call(Regexp.last_match(1)) - rescue Webfinger::Error, HTTP::Error, OpenSSL::SSL::SSLError, Mastodon::UnexpectedResponseError + rescue Webfinger::Error, *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError, Mastodon::UnexpectedResponseError mentioned_account = nil end end diff --git a/app/services/software_update_check_service.rb b/app/services/software_update_check_service.rb index c8ce1753f5..b9818c8199 100644 --- a/app/services/software_update_check_service.rb +++ b/app/services/software_update_check_service.rb @@ -22,7 +22,7 @@ class SoftwareUpdateCheckService < BaseService Request.new(:get, "#{api_url}?version=#{version}").add_headers('Accept' => 'application/json', 'User-Agent' => 'Mastodon update checker').perform do |res| return Oj.load(res.body_with_limit, mode: :strict) if res.code == 200 end - rescue HTTP::Error, OpenSSL::SSL::SSLError, Oj::ParseError + rescue *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError, Oj::ParseError nil end diff --git a/app/services/verify_link_service.rb b/app/services/verify_link_service.rb index c4f4191e1f..af5a5e4a95 100644 --- a/app/services/verify_link_service.rb +++ b/app/services/verify_link_service.rb @@ -10,7 +10,7 @@ class VerifyLinkService < BaseService return unless link_back_present? field.mark_verified! - rescue OpenSSL::SSL::SSLError, HTTP::Error, Addressable::URI::InvalidURIError, Mastodon::HostValidationError, Mastodon::LengthValidationError, IPAddr::AddressFamilyError => e + rescue OpenSSL::SSL::SSLError, *Mastodon::HTTP_CONNECTION_ERRORS, Addressable::URI::InvalidURIError, Mastodon::HostValidationError, Mastodon::LengthValidationError, IPAddr::AddressFamilyError => e Rails.logger.debug { "Error fetching link #{@url}: #{e}" } nil end diff --git a/app/workers/refollow_worker.rb b/app/workers/refollow_worker.rb index 4b712d3aae..078c8502d8 100644 --- a/app/workers/refollow_worker.rb +++ b/app/workers/refollow_worker.rb @@ -21,7 +21,7 @@ class RefollowWorker # Schedule re-follow begin FollowService.new.call(follower, target_account, reblogs: reblogs, notify: notify, languages: languages, bypass_limit: true) - rescue Mastodon::NotPermittedError, ActiveRecord::RecordNotFound, Mastodon::UnexpectedResponseError, HTTP::Error, OpenSSL::SSL::SSLError + rescue Mastodon::NotPermittedError, ActiveRecord::RecordNotFound, Mastodon::UnexpectedResponseError, *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError next end end diff --git a/lib/exceptions.rb b/lib/exceptions.rb index c2ff162a6e..9c32cb6dda 100644 --- a/lib/exceptions.rb +++ b/lib/exceptions.rb @@ -36,4 +36,10 @@ module Mastodon super() end end + + HTTP_CONNECTION_ERRORS = [ + HTTP::ConnectionError, + HTTP::Error, + HTTP::TimeoutError, + ].freeze end diff --git a/lib/mastodon/cli/accounts.rb b/lib/mastodon/cli/accounts.rb index 08a28e5f5c..6f0de0fd6a 100644 --- a/lib/mastodon/cli/accounts.rb +++ b/lib/mastodon/cli/accounts.rb @@ -305,7 +305,7 @@ module Mastodon::CLI begin code = Request.new(:head, account.uri).perform(&:code) - rescue HTTP::TimeoutError, HTTP::ConnectionError, OpenSSL::SSL::SSLError, Mastodon::PrivateNetworkAddressError + rescue *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError, Mastodon::PrivateNetworkAddressError skip_domains << account.domain end From 258dce125668ccac45d6d0958da1c841ab7cfcee Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 8 Oct 2024 10:59:51 -0400 Subject: [PATCH 11/47] Add `OpenSSL::SSL::SSLError` to http connection errors wrapper (#32307) --- app/controllers/application_controller.rb | 2 +- app/controllers/concerns/signature_verification.rb | 2 +- app/controllers/media_proxy_controller.rb | 2 +- app/lib/activitypub/activity/create.rb | 4 ++-- app/models/account_alias.rb | 2 +- app/models/account_migration.rb | 2 +- app/models/concerns/remotable.rb | 2 +- app/models/form/redirect.rb | 2 +- app/services/activitypub/process_account_service.rb | 6 +++--- app/services/activitypub/process_status_update_service.rb | 2 +- app/services/fetch_link_card_service.rb | 2 +- app/services/fetch_resource_service.rb | 2 +- app/services/import_service.rb | 2 +- app/services/process_mentions_service.rb | 2 +- app/services/software_update_check_service.rb | 2 +- app/services/verify_link_service.rb | 2 +- app/workers/refollow_worker.rb | 2 +- lib/exceptions.rb | 1 + lib/mastodon/cli/accounts.rb | 2 +- 19 files changed, 22 insertions(+), 21 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 40cae15b48..d493bd43bf 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -32,7 +32,7 @@ class ApplicationController < ActionController::Base rescue_from ActionController::InvalidAuthenticityToken, with: :unprocessable_entity rescue_from Mastodon::RateLimitExceededError, with: :too_many_requests - rescue_from(*Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError, with: :internal_server_error) + rescue_from(*Mastodon::HTTP_CONNECTION_ERRORS, with: :internal_server_error) rescue_from Mastodon::RaceConditionError, Stoplight::Error::RedLight, ActiveRecord::SerializationFailure, with: :service_unavailable rescue_from Seahorse::Client::NetworkingError do |e| diff --git a/app/controllers/concerns/signature_verification.rb b/app/controllers/concerns/signature_verification.rb index 6773c11099..4ae63632c0 100644 --- a/app/controllers/concerns/signature_verification.rb +++ b/app/controllers/concerns/signature_verification.rb @@ -80,7 +80,7 @@ module SignatureVerification fail_with! "Verification failed for #{actor.to_log_human_identifier} #{actor.uri} using rsa-sha256 (RSASSA-PKCS1-v1_5 with SHA-256)", signed_string: compare_signed_string, signature: signature_params['signature'] rescue SignatureVerificationError => e fail_with! e.message - rescue *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError => e + rescue *Mastodon::HTTP_CONNECTION_ERRORS => e fail_with! "Failed to fetch remote data: #{e.message}" rescue Mastodon::UnexpectedResponseError fail_with! 'Failed to fetch remote data (got unexpected reply from server)' diff --git a/app/controllers/media_proxy_controller.rb b/app/controllers/media_proxy_controller.rb index 09a28c7e37..f68d85e44e 100644 --- a/app/controllers/media_proxy_controller.rb +++ b/app/controllers/media_proxy_controller.rb @@ -13,7 +13,7 @@ class MediaProxyController < ApplicationController rescue_from ActiveRecord::RecordInvalid, with: :not_found rescue_from Mastodon::UnexpectedResponseError, with: :not_found rescue_from Mastodon::NotPermittedError, with: :not_found - rescue_from(*Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError, with: :internal_server_error) + rescue_from(*Mastodon::HTTP_CONNECTION_ERRORS, with: :internal_server_error) def show with_redis_lock("media_download:#{params[:id]}") do diff --git a/app/lib/activitypub/activity/create.rb b/app/lib/activitypub/activity/create.rb index fd836f2305..d04f7226a0 100644 --- a/app/lib/activitypub/activity/create.rb +++ b/app/lib/activitypub/activity/create.rb @@ -199,7 +199,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity return if account.nil? @mentions << Mention.new(account: account, silent: false) - rescue Mastodon::UnexpectedResponseError, *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError + rescue Mastodon::UnexpectedResponseError, *Mastodon::HTTP_CONNECTION_ERRORS @unresolved_mentions << tag['href'] end @@ -250,7 +250,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity media_attachment.download_file! media_attachment.download_thumbnail! media_attachment.save - rescue Mastodon::UnexpectedResponseError, *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError + rescue Mastodon::UnexpectedResponseError, *Mastodon::HTTP_CONNECTION_ERRORS RedownloadMediaWorker.perform_in(rand(30..600).seconds, media_attachment.id) rescue Seahorse::Client::NetworkingError => e Rails.logger.warn "Error storing media attachment: #{e}" diff --git a/app/models/account_alias.rb b/app/models/account_alias.rb index a4a7427e24..41623ddedb 100644 --- a/app/models/account_alias.rb +++ b/app/models/account_alias.rb @@ -35,7 +35,7 @@ class AccountAlias < ApplicationRecord def set_uri target_account = ResolveAccountService.new.call(acct) self.uri = ActivityPub::TagManager.instance.uri_for(target_account) unless target_account.nil? - rescue Webfinger::Error, *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError, Mastodon::Error + rescue Webfinger::Error, *Mastodon::HTTP_CONNECTION_ERRORS, Mastodon::Error # Validation will take care of it end diff --git a/app/models/account_migration.rb b/app/models/account_migration.rb index 5df857e3ba..7bda388f2a 100644 --- a/app/models/account_migration.rb +++ b/app/models/account_migration.rb @@ -61,7 +61,7 @@ class AccountMigration < ApplicationRecord def set_target_account self.target_account = ResolveAccountService.new.call(acct, skip_cache: true) - rescue Webfinger::Error, *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError, Mastodon::Error, Addressable::URI::InvalidURIError + rescue Webfinger::Error, *Mastodon::HTTP_CONNECTION_ERRORS, Mastodon::Error, Addressable::URI::InvalidURIError # Validation will take care of it end diff --git a/app/models/concerns/remotable.rb b/app/models/concerns/remotable.rb index 80a99b35df..15133e7bde 100644 --- a/app/models/concerns/remotable.rb +++ b/app/models/concerns/remotable.rb @@ -26,7 +26,7 @@ module Remotable public_send(:"#{attachment_name}=", ResponseWithLimit.new(response, limit)) end - rescue Mastodon::UnexpectedResponseError, *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError => e + rescue Mastodon::UnexpectedResponseError, *Mastodon::HTTP_CONNECTION_ERRORS => e Rails.logger.debug { "Error fetching remote #{attachment_name}: #{e}" } public_send(:"#{attachment_name}=", nil) if public_send(:"#{attachment_name}_file_name").present? raise e unless suppress_errors diff --git a/app/models/form/redirect.rb b/app/models/form/redirect.rb index ecacaa4d94..c5b3c1f8f3 100644 --- a/app/models/form/redirect.rb +++ b/app/models/form/redirect.rb @@ -32,7 +32,7 @@ class Form::Redirect def set_target_account @target_account = ResolveAccountService.new.call(acct, skip_cache: true) - rescue Webfinger::Error, *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError, Mastodon::Error, Addressable::URI::InvalidURIError + rescue Webfinger::Error, *Mastodon::HTTP_CONNECTION_ERRORS, Mastodon::Error, Addressable::URI::InvalidURIError # Validation will take care of it end diff --git a/app/services/activitypub/process_account_service.rb b/app/services/activitypub/process_account_service.rb index d9482efac1..df6f23c021 100644 --- a/app/services/activitypub/process_account_service.rb +++ b/app/services/activitypub/process_account_service.rb @@ -127,13 +127,13 @@ class ActivityPub::ProcessAccountService < BaseService begin @account.avatar_remote_url = image_url('icon') || '' unless skip_download? @account.avatar = nil if @account.avatar_remote_url.blank? - rescue Mastodon::UnexpectedResponseError, *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError + rescue Mastodon::UnexpectedResponseError, *Mastodon::HTTP_CONNECTION_ERRORS RedownloadAvatarWorker.perform_in(rand(30..600).seconds, @account.id) end begin @account.header_remote_url = image_url('image') || '' unless skip_download? @account.header = nil if @account.header_remote_url.blank? - rescue Mastodon::UnexpectedResponseError, *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError + rescue Mastodon::UnexpectedResponseError, *Mastodon::HTTP_CONNECTION_ERRORS RedownloadHeaderWorker.perform_in(rand(30..600).seconds, @account.id) end @account.statuses_count = outbox_total_items if outbox_total_items.present? @@ -276,7 +276,7 @@ class ActivityPub::ProcessAccountService < BaseService total_items = collection.is_a?(Hash) && collection['totalItems'].present? && collection['totalItems'].is_a?(Numeric) ? collection['totalItems'] : nil has_first_page = collection.is_a?(Hash) && collection['first'].present? @collections[type] = [total_items, has_first_page] - rescue *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError, Mastodon::LengthValidationError + rescue *Mastodon::HTTP_CONNECTION_ERRORS, Mastodon::LengthValidationError @collections[type] = [nil, nil] end diff --git a/app/services/activitypub/process_status_update_service.rb b/app/services/activitypub/process_status_update_service.rb index 9ec3f2b430..141ad24e92 100644 --- a/app/services/activitypub/process_status_update_service.rb +++ b/app/services/activitypub/process_status_update_service.rb @@ -109,7 +109,7 @@ class ActivityPub::ProcessStatusUpdateService < BaseService media_attachment.download_file! if media_attachment.remote_url_previously_changed? media_attachment.download_thumbnail! if media_attachment.thumbnail_remote_url_previously_changed? media_attachment.save - rescue Mastodon::UnexpectedResponseError, *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError + rescue Mastodon::UnexpectedResponseError, *Mastodon::HTTP_CONNECTION_ERRORS RedownloadMediaWorker.perform_in(rand(30..600).seconds, media_attachment.id) rescue Seahorse::Client::NetworkingError => e Rails.logger.warn "Error storing media attachment: #{e}" diff --git a/app/services/fetch_link_card_service.rb b/app/services/fetch_link_card_service.rb index bb526099d6..4141fb43df 100644 --- a/app/services/fetch_link_card_service.rb +++ b/app/services/fetch_link_card_service.rb @@ -29,7 +29,7 @@ class FetchLinkCardService < BaseService end attach_card if @card&.persisted? - rescue *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError, Addressable::URI::InvalidURIError, Mastodon::HostValidationError, Mastodon::LengthValidationError, Encoding::UndefinedConversionError, ActiveRecord::RecordInvalid => e + rescue *Mastodon::HTTP_CONNECTION_ERRORS, Addressable::URI::InvalidURIError, Mastodon::HostValidationError, Mastodon::LengthValidationError, Encoding::UndefinedConversionError, ActiveRecord::RecordInvalid => e Rails.logger.debug { "Error fetching link #{@original_url}: #{e}" } nil end diff --git a/app/services/fetch_resource_service.rb b/app/services/fetch_resource_service.rb index 949c289b6a..911950ccca 100644 --- a/app/services/fetch_resource_service.rb +++ b/app/services/fetch_resource_service.rb @@ -12,7 +12,7 @@ class FetchResourceService < BaseService return if url.blank? process(url) - rescue *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError, Addressable::URI::InvalidURIError, Mastodon::HostValidationError, Mastodon::LengthValidationError => e + rescue *Mastodon::HTTP_CONNECTION_ERRORS, Addressable::URI::InvalidURIError, Mastodon::HostValidationError, Mastodon::LengthValidationError => e Rails.logger.debug { "Error fetching resource #{@url}: #{e}" } nil end diff --git a/app/services/import_service.rb b/app/services/import_service.rb index 26fabacb96..a695df2fc9 100644 --- a/app/services/import_service.rb +++ b/app/services/import_service.rb @@ -115,7 +115,7 @@ class ImportService < BaseService next if status.nil? && ActivityPub::TagManager.instance.local_uri?(uri) status || ActivityPub::FetchRemoteStatusService.new.call(uri) - rescue *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError, Mastodon::UnexpectedResponseError + rescue *Mastodon::HTTP_CONNECTION_ERRORS, Mastodon::UnexpectedResponseError nil rescue => e Rails.logger.warn "Unexpected error when importing bookmark: #{e}" diff --git a/app/services/process_mentions_service.rb b/app/services/process_mentions_service.rb index 2d3c766304..3839eb4df4 100644 --- a/app/services/process_mentions_service.rb +++ b/app/services/process_mentions_service.rb @@ -44,7 +44,7 @@ class ProcessMentionsService < BaseService if mention_undeliverable?(mentioned_account) begin mentioned_account = ResolveAccountService.new.call(Regexp.last_match(1)) - rescue Webfinger::Error, *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError, Mastodon::UnexpectedResponseError + rescue Webfinger::Error, *Mastodon::HTTP_CONNECTION_ERRORS, Mastodon::UnexpectedResponseError mentioned_account = nil end end diff --git a/app/services/software_update_check_service.rb b/app/services/software_update_check_service.rb index b9818c8199..24a6955b88 100644 --- a/app/services/software_update_check_service.rb +++ b/app/services/software_update_check_service.rb @@ -22,7 +22,7 @@ class SoftwareUpdateCheckService < BaseService Request.new(:get, "#{api_url}?version=#{version}").add_headers('Accept' => 'application/json', 'User-Agent' => 'Mastodon update checker').perform do |res| return Oj.load(res.body_with_limit, mode: :strict) if res.code == 200 end - rescue *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError, Oj::ParseError + rescue *Mastodon::HTTP_CONNECTION_ERRORS, Oj::ParseError nil end diff --git a/app/services/verify_link_service.rb b/app/services/verify_link_service.rb index af5a5e4a95..17c86426be 100644 --- a/app/services/verify_link_service.rb +++ b/app/services/verify_link_service.rb @@ -10,7 +10,7 @@ class VerifyLinkService < BaseService return unless link_back_present? field.mark_verified! - rescue OpenSSL::SSL::SSLError, *Mastodon::HTTP_CONNECTION_ERRORS, Addressable::URI::InvalidURIError, Mastodon::HostValidationError, Mastodon::LengthValidationError, IPAddr::AddressFamilyError => e + rescue *Mastodon::HTTP_CONNECTION_ERRORS, Addressable::URI::InvalidURIError, Mastodon::HostValidationError, Mastodon::LengthValidationError, IPAddr::AddressFamilyError => e Rails.logger.debug { "Error fetching link #{@url}: #{e}" } nil end diff --git a/app/workers/refollow_worker.rb b/app/workers/refollow_worker.rb index 078c8502d8..7b26e4a062 100644 --- a/app/workers/refollow_worker.rb +++ b/app/workers/refollow_worker.rb @@ -21,7 +21,7 @@ class RefollowWorker # Schedule re-follow begin FollowService.new.call(follower, target_account, reblogs: reblogs, notify: notify, languages: languages, bypass_limit: true) - rescue Mastodon::NotPermittedError, ActiveRecord::RecordNotFound, Mastodon::UnexpectedResponseError, *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError + rescue Mastodon::NotPermittedError, ActiveRecord::RecordNotFound, Mastodon::UnexpectedResponseError, *Mastodon::HTTP_CONNECTION_ERRORS next end end diff --git a/lib/exceptions.rb b/lib/exceptions.rb index 9c32cb6dda..1910d37a13 100644 --- a/lib/exceptions.rb +++ b/lib/exceptions.rb @@ -41,5 +41,6 @@ module Mastodon HTTP::ConnectionError, HTTP::Error, HTTP::TimeoutError, + OpenSSL::SSL::SSLError, ].freeze end diff --git a/lib/mastodon/cli/accounts.rb b/lib/mastodon/cli/accounts.rb index 6f0de0fd6a..e76735298f 100644 --- a/lib/mastodon/cli/accounts.rb +++ b/lib/mastodon/cli/accounts.rb @@ -305,7 +305,7 @@ module Mastodon::CLI begin code = Request.new(:head, account.uri).perform(&:code) - rescue *Mastodon::HTTP_CONNECTION_ERRORS, OpenSSL::SSL::SSLError, Mastodon::PrivateNetworkAddressError + rescue *Mastodon::HTTP_CONNECTION_ERRORS, Mastodon::PrivateNetworkAddressError skip_domains << account.domain end From 7033b3476e066bda836848da20b7caa96ebaa98d Mon Sep 17 00:00:00 2001 From: Claire Date: Tue, 8 Oct 2024 19:10:59 +0200 Subject: [PATCH 12/47] Fix discrepancy with upstream regarding `latest` docker image tag (#2877) --- .github/workflows/build-security.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-security.yml b/.github/workflows/build-security.yml index e9f1862f5d..37c8ba59a3 100644 --- a/.github/workflows/build-security.yml +++ b/.github/workflows/build-security.yml @@ -32,7 +32,7 @@ jobs: labels: | org.opencontainers.image.description=Nightly build image used for testing purposes flavor: | - latest=true + latest=auto tags: | type=raw,value=edge type=raw,value=nightly @@ -53,7 +53,7 @@ jobs: labels: | org.opencontainers.image.description=Nightly build image used for testing purposes flavor: | - latest=true + latest=auto tags: | type=raw,value=edge type=raw,value=nightly From 0d91db3d77b0376cd4e17cbdb62585dfa2847fbd Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 9 Oct 2024 14:13:32 +0200 Subject: [PATCH 13/47] Fix `latest` tag for 4.3 docker image builds (#32350) --- .github/workflows/build-releases.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-releases.yml b/.github/workflows/build-releases.yml index 3f0bef32ac..da9a458282 100644 --- a/.github/workflows/build-releases.yml +++ b/.github/workflows/build-releases.yml @@ -23,7 +23,7 @@ jobs: # Only tag with latest when ran against the latest stable branch # This needs to be updated after each minor version release flavor: | - latest=${{ startsWith(github.ref, 'refs/tags/v4.2.') }} + latest=${{ startsWith(github.ref, 'refs/tags/v4.3.') }} tags: | type=pep440,pattern={{raw}} type=pep440,pattern=v{{major}}.{{minor}} From 6d6565eee720c961bfe1ef56f289f0b0a0c0fbb4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 9 Oct 2024 16:24:24 +0200 Subject: [PATCH 14/47] Update dependency express to v4.21.1 (#32336) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/yarn.lock b/yarn.lock index 5fc15f27e0..0c62c70f92 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6392,10 +6392,10 @@ __metadata: languageName: node linkType: hard -"cookie@npm:0.6.0": - version: 0.6.0 - resolution: "cookie@npm:0.6.0" - checksum: 10c0/f2318b31af7a31b4ddb4a678d024514df5e705f9be5909a192d7f116cfb6d45cbacf96a473fa733faa95050e7cff26e7832bb3ef94751592f1387b71c8956686 +"cookie@npm:0.7.1": + version: 0.7.1 + resolution: "cookie@npm:0.7.1" + checksum: 10c0/5de60c67a410e7c8dc8a46a4b72eb0fe925871d057c9a5d2c0e8145c4270a4f81076de83410c4d397179744b478e33cd80ccbcc457abf40a9409ad27dcd21dde languageName: node linkType: hard @@ -8396,15 +8396,15 @@ __metadata: linkType: hard "express@npm:^4.17.1, express@npm:^4.18.2": - version: 4.21.0 - resolution: "express@npm:4.21.0" + version: 4.21.1 + resolution: "express@npm:4.21.1" dependencies: accepts: "npm:~1.3.8" array-flatten: "npm:1.1.1" body-parser: "npm:1.20.3" content-disposition: "npm:0.5.4" content-type: "npm:~1.0.4" - cookie: "npm:0.6.0" + cookie: "npm:0.7.1" cookie-signature: "npm:1.0.6" debug: "npm:2.6.9" depd: "npm:2.0.0" @@ -8430,7 +8430,7 @@ __metadata: type-is: "npm:~1.6.18" utils-merge: "npm:1.0.1" vary: "npm:~1.1.2" - checksum: 10c0/4cf7ca328f3fdeb720f30ccb2ea7708bfa7d345f9cc460b64a82bf1b2c91e5b5852ba15a9a11b2a165d6089acf83457fc477dc904d59cd71ed34c7a91762c6cc + checksum: 10c0/0c287867e5f6129d3def1edd9b63103a53c40d4dc8628839d4b6827e35eb8f0de5a4656f9d85f4457eba584f9871ebb2ad26c750b36bd75d9bbb8bcebdc4892c languageName: node linkType: hard From c574f5b53fd13d2668a3730f7d3257fdafca0220 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 9 Oct 2024 18:36:19 +0200 Subject: [PATCH 15/47] Change how migrations duplicated between glitch and upstream are handled (#2878) --- config/initializers/0_duplicate_migrations.rb | 56 ------------------- ...20180410220657_glitch_create_bookmarks.rb} | 11 ++-- db/migrate/20180831171112_create_bookmarks.rb | 11 +++- 3 files changed, 15 insertions(+), 63 deletions(-) delete mode 100644 config/initializers/0_duplicate_migrations.rb rename db/migrate/{20180410220657_create_bookmarks.rb => 20180410220657_glitch_create_bookmarks.rb} (70%) diff --git a/config/initializers/0_duplicate_migrations.rb b/config/initializers/0_duplicate_migrations.rb deleted file mode 100644 index f993571877..0000000000 --- a/config/initializers/0_duplicate_migrations.rb +++ /dev/null @@ -1,56 +0,0 @@ -# frozen_string_literal: true - -# Some migrations have been present in glitch-soc for a long time and have then -# been merged in upstream Mastodon, under a different version number. -# -# This puts us in an uneasy situation in which if we remove upstream's -# migration file, people migrating from upstream will end up having a conflict -# with their already-ran migration. -# -# On the other hand, if we keep upstream's migration and remove our own, -# any current glitch-soc user will have a conflict during migration. -# -# For lack of a better solution, as those migrations are indeed identical, -# we decided monkey-patching Rails' Migrator to completely ignore the duplicate, -# keeping only the one that has run, or an arbitrary one. - -ALLOWED_DUPLICATES = [2018_04_10_220657, 2018_08_31_171112].freeze - -module ActiveRecord - class Migrator - def self.new(direction, migrations, schema_migration, internal_metadata, target_version = nil) - migrated = Set.new(Base.connection.migration_context.get_all_versions) - - migrations.group_by(&:name).each_value do |duplicates| - next unless duplicates.length > 1 && duplicates.all? { |m| ALLOWED_DUPLICATES.include?(m.version) } - - # We have a set of allowed duplicates. Keep the migrated one, if any. - non_migrated = duplicates.reject { |m| migrated.include?(m.version.to_i) } - - migrations = begin - if duplicates.length == non_migrated.length || non_migrated.empty? - # There weren't any migrated one, so we have to pick one “canonical” migration - migrations - duplicates[1..] - else - # Just reject every duplicate which hasn't been migrated yet - migrations - non_migrated - end - end - end - - super - end - end - - class MigrationContext - def needs_migration? - # A set of duplicated migrations is considered migrated if at least one of - # them is migrated. - migrated = get_all_versions - migrations.group_by(&:name).each_value do |duplicates| - return true unless duplicates.any? { |m| migrated.include?(m.version.to_i) } - end - false - end - end -end diff --git a/db/migrate/20180410220657_create_bookmarks.rb b/db/migrate/20180410220657_glitch_create_bookmarks.rb similarity index 70% rename from db/migrate/20180410220657_create_bookmarks.rb rename to db/migrate/20180410220657_glitch_create_bookmarks.rb index aba21f5eaa..5a2e0d35e5 100644 --- a/db/migrate/20180410220657_create_bookmarks.rb +++ b/db/migrate/20180410220657_glitch_create_bookmarks.rb @@ -1,10 +1,11 @@ # frozen_string_literal: true -# This migration is a duplicate of 20180831171112 and may get ignored, see -# config/initializers/0_duplicate_migrations.rb +# This migration is a duplicate of 20180831171112 + +class GlitchCreateBookmarks < ActiveRecord::Migration[5.1] + def up + return if table_exists?(:bookmarks) -class CreateBookmarks < ActiveRecord::Migration[5.1] - def change create_table :bookmarks do |t| t.references :account, null: false t.references :status, null: false @@ -19,4 +20,6 @@ class CreateBookmarks < ActiveRecord::Migration[5.1] add_index :bookmarks, [:account_id, :status_id], unique: true end + + def down; end end diff --git a/db/migrate/20180831171112_create_bookmarks.rb b/db/migrate/20180831171112_create_bookmarks.rb index 4fa4c323d6..88fb75a597 100644 --- a/db/migrate/20180831171112_create_bookmarks.rb +++ b/db/migrate/20180831171112_create_bookmarks.rb @@ -1,10 +1,11 @@ # frozen_string_literal: true -# This migration is a duplicate of 20180410220657 and may get ignored, see -# config/initializers/0_duplicate_migrations.rb +# This migration is a duplicate of 20180410220657 class CreateBookmarks < ActiveRecord::Migration[5.2] - def change + def up + return if table_exists?(:bookmarks) + create_table :bookmarks do |t| t.references :account, null: false t.references :status, null: false @@ -19,4 +20,8 @@ class CreateBookmarks < ActiveRecord::Migration[5.2] add_index :bookmarks, [:account_id, :status_id], unique: true end + + def down + drop_table :bookmarks + end end From fda52b2a521af9b743d97ae35964ec6fc0e97879 Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 9 Oct 2024 19:16:57 +0200 Subject: [PATCH 16/47] Fix 4 columns barely not fitting on 1920px screen (#32361) --- app/javascript/styles/mastodon/components.scss | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss index 4ed05ead3f..6e386ff687 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -2863,7 +2863,7 @@ $ui-header-logo-wordmark-width: 99px; } .column { - width: 400px; + width: clamp(380px, calc((100% - 350px) / 4), 400px); position: relative; box-sizing: border-box; display: flex; From 03dbebdfef47eda19b1b86e56004119f723e667e Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 9 Oct 2024 19:24:22 +0200 Subject: [PATCH 17/47] Fix list edition modal styling (#32358) --- .../styles/mastodon/components.scss | 111 ++++++++---------- 1 file changed, 50 insertions(+), 61 deletions(-) diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss index 6e386ff687..78e5290139 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -7961,7 +7961,6 @@ noscript { justify-content: flex-start; gap: 15px; align-items: center; - border: 1px solid var(--background-border-color); border-top: 0; label { @@ -7988,79 +7987,23 @@ noscript { background: rgba($base-overlay-background, 0.5); } +.list-adder, .list-editor { - background: $ui-base-color; + backdrop-filter: var(--background-filter); + background: var(--modal-background-color); + border: 1px solid var(--modal-border-color); flex-direction: column; border-radius: 8px; - box-shadow: 2px 4px 15px rgba($base-shadow-color, 0.4); width: 380px; overflow: hidden; @media screen and (width <= 420px) { width: 90%; } - - h4 { - padding: 15px 0; - background: lighten($ui-base-color, 13%); - font-weight: 500; - font-size: 16px; - text-align: center; - border-radius: 8px 8px 0 0; - } - - .drawer__pager { - height: 50vh; - border-radius: 4px; - } - - .drawer__inner { - border-radius: 0 0 8px 8px; - - &.backdrop { - width: calc(100% - 60px); - box-shadow: 2px 4px 15px rgba($base-shadow-color, 0.4); - border-radius: 0 0 0 8px; - } - } - - &__accounts { - overflow-y: auto; - } - - .account__display-name { - &:hover strong { - text-decoration: none; - } - } - - .account__avatar { - cursor: default; - } - - .search { - margin-bottom: 0; - } } .list-adder { - background: $ui-base-color; - flex-direction: column; - border-radius: 8px; - box-shadow: 2px 4px 15px rgba($base-shadow-color, 0.4); - width: 380px; - overflow: hidden; - - @media screen and (width <= 420px) { - width: 90%; - } - - &__account { - background: lighten($ui-base-color, 13%); - } - &__lists { - background: lighten($ui-base-color, 13%); height: 50vh; border-radius: 0 0 8px 8px; overflow-y: auto; @@ -8081,6 +8024,52 @@ noscript { text-decoration: none; font-size: 16px; padding: 10px; + display: flex; + align-items: center; + gap: 4px; + } +} + +.list-editor { + h4 { + padding: 15px 0; + background: lighten($ui-base-color, 13%); + font-weight: 500; + font-size: 16px; + text-align: center; + border-radius: 8px 8px 0 0; + } + + .drawer__pager { + height: 50vh; + border: 0; + } + + .drawer__inner { + &.backdrop { + width: calc(100% - 60px); + box-shadow: 2px 4px 15px rgba($base-shadow-color, 0.4); + border-radius: 0 0 0 8px; + } + } + + &__accounts { + background: unset; + overflow-y: auto; + } + + .account__display-name { + &:hover strong { + text-decoration: none; + } + } + + .account__avatar { + cursor: default; + } + + .search { + margin-bottom: 0; } } From d9fbb071da1904f3a4da90d055368f47b174224c Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 9 Oct 2024 19:29:02 +0200 Subject: [PATCH 18/47] Fix notification requests from suspended accounts still being listed (#32354) --- .../v1/notifications/requests_controller.rb | 2 +- app/models/notification_policy.rb | 2 +- app/models/notification_request.rb | 2 ++ spec/models/notification_policy_spec.rb | 18 ++++++++++++------ 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/app/controllers/api/v1/notifications/requests_controller.rb b/app/controllers/api/v1/notifications/requests_controller.rb index 36ee073b9c..3c90f13ce2 100644 --- a/app/controllers/api/v1/notifications/requests_controller.rb +++ b/app/controllers/api/v1/notifications/requests_controller.rb @@ -52,7 +52,7 @@ class Api::V1::Notifications::RequestsController < Api::BaseController private def load_requests - requests = NotificationRequest.where(account: current_account).includes(:last_status, from_account: [:account_stat, :user]).to_a_paginated_by_id( + requests = NotificationRequest.where(account: current_account).without_suspended.includes(:last_status, from_account: [:account_stat, :user]).to_a_paginated_by_id( limit_param(DEFAULT_ACCOUNTS_LIMIT), params_slice(:max_id, :since_id, :min_id) ) diff --git a/app/models/notification_policy.rb b/app/models/notification_policy.rb index 3b16f33d88..d22f871a37 100644 --- a/app/models/notification_policy.rb +++ b/app/models/notification_policy.rb @@ -62,6 +62,6 @@ class NotificationPolicy < ApplicationRecord private def pending_notification_requests - @pending_notification_requests ||= notification_requests.limit(MAX_MEANINGFUL_COUNT).pick(Arel.sql('count(*), coalesce(sum(notifications_count), 0)::bigint')) + @pending_notification_requests ||= notification_requests.without_suspended.limit(MAX_MEANINGFUL_COUNT).pick(Arel.sql('count(*), coalesce(sum(notifications_count), 0)::bigint')) end end diff --git a/app/models/notification_request.rb b/app/models/notification_request.rb index f0778b3af3..eb9ff93ab7 100644 --- a/app/models/notification_request.rb +++ b/app/models/notification_request.rb @@ -26,6 +26,8 @@ class NotificationRequest < ApplicationRecord before_save :prepare_notifications_count + scope :without_suspended, -> { joins(:from_account).merge(Account.without_suspended) } + def self.preload_cache_collection(requests) cached_statuses_by_id = yield(requests.filter_map(&:last_status)).index_by(&:id) # Call cache_collection in block diff --git a/spec/models/notification_policy_spec.rb b/spec/models/notification_policy_spec.rb index 02a582bb08..7d1b494dd5 100644 --- a/spec/models/notification_policy_spec.rb +++ b/spec/models/notification_policy_spec.rb @@ -7,19 +7,25 @@ RSpec.describe NotificationPolicy do subject { Fabricate(:notification_policy) } let(:sender) { Fabricate(:account) } + let(:suspended_sender) { Fabricate(:account) } before do Fabricate.times(2, :notification, account: subject.account, activity: Fabricate(:status, account: sender), filtered: true, type: :mention) Fabricate(:notification_request, account: subject.account, from_account: sender) + + Fabricate(:notification, account: subject.account, activity: Fabricate(:status, account: suspended_sender), filtered: true, type: :mention) + Fabricate(:notification_request, account: subject.account, from_account: suspended_sender) + + suspended_sender.suspend! + subject.summarize! end - it 'sets pending_requests_count' do - expect(subject.pending_requests_count).to eq 1 - end - - it 'sets pending_notifications_count' do - expect(subject.pending_notifications_count).to eq 2 + it 'sets pending_requests_count and pending_notifications_count' do + expect(subject).to have_attributes( + pending_requests_count: 1, + pending_notifications_count: 2 + ) end end end From cdf603239e8bc78b4f7c06e3df96da6e6d7c7a57 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Wed, 9 Oct 2024 14:33:28 -0500 Subject: [PATCH 19/47] Restore list column border (#32367) --- app/javascript/styles/mastodon/components.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/app/javascript/styles/mastodon/components.scss b/app/javascript/styles/mastodon/components.scss index 78e5290139..1f69dab7be 100644 --- a/app/javascript/styles/mastodon/components.scss +++ b/app/javascript/styles/mastodon/components.scss @@ -7961,6 +7961,7 @@ noscript { justify-content: flex-start; gap: 15px; align-items: center; + border: 1px solid var(--background-border-color); border-top: 0; label { From a5a3733c9772424c29735b2ae1542e270186d24c Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 10 Oct 2024 13:04:38 +0200 Subject: [PATCH 20/47] =?UTF-8?q?Fix=20=E2=80=9CMention=E2=80=9D=20appeari?= =?UTF-8?q?ng=20for=20otherwise=20filtered=20posts=20(#32356)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/notification_with_status.tsx | 9 +++- app/javascript/mastodon/selectors/filters.ts | 50 +++++++++++++++++++ app/javascript/mastodon/selectors/index.js | 15 +----- 3 files changed, 60 insertions(+), 14 deletions(-) create mode 100644 app/javascript/mastodon/selectors/filters.ts diff --git a/app/javascript/mastodon/features/notifications_v2/components/notification_with_status.tsx b/app/javascript/mastodon/features/notifications_v2/components/notification_with_status.tsx index a1c275a1f3..3e6428287d 100644 --- a/app/javascript/mastodon/features/notifications_v2/components/notification_with_status.tsx +++ b/app/javascript/mastodon/features/notifications_v2/components/notification_with_status.tsx @@ -13,6 +13,7 @@ import { import type { IconProp } from 'mastodon/components/icon'; import { Icon } from 'mastodon/components/icon'; import Status from 'mastodon/containers/status_container'; +import { getStatusHidden } from 'mastodon/selectors/filters'; import { useAppSelector, useAppDispatch } from 'mastodon/store'; import { DisplayedName } from './displayed_name'; @@ -48,6 +49,12 @@ export const NotificationWithStatus: React.FC<{ (state) => state.statuses.getIn([statusId, 'visibility']) === 'direct', ); + const isFiltered = useAppSelector( + (state) => + statusId && + getStatusHidden(state, { id: statusId, contextType: 'notifications' }), + ); + const handlers = useMemo( () => ({ open: () => { @@ -73,7 +80,7 @@ export const NotificationWithStatus: React.FC<{ [dispatch, statusId], ); - if (!statusId) return null; + if (!statusId || isFiltered) return null; return ( diff --git a/app/javascript/mastodon/selectors/filters.ts b/app/javascript/mastodon/selectors/filters.ts new file mode 100644 index 0000000000..f84d01216a --- /dev/null +++ b/app/javascript/mastodon/selectors/filters.ts @@ -0,0 +1,50 @@ +import { createSelector } from '@reduxjs/toolkit'; + +import type { RootState } from 'mastodon/store'; +import { toServerSideType } from 'mastodon/utils/filters'; + +// TODO: move to `app/javascript/mastodon/models` and use more globally +type Filter = Immutable.Map; + +// TODO: move to `app/javascript/mastodon/models` and use more globally +type FilterResult = Immutable.Map; + +export const getFilters = createSelector( + [ + (state: RootState) => state.filters as Immutable.Map, + (_, { contextType }: { contextType: string }) => contextType, + ], + (filters, contextType) => { + if (!contextType) { + return null; + } + + const now = new Date(); + const serverSideType = toServerSideType(contextType); + + return filters.filter((filter) => { + const context = filter.get('context') as Immutable.List; + const expiration = filter.get('expires_at') as Date | null; + return ( + context.includes(serverSideType) && + (expiration === null || expiration > now) + ); + }); + }, +); + +export const getStatusHidden = ( + state: RootState, + { id, contextType }: { id: string; contextType: string }, +) => { + const filters = getFilters(state, { contextType }); + if (filters === null) return false; + + const filtered = state.statuses.getIn([id, 'filtered']) as + | Immutable.List + | undefined; + return filtered?.some( + (result) => + filters.getIn([result.get('filter'), 'filter_action']) === 'hide', + ); +}; diff --git a/app/javascript/mastodon/selectors/index.js b/app/javascript/mastodon/selectors/index.js index 10e1b167ca..345ceac49a 100644 --- a/app/javascript/mastodon/selectors/index.js +++ b/app/javascript/mastodon/selectors/index.js @@ -1,23 +1,12 @@ import { createSelector } from '@reduxjs/toolkit'; import { List as ImmutableList, Map as ImmutableMap } from 'immutable'; -import { toServerSideType } from 'mastodon/utils/filters'; - import { me } from '../initial_state'; +import { getFilters } from './filters'; + export { makeGetAccount } from "./accounts"; -const getFilters = createSelector([state => state.get('filters'), (_, { contextType }) => contextType], (filters, contextType) => { - if (!contextType) { - return null; - } - - const now = new Date(); - const serverSideType = toServerSideType(contextType); - - return filters.filter(filter => filter.get('context').includes(serverSideType) && (filter.get('expires_at') === null || filter.get('expires_at') > now)); -}); - export const makeGetStatus = () => { return createSelector( [ From 9350cd31d74486c0b6a523f497a353350792b955 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 10 Oct 2024 13:21:48 +0000 Subject: [PATCH 21/47] Update dependency postcss-preset-env to v10.0.7 (#32389) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 388 ++++++++++++++++++++++++++++-------------------------- 1 file changed, 199 insertions(+), 189 deletions(-) diff --git a/yarn.lock b/yarn.lock index 0c62c70f92..548d94fc2e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1533,13 +1533,13 @@ __metadata: languageName: node linkType: hard -"@csstools/cascade-layer-name-parser@npm:^2.0.1": - version: 2.0.1 - resolution: "@csstools/cascade-layer-name-parser@npm:2.0.1" +"@csstools/cascade-layer-name-parser@npm:^2.0.2": + version: 2.0.2 + resolution: "@csstools/cascade-layer-name-parser@npm:2.0.2" peerDependencies: - "@csstools/css-parser-algorithms": ^3.0.1 - "@csstools/css-tokenizer": ^3.0.1 - checksum: 10c0/e1f9030285d1a16ca0424018289e5288e58dee2d6f6cc392e27d9e8eca0deeea4ced9b749eef09a8322746cb15b6304bc7e2d04bb9dc7405c29b3717ec80e736 + "@csstools/css-parser-algorithms": ^3.0.2 + "@csstools/css-tokenizer": ^3.0.2 + checksum: 10c0/2cc840445328400bb3e1e4186e6081e6519a23d9abde36a16c95892b6ad75155b3af3410d79fdda1c53a068384f970cabff4b5f5ba6867578168cbd3419016c8 languageName: node linkType: hard @@ -1550,42 +1550,42 @@ __metadata: languageName: node linkType: hard -"@csstools/css-calc@npm:^2.0.1": - version: 2.0.1 - resolution: "@csstools/css-calc@npm:2.0.1" +"@csstools/css-calc@npm:^2.0.2": + version: 2.0.2 + resolution: "@csstools/css-calc@npm:2.0.2" peerDependencies: - "@csstools/css-parser-algorithms": ^3.0.1 - "@csstools/css-tokenizer": ^3.0.1 - checksum: 10c0/84c0ba3dac51466c9ac22c3540360f6058cf351a3676d71d4412584b165a91abc7c69a4ddf5a5dacc6e6082806d2317cf50ddbc0a0562275b2aedaee41cb87a9 + "@csstools/css-parser-algorithms": ^3.0.2 + "@csstools/css-tokenizer": ^3.0.2 + checksum: 10c0/b36e655b4abc8ea39b300725e33cd43b1875d759dd60bee8155bf7841065615a7f24cf53199382e30aa10bb137f64021043e4af7e11b7199b674a6e6cf3ccd01 languageName: node linkType: hard -"@csstools/css-color-parser@npm:^3.0.2": - version: 3.0.2 - resolution: "@csstools/css-color-parser@npm:3.0.2" +"@csstools/css-color-parser@npm:^3.0.3": + version: 3.0.3 + resolution: "@csstools/css-color-parser@npm:3.0.3" dependencies: "@csstools/color-helpers": "npm:^5.0.1" - "@csstools/css-calc": "npm:^2.0.1" + "@csstools/css-calc": "npm:^2.0.2" peerDependencies: - "@csstools/css-parser-algorithms": ^3.0.1 - "@csstools/css-tokenizer": ^3.0.1 - checksum: 10c0/31f42cc22426c937f5c6999889f72b40aec8504189a6badf3319552f27a5af73dd5f46be9ebc54eb87e526468eb2546ffbd60a6879fe599efa6c98e51d6cfa3d + "@csstools/css-parser-algorithms": ^3.0.2 + "@csstools/css-tokenizer": ^3.0.2 + checksum: 10c0/02367ffc222254132c47f9cbc856f65fe0b81ee4a5e7381251b95c4064138b5ed99a5e5a79c0c8689f9e75e3d900f94773258a161a97f467c3f0420838c10e04 languageName: node linkType: hard -"@csstools/css-parser-algorithms@npm:^3.0.1": - version: 3.0.1 - resolution: "@csstools/css-parser-algorithms@npm:3.0.1" +"@csstools/css-parser-algorithms@npm:^3.0.1, @csstools/css-parser-algorithms@npm:^3.0.2": + version: 3.0.2 + resolution: "@csstools/css-parser-algorithms@npm:3.0.2" peerDependencies: - "@csstools/css-tokenizer": ^3.0.1 - checksum: 10c0/064c6d519197b5af43bbf5efe8f4cdbd361b006113aa82160d637e925b50c643a52d33d512ca01c63042d952d723a2a10798231a714668356b76668fb11294e3 + "@csstools/css-tokenizer": ^3.0.2 + checksum: 10c0/246afbf518ee9eaa24ed7f083360eb66884f1172fd4f8c663bff8c6099de2a8abd1e2a31d5b6fe42e010277d238469d780cff62bc7fdc6a52e7a90626b8924dc languageName: node linkType: hard -"@csstools/css-tokenizer@npm:^3.0.1": - version: 3.0.1 - resolution: "@csstools/css-tokenizer@npm:3.0.1" - checksum: 10c0/c9ed4373e5731b5375ea9791590081019c04e95f08b46b272977e5e7b8c3d560affc62e82263cb8def1df1e57f0673140e7e16a14a5e7be04e6a234be088d1d3 +"@csstools/css-tokenizer@npm:^3.0.1, @csstools/css-tokenizer@npm:^3.0.2": + version: 3.0.2 + resolution: "@csstools/css-tokenizer@npm:3.0.2" + checksum: 10c0/a74e5829420ed35982fd33be272c2a19cb2380179d357abe750aa848be6d6699d0437008f47a57eb7c6ff64a34b0c8f91a97dd63dbddd08249b7cf7983767e5e languageName: node linkType: hard @@ -1599,6 +1599,16 @@ __metadata: languageName: node linkType: hard +"@csstools/media-query-list-parser@npm:^4.0.0": + version: 4.0.0 + resolution: "@csstools/media-query-list-parser@npm:4.0.0" + peerDependencies: + "@csstools/css-parser-algorithms": ^3.0.2 + "@csstools/css-tokenizer": ^3.0.2 + checksum: 10c0/416417bcfd84c18a2df8dc77f31c87830e151dc20530fe7f0d8f13a0848b1a9090858abdf7792d82bf2edb41ddedb7b57b34eb78b68b5c10755ae02c019e496a + languageName: node + linkType: hard + "@csstools/postcss-cascade-layers@npm:^5.0.0": version: 5.0.0 resolution: "@csstools/postcss-cascade-layers@npm:5.0.0" @@ -1611,60 +1621,60 @@ __metadata: languageName: node linkType: hard -"@csstools/postcss-color-function@npm:^4.0.2": - version: 4.0.2 - resolution: "@csstools/postcss-color-function@npm:4.0.2" +"@csstools/postcss-color-function@npm:^4.0.3": + version: 4.0.3 + resolution: "@csstools/postcss-color-function@npm:4.0.3" dependencies: - "@csstools/css-color-parser": "npm:^3.0.2" - "@csstools/css-parser-algorithms": "npm:^3.0.1" - "@csstools/css-tokenizer": "npm:^3.0.1" + "@csstools/css-color-parser": "npm:^3.0.3" + "@csstools/css-parser-algorithms": "npm:^3.0.2" + "@csstools/css-tokenizer": "npm:^3.0.2" "@csstools/postcss-progressive-custom-properties": "npm:^4.0.0" "@csstools/utilities": "npm:^2.0.0" peerDependencies: postcss: ^8.4 - checksum: 10c0/c987ccc7ab326668895396d3fe69c05087cf6e245be6f70e8c33da0cdeb56f8ac3d117cfad984191ec57be9691ab56d427aaa28c61c4a7446521972993dd5039 + checksum: 10c0/c994660ca0e2652755d9ad181c8cb46a07220c972086c97c843fa9bacf690be10c642770f898aeec4acc47c2b718dfc7372107285a678361f34d84d9e9c11e0c languageName: node linkType: hard -"@csstools/postcss-color-mix-function@npm:^3.0.2": - version: 3.0.2 - resolution: "@csstools/postcss-color-mix-function@npm:3.0.2" +"@csstools/postcss-color-mix-function@npm:^3.0.3": + version: 3.0.3 + resolution: "@csstools/postcss-color-mix-function@npm:3.0.3" dependencies: - "@csstools/css-color-parser": "npm:^3.0.2" - "@csstools/css-parser-algorithms": "npm:^3.0.1" - "@csstools/css-tokenizer": "npm:^3.0.1" + "@csstools/css-color-parser": "npm:^3.0.3" + "@csstools/css-parser-algorithms": "npm:^3.0.2" + "@csstools/css-tokenizer": "npm:^3.0.2" "@csstools/postcss-progressive-custom-properties": "npm:^4.0.0" "@csstools/utilities": "npm:^2.0.0" peerDependencies: postcss: ^8.4 - checksum: 10c0/cfdc641f504f9d02b9a7b53d6bd933d4e767ecaee5f3d2df45d897f69b8a38b5b79b538d307b16fb56dcb7c19dc7e107518c356772e89771e28e04fd846d9035 + checksum: 10c0/4ba358eb9030fc485bfe2922d897eeb712725762cc399eaba60ba665c84dc3e56a4d5a52dfb320093c0b217d32fedb9b5197fa45738cade53d9afcbefdadf04f languageName: node linkType: hard -"@csstools/postcss-content-alt-text@npm:^2.0.1": - version: 2.0.1 - resolution: "@csstools/postcss-content-alt-text@npm:2.0.1" +"@csstools/postcss-content-alt-text@npm:^2.0.2": + version: 2.0.2 + resolution: "@csstools/postcss-content-alt-text@npm:2.0.2" dependencies: - "@csstools/css-parser-algorithms": "npm:^3.0.1" - "@csstools/css-tokenizer": "npm:^3.0.1" + "@csstools/css-parser-algorithms": "npm:^3.0.2" + "@csstools/css-tokenizer": "npm:^3.0.2" "@csstools/postcss-progressive-custom-properties": "npm:^4.0.0" "@csstools/utilities": "npm:^2.0.0" peerDependencies: postcss: ^8.4 - checksum: 10c0/693e4cfa9a30a9c384120bd24846a7cd5ba1e1ebf975eb81b0e0131a21ac28a0301c7dcfa13706bc7d8b5343536fb43a46de636c3257d0fd05041c7255366e87 + checksum: 10c0/e52d40f6567b9b23b32a6c40f9b2a74d57f99a9921b4cae015f51f72453474236c760bb13120682f8815698a615e0ad7bed22314c29dca89c34b5480d83a7a6d languageName: node linkType: hard -"@csstools/postcss-exponential-functions@npm:^2.0.1": - version: 2.0.1 - resolution: "@csstools/postcss-exponential-functions@npm:2.0.1" +"@csstools/postcss-exponential-functions@npm:^2.0.2": + version: 2.0.2 + resolution: "@csstools/postcss-exponential-functions@npm:2.0.2" dependencies: - "@csstools/css-calc": "npm:^2.0.1" - "@csstools/css-parser-algorithms": "npm:^3.0.1" - "@csstools/css-tokenizer": "npm:^3.0.1" + "@csstools/css-calc": "npm:^2.0.2" + "@csstools/css-parser-algorithms": "npm:^3.0.2" + "@csstools/css-tokenizer": "npm:^3.0.2" peerDependencies: postcss: ^8.4 - checksum: 10c0/ddcaedfa48cc0cf93611c8d2ed5a75d56c1d196a97015db644b45881adabb47f3255242acaef6ea869a1e5ba66328725d254bf6d29eb5e988cde8b040bc5f55d + checksum: 10c0/034ff89089872f63a6b00bda670c5ff11361babd221ed3e441dde969a718059e5d44ab0ed331868f137bb205331b808ecbcc4cb641d5c945238ebca28aa3ed59 languageName: node linkType: hard @@ -1680,46 +1690,46 @@ __metadata: languageName: node linkType: hard -"@csstools/postcss-gamut-mapping@npm:^2.0.2": - version: 2.0.2 - resolution: "@csstools/postcss-gamut-mapping@npm:2.0.2" +"@csstools/postcss-gamut-mapping@npm:^2.0.3": + version: 2.0.3 + resolution: "@csstools/postcss-gamut-mapping@npm:2.0.3" dependencies: - "@csstools/css-color-parser": "npm:^3.0.2" - "@csstools/css-parser-algorithms": "npm:^3.0.1" - "@csstools/css-tokenizer": "npm:^3.0.1" + "@csstools/css-color-parser": "npm:^3.0.3" + "@csstools/css-parser-algorithms": "npm:^3.0.2" + "@csstools/css-tokenizer": "npm:^3.0.2" peerDependencies: postcss: ^8.4 - checksum: 10c0/8b6504f81c5036e3c2a9f9516c371f48a283112469b746546c8c7f6f0da2467c915d4dac6dfe8bb05d7dab3a7503911391eb9e666cb7632e09a032e801c029f5 + checksum: 10c0/21f5708f63e9c3b7603f8b72b5f288e0a021e9710a6abf4aaa713ff4d04bae057d1861e1f28d7670ea39ba463ac04f1507876d4a11178934e7cc7a1c6a780084 languageName: node linkType: hard -"@csstools/postcss-gradients-interpolation-method@npm:^5.0.2": - version: 5.0.2 - resolution: "@csstools/postcss-gradients-interpolation-method@npm:5.0.2" +"@csstools/postcss-gradients-interpolation-method@npm:^5.0.3": + version: 5.0.3 + resolution: "@csstools/postcss-gradients-interpolation-method@npm:5.0.3" dependencies: - "@csstools/css-color-parser": "npm:^3.0.2" - "@csstools/css-parser-algorithms": "npm:^3.0.1" - "@csstools/css-tokenizer": "npm:^3.0.1" + "@csstools/css-color-parser": "npm:^3.0.3" + "@csstools/css-parser-algorithms": "npm:^3.0.2" + "@csstools/css-tokenizer": "npm:^3.0.2" "@csstools/postcss-progressive-custom-properties": "npm:^4.0.0" "@csstools/utilities": "npm:^2.0.0" peerDependencies: postcss: ^8.4 - checksum: 10c0/4fa27437ad9861b1457c28228f2503c17bcc2f77dcb38da1314a4a5d38fd010e7e5d11b5f9d69e0a2cb2999bbfeca1e99ce2f59422bda5b382658dcb03f7326e + checksum: 10c0/062d27148438309c940a1973bfc7d42a06caa9397bf2382c7a61979f5be3d6f3fae1bc8ddf94d2dd8e6c807e0530a9e76179510266aaddc439677bf79447a765 languageName: node linkType: hard -"@csstools/postcss-hwb-function@npm:^4.0.2": - version: 4.0.2 - resolution: "@csstools/postcss-hwb-function@npm:4.0.2" +"@csstools/postcss-hwb-function@npm:^4.0.3": + version: 4.0.3 + resolution: "@csstools/postcss-hwb-function@npm:4.0.3" dependencies: - "@csstools/css-color-parser": "npm:^3.0.2" - "@csstools/css-parser-algorithms": "npm:^3.0.1" - "@csstools/css-tokenizer": "npm:^3.0.1" + "@csstools/css-color-parser": "npm:^3.0.3" + "@csstools/css-parser-algorithms": "npm:^3.0.2" + "@csstools/css-tokenizer": "npm:^3.0.2" "@csstools/postcss-progressive-custom-properties": "npm:^4.0.0" "@csstools/utilities": "npm:^2.0.0" peerDependencies: postcss: ^8.4 - checksum: 10c0/46dc9596e37830de4c38f70764d6da9f2fc7bc339217b4291eced75daa8998c4e05fb743c271701e44818df4ac111c285019b7bb3a728e8b61d86899bbeb74eb + checksum: 10c0/faf2bfbafeec765391e37c7a5cbc7b4647d9ab1ffa51e922c7dfffa545c3d436d15604dfdfb9d7684e760042e62bb42e0243dd4ebd8c3c14694a9f7be4e57b30 languageName: node linkType: hard @@ -1757,17 +1767,17 @@ __metadata: languageName: node linkType: hard -"@csstools/postcss-light-dark-function@npm:^2.0.4": - version: 2.0.4 - resolution: "@csstools/postcss-light-dark-function@npm:2.0.4" +"@csstools/postcss-light-dark-function@npm:^2.0.5": + version: 2.0.5 + resolution: "@csstools/postcss-light-dark-function@npm:2.0.5" dependencies: - "@csstools/css-parser-algorithms": "npm:^3.0.1" - "@csstools/css-tokenizer": "npm:^3.0.1" + "@csstools/css-parser-algorithms": "npm:^3.0.2" + "@csstools/css-tokenizer": "npm:^3.0.2" "@csstools/postcss-progressive-custom-properties": "npm:^4.0.0" "@csstools/utilities": "npm:^2.0.0" peerDependencies: postcss: ^8.4 - checksum: 10c0/0176422ad9747953964b1ceff002df1ecb1952ebc481db6192070d68777135b582ea6fd32ae819b9c64c96cb9170bd6907c647c85b48daa4984b7ed3d7f9bccb + checksum: 10c0/80635ee312d2a8f42aa5ce6792f1dc4a71199c384c66a3270d37e998d96db55beaa6836d689cda3b7e4828227960582fae04659ba5e4e0f64fd4543cbf15c6ab languageName: node linkType: hard @@ -1809,42 +1819,42 @@ __metadata: languageName: node linkType: hard -"@csstools/postcss-logical-viewport-units@npm:^3.0.1": - version: 3.0.1 - resolution: "@csstools/postcss-logical-viewport-units@npm:3.0.1" +"@csstools/postcss-logical-viewport-units@npm:^3.0.2": + version: 3.0.2 + resolution: "@csstools/postcss-logical-viewport-units@npm:3.0.2" dependencies: - "@csstools/css-tokenizer": "npm:^3.0.1" + "@csstools/css-tokenizer": "npm:^3.0.2" "@csstools/utilities": "npm:^2.0.0" peerDependencies: postcss: ^8.4 - checksum: 10c0/f54f91ec4d308562371576e82131c3cc1ff461a951c9a38f0b42b783c26f37a93cc846fcd025d3c4a8437b55a4fff1192ebfac8ccf84abb6478b2c515d232552 + checksum: 10c0/31f525e774bc053f545a159eb53bb21465ea2930118e87c40207ad90fa97d3151e6de83efd02f84803fb0e93ed4a4b42a3904b734423410e73ac4c6ce9666ab4 languageName: node linkType: hard -"@csstools/postcss-media-minmax@npm:^2.0.1": - version: 2.0.1 - resolution: "@csstools/postcss-media-minmax@npm:2.0.1" +"@csstools/postcss-media-minmax@npm:^2.0.2": + version: 2.0.2 + resolution: "@csstools/postcss-media-minmax@npm:2.0.2" dependencies: - "@csstools/css-calc": "npm:^2.0.1" - "@csstools/css-parser-algorithms": "npm:^3.0.1" - "@csstools/css-tokenizer": "npm:^3.0.1" - "@csstools/media-query-list-parser": "npm:^3.0.1" + "@csstools/css-calc": "npm:^2.0.2" + "@csstools/css-parser-algorithms": "npm:^3.0.2" + "@csstools/css-tokenizer": "npm:^3.0.2" + "@csstools/media-query-list-parser": "npm:^4.0.0" peerDependencies: postcss: ^8.4 - checksum: 10c0/23c1fb0c3ed8bf82f3223f161d0d65ba62045b917bc19624581f64aaa5d678485d22c23af2591a3f634ba02030ccb419c2b30209aa22f9fd2baa1a6474af810a + checksum: 10c0/83cf10742884fca3baa7ae26e2cb34123ce5a022622390566c139b4587ea8583fab00acbb85545786b36398e2201d2a94301e0fae805e55f375f1b5c38f67ce8 languageName: node linkType: hard -"@csstools/postcss-media-queries-aspect-ratio-number-values@npm:^3.0.1": - version: 3.0.1 - resolution: "@csstools/postcss-media-queries-aspect-ratio-number-values@npm:3.0.1" +"@csstools/postcss-media-queries-aspect-ratio-number-values@npm:^3.0.2": + version: 3.0.2 + resolution: "@csstools/postcss-media-queries-aspect-ratio-number-values@npm:3.0.2" dependencies: - "@csstools/css-parser-algorithms": "npm:^3.0.1" - "@csstools/css-tokenizer": "npm:^3.0.1" - "@csstools/media-query-list-parser": "npm:^3.0.1" + "@csstools/css-parser-algorithms": "npm:^3.0.2" + "@csstools/css-tokenizer": "npm:^3.0.2" + "@csstools/media-query-list-parser": "npm:^4.0.0" peerDependencies: postcss: ^8.4 - checksum: 10c0/e491cb149fb4fff85b2f03191511e43654ae00716e3c1ea9f1dc22ec4e7042c35f034d372082a69d3621c86cafbe46e8f419872fa36f4a534f145f584d655768 + checksum: 10c0/3ac4073d2e958bfb24ae45f673070dd805f0fcf07bc8d00a9a98f596d1096e7be282c8d8e87df3abde90f33fcbe2c7705e972b8c1a58e43ec44729f470b76096 languageName: node linkType: hard @@ -1871,18 +1881,18 @@ __metadata: languageName: node linkType: hard -"@csstools/postcss-oklab-function@npm:^4.0.2": - version: 4.0.2 - resolution: "@csstools/postcss-oklab-function@npm:4.0.2" +"@csstools/postcss-oklab-function@npm:^4.0.3": + version: 4.0.3 + resolution: "@csstools/postcss-oklab-function@npm:4.0.3" dependencies: - "@csstools/css-color-parser": "npm:^3.0.2" - "@csstools/css-parser-algorithms": "npm:^3.0.1" - "@csstools/css-tokenizer": "npm:^3.0.1" + "@csstools/css-color-parser": "npm:^3.0.3" + "@csstools/css-parser-algorithms": "npm:^3.0.2" + "@csstools/css-tokenizer": "npm:^3.0.2" "@csstools/postcss-progressive-custom-properties": "npm:^4.0.0" "@csstools/utilities": "npm:^2.0.0" peerDependencies: postcss: ^8.4 - checksum: 10c0/3209a7cec6d3577544a7ef41f2d5cca25f77891d4ec0d7f39d32f9a79a6c9a9b0ee6b54b2937a2d995548ad11c39966b07d4b9f58e907ffbe1a4b454f2d277f3 + checksum: 10c0/650bcb4f664308972588a8f789f806d63c4069e2e008cfc3b5c80bf9df992c62972dce279b8f434c7f78823e97095942ee4f0e37bc549258887213e72acb7ef8 languageName: node linkType: hard @@ -1897,18 +1907,18 @@ __metadata: languageName: node linkType: hard -"@csstools/postcss-relative-color-syntax@npm:^3.0.2": - version: 3.0.2 - resolution: "@csstools/postcss-relative-color-syntax@npm:3.0.2" +"@csstools/postcss-relative-color-syntax@npm:^3.0.3": + version: 3.0.3 + resolution: "@csstools/postcss-relative-color-syntax@npm:3.0.3" dependencies: - "@csstools/css-color-parser": "npm:^3.0.2" - "@csstools/css-parser-algorithms": "npm:^3.0.1" - "@csstools/css-tokenizer": "npm:^3.0.1" + "@csstools/css-color-parser": "npm:^3.0.3" + "@csstools/css-parser-algorithms": "npm:^3.0.2" + "@csstools/css-tokenizer": "npm:^3.0.2" "@csstools/postcss-progressive-custom-properties": "npm:^4.0.0" "@csstools/utilities": "npm:^2.0.0" peerDependencies: postcss: ^8.4 - checksum: 10c0/34a8c999e08c6e7833484ee2fb91e7fcc25235d6c361712fed581e44a5a29f1ceb95415b6f4260de53809ac13f5da5415d1905c2971477cf5d45e5196081c663 + checksum: 10c0/c241fe6b725d775f6d2085be1dff3868d189b176fa91ab1eb1133e30e30c8151bded4e50d17a845edd0bdd0a7adf9e8883cb2634fea3394872591fe9ad2a7e86 languageName: node linkType: hard @@ -1923,16 +1933,16 @@ __metadata: languageName: node linkType: hard -"@csstools/postcss-stepped-value-functions@npm:^4.0.1": - version: 4.0.1 - resolution: "@csstools/postcss-stepped-value-functions@npm:4.0.1" +"@csstools/postcss-stepped-value-functions@npm:^4.0.2": + version: 4.0.2 + resolution: "@csstools/postcss-stepped-value-functions@npm:4.0.2" dependencies: - "@csstools/css-calc": "npm:^2.0.1" - "@csstools/css-parser-algorithms": "npm:^3.0.1" - "@csstools/css-tokenizer": "npm:^3.0.1" + "@csstools/css-calc": "npm:^2.0.2" + "@csstools/css-parser-algorithms": "npm:^3.0.2" + "@csstools/css-tokenizer": "npm:^3.0.2" peerDependencies: postcss: ^8.4 - checksum: 10c0/7e65969b124fce603675ca17c2ffa2bb456677866e54bc9fbdc4da0945be1593fde2abb0730d3d03190776ad2022b394a1f9d4834c5b1f4c7ec497929fd35f8f + checksum: 10c0/444a27d725bc7a8e1554469e8ac69e248ff525b728fbe058523b0f1aefcff80ca707f543d21fead0a22d51603b1669190fb01f0f2dcd599a01768a37e0d62bc3 languageName: node linkType: hard @@ -1948,16 +1958,16 @@ __metadata: languageName: node linkType: hard -"@csstools/postcss-trigonometric-functions@npm:^4.0.1": - version: 4.0.1 - resolution: "@csstools/postcss-trigonometric-functions@npm:4.0.1" +"@csstools/postcss-trigonometric-functions@npm:^4.0.2": + version: 4.0.2 + resolution: "@csstools/postcss-trigonometric-functions@npm:4.0.2" dependencies: - "@csstools/css-calc": "npm:^2.0.1" - "@csstools/css-parser-algorithms": "npm:^3.0.1" - "@csstools/css-tokenizer": "npm:^3.0.1" + "@csstools/css-calc": "npm:^2.0.2" + "@csstools/css-parser-algorithms": "npm:^3.0.2" + "@csstools/css-tokenizer": "npm:^3.0.2" peerDependencies: postcss: ^8.4 - checksum: 10c0/59e017ebb9f4f8f027e134024e3322b5e202cc96073e0bb0d45733a829c8eadc7f4f7ce57ce8360a748a677595af9ea95da1779684699b48b911b73b4017ac8b + checksum: 10c0/eaecb2ea891162e4fcbbccf4f660c99e9e59f21937b70fe6aec3b51441eff2a12c1a2dc13fff426722629a7929919fd866311eaa68d74ee9d1f5387a23502fe2 languageName: node linkType: hard @@ -13352,18 +13362,18 @@ __metadata: languageName: node linkType: hard -"postcss-color-functional-notation@npm:^7.0.2": - version: 7.0.2 - resolution: "postcss-color-functional-notation@npm:7.0.2" +"postcss-color-functional-notation@npm:^7.0.3": + version: 7.0.3 + resolution: "postcss-color-functional-notation@npm:7.0.3" dependencies: - "@csstools/css-color-parser": "npm:^3.0.2" - "@csstools/css-parser-algorithms": "npm:^3.0.1" - "@csstools/css-tokenizer": "npm:^3.0.1" + "@csstools/css-color-parser": "npm:^3.0.3" + "@csstools/css-parser-algorithms": "npm:^3.0.2" + "@csstools/css-tokenizer": "npm:^3.0.2" "@csstools/postcss-progressive-custom-properties": "npm:^4.0.0" "@csstools/utilities": "npm:^2.0.0" peerDependencies: postcss: ^8.4 - checksum: 10c0/e89c0bff94558b0c978ac36f7e02f7f516291f90fd43169d39c63ad2bb0415e3b1c4b3c2469280d578727e850fdf15a557230cb28275f3f0676f0f73187f2867 + checksum: 10c0/5e04c81002512c960784043c096bc91ebc76b8fddb9259a2418b0e121eb65042944cc0f78946f6b7e5774ff1fee087849019655e4848af1f88879e3ab9ff7c17 languageName: node linkType: hard @@ -13417,46 +13427,46 @@ __metadata: languageName: node linkType: hard -"postcss-custom-media@npm:^11.0.2": - version: 11.0.2 - resolution: "postcss-custom-media@npm:11.0.2" +"postcss-custom-media@npm:^11.0.3": + version: 11.0.3 + resolution: "postcss-custom-media@npm:11.0.3" dependencies: - "@csstools/cascade-layer-name-parser": "npm:^2.0.1" - "@csstools/css-parser-algorithms": "npm:^3.0.1" - "@csstools/css-tokenizer": "npm:^3.0.1" - "@csstools/media-query-list-parser": "npm:^3.0.1" + "@csstools/cascade-layer-name-parser": "npm:^2.0.2" + "@csstools/css-parser-algorithms": "npm:^3.0.2" + "@csstools/css-tokenizer": "npm:^3.0.2" + "@csstools/media-query-list-parser": "npm:^4.0.0" peerDependencies: postcss: ^8.4 - checksum: 10c0/7bec2b1e0b5d786c33c5715b611ffc8b9737252ee6bf77ca59255ac16f91ce614406923f43250e5c88b04f1bb050f155dc5ed4d9350dbd704c45fbd72e5a9a04 + checksum: 10c0/bd3f0cf17d7422385d26afed510dc2acebb1d8c25fce13e2bbee1c49cdc7fe95ebe7f50b89ef0a88ebdd5f6826e89d99e26b905881ceff788df655670dba93d8 languageName: node linkType: hard -"postcss-custom-properties@npm:^14.0.1": - version: 14.0.1 - resolution: "postcss-custom-properties@npm:14.0.1" +"postcss-custom-properties@npm:^14.0.2": + version: 14.0.2 + resolution: "postcss-custom-properties@npm:14.0.2" dependencies: - "@csstools/cascade-layer-name-parser": "npm:^2.0.1" - "@csstools/css-parser-algorithms": "npm:^3.0.1" - "@csstools/css-tokenizer": "npm:^3.0.1" + "@csstools/cascade-layer-name-parser": "npm:^2.0.2" + "@csstools/css-parser-algorithms": "npm:^3.0.2" + "@csstools/css-tokenizer": "npm:^3.0.2" "@csstools/utilities": "npm:^2.0.0" postcss-value-parser: "npm:^4.2.0" peerDependencies: postcss: ^8.4 - checksum: 10c0/12180a7f4a4fe2d528387346a1810b82ed870081756dcf6be226c839716ab3f6f4d6ca4c7208a07d7d84bf2c986beef6473e29964e7c2572066fca5d3b000ed5 + checksum: 10c0/ea2e0cb60c558bb1afb4e601dcc64a38e1b28e5df3e47b83b858fc12d909d0e3453013e6b368fc05a7db7098ffcdc702a30a92f1a3c0ef67dfb97bf089021f1a languageName: node linkType: hard -"postcss-custom-selectors@npm:^8.0.1": - version: 8.0.1 - resolution: "postcss-custom-selectors@npm:8.0.1" +"postcss-custom-selectors@npm:^8.0.2": + version: 8.0.2 + resolution: "postcss-custom-selectors@npm:8.0.2" dependencies: - "@csstools/cascade-layer-name-parser": "npm:^2.0.1" - "@csstools/css-parser-algorithms": "npm:^3.0.1" - "@csstools/css-tokenizer": "npm:^3.0.1" + "@csstools/cascade-layer-name-parser": "npm:^2.0.2" + "@csstools/css-parser-algorithms": "npm:^3.0.2" + "@csstools/css-tokenizer": "npm:^3.0.2" postcss-selector-parser: "npm:^6.1.0" peerDependencies: postcss: ^8.4 - checksum: 10c0/b867233b3d68fbab90afca8a776eb74196ebc3fac8988175d95118a47993c793138fec6cc580272bb35d9bd31086acbdd33ff86da0cab83ef2f08bfc1c23ecd6 + checksum: 10c0/81673ffb0874f63c0f5e14315a5808259ec80ae8452aaf10d28112d30a9aaabbf61d13edb02f8be2965f44b943968c7eda051a1693da436ef157e77fcff0d752 languageName: node linkType: hard @@ -13574,18 +13584,18 @@ __metadata: languageName: node linkType: hard -"postcss-lab-function@npm:^7.0.2": - version: 7.0.2 - resolution: "postcss-lab-function@npm:7.0.2" +"postcss-lab-function@npm:^7.0.3": + version: 7.0.3 + resolution: "postcss-lab-function@npm:7.0.3" dependencies: - "@csstools/css-color-parser": "npm:^3.0.2" - "@csstools/css-parser-algorithms": "npm:^3.0.1" - "@csstools/css-tokenizer": "npm:^3.0.1" + "@csstools/css-color-parser": "npm:^3.0.3" + "@csstools/css-parser-algorithms": "npm:^3.0.2" + "@csstools/css-tokenizer": "npm:^3.0.2" "@csstools/postcss-progressive-custom-properties": "npm:^4.0.0" "@csstools/utilities": "npm:^2.0.0" peerDependencies: postcss: ^8.4 - checksum: 10c0/6b2be7e762b4ccb58ea9051723d390f6732ad78bb30bfef9499139cf5e2ac160c3de31b2b005fcc30e9fced4abe1685df6cb76c99d548896bae6746105ac8520 + checksum: 10c0/c50a73a9ed54b4194998c4627599d1f42074235f572edbbcdb0e00717f3ae2121dc8378d917792b281860c5650a617d923823da6f395515f610b5760d115354d languageName: node linkType: hard @@ -13906,38 +13916,38 @@ __metadata: linkType: hard "postcss-preset-env@npm:^10.0.0": - version: 10.0.6 - resolution: "postcss-preset-env@npm:10.0.6" + version: 10.0.7 + resolution: "postcss-preset-env@npm:10.0.7" dependencies: "@csstools/postcss-cascade-layers": "npm:^5.0.0" - "@csstools/postcss-color-function": "npm:^4.0.2" - "@csstools/postcss-color-mix-function": "npm:^3.0.2" - "@csstools/postcss-content-alt-text": "npm:^2.0.1" - "@csstools/postcss-exponential-functions": "npm:^2.0.1" + "@csstools/postcss-color-function": "npm:^4.0.3" + "@csstools/postcss-color-mix-function": "npm:^3.0.3" + "@csstools/postcss-content-alt-text": "npm:^2.0.2" + "@csstools/postcss-exponential-functions": "npm:^2.0.2" "@csstools/postcss-font-format-keywords": "npm:^4.0.0" - "@csstools/postcss-gamut-mapping": "npm:^2.0.2" - "@csstools/postcss-gradients-interpolation-method": "npm:^5.0.2" - "@csstools/postcss-hwb-function": "npm:^4.0.2" + "@csstools/postcss-gamut-mapping": "npm:^2.0.3" + "@csstools/postcss-gradients-interpolation-method": "npm:^5.0.3" + "@csstools/postcss-hwb-function": "npm:^4.0.3" "@csstools/postcss-ic-unit": "npm:^4.0.0" "@csstools/postcss-initial": "npm:^2.0.0" "@csstools/postcss-is-pseudo-class": "npm:^5.0.0" - "@csstools/postcss-light-dark-function": "npm:^2.0.4" + "@csstools/postcss-light-dark-function": "npm:^2.0.5" "@csstools/postcss-logical-float-and-clear": "npm:^3.0.0" "@csstools/postcss-logical-overflow": "npm:^2.0.0" "@csstools/postcss-logical-overscroll-behavior": "npm:^2.0.0" "@csstools/postcss-logical-resize": "npm:^3.0.0" - "@csstools/postcss-logical-viewport-units": "npm:^3.0.1" - "@csstools/postcss-media-minmax": "npm:^2.0.1" - "@csstools/postcss-media-queries-aspect-ratio-number-values": "npm:^3.0.1" + "@csstools/postcss-logical-viewport-units": "npm:^3.0.2" + "@csstools/postcss-media-minmax": "npm:^2.0.2" + "@csstools/postcss-media-queries-aspect-ratio-number-values": "npm:^3.0.2" "@csstools/postcss-nested-calc": "npm:^4.0.0" "@csstools/postcss-normalize-display-values": "npm:^4.0.0" - "@csstools/postcss-oklab-function": "npm:^4.0.2" + "@csstools/postcss-oklab-function": "npm:^4.0.3" "@csstools/postcss-progressive-custom-properties": "npm:^4.0.0" - "@csstools/postcss-relative-color-syntax": "npm:^3.0.2" + "@csstools/postcss-relative-color-syntax": "npm:^3.0.3" "@csstools/postcss-scope-pseudo-class": "npm:^4.0.0" - "@csstools/postcss-stepped-value-functions": "npm:^4.0.1" + "@csstools/postcss-stepped-value-functions": "npm:^4.0.2" "@csstools/postcss-text-decoration-shorthand": "npm:^4.0.1" - "@csstools/postcss-trigonometric-functions": "npm:^4.0.1" + "@csstools/postcss-trigonometric-functions": "npm:^4.0.2" "@csstools/postcss-unset-value": "npm:^4.0.0" autoprefixer: "npm:^10.4.19" browserslist: "npm:^4.23.1" @@ -13947,12 +13957,12 @@ __metadata: cssdb: "npm:^8.1.1" postcss-attribute-case-insensitive: "npm:^7.0.0" postcss-clamp: "npm:^4.1.0" - postcss-color-functional-notation: "npm:^7.0.2" + postcss-color-functional-notation: "npm:^7.0.3" postcss-color-hex-alpha: "npm:^10.0.0" postcss-color-rebeccapurple: "npm:^10.0.0" - postcss-custom-media: "npm:^11.0.2" - postcss-custom-properties: "npm:^14.0.1" - postcss-custom-selectors: "npm:^8.0.1" + postcss-custom-media: "npm:^11.0.3" + postcss-custom-properties: "npm:^14.0.2" + postcss-custom-selectors: "npm:^8.0.2" postcss-dir-pseudo-class: "npm:^9.0.0" postcss-double-position-gradients: "npm:^6.0.0" postcss-focus-visible: "npm:^10.0.0" @@ -13960,7 +13970,7 @@ __metadata: postcss-font-variant: "npm:^5.0.0" postcss-gap-properties: "npm:^6.0.0" postcss-image-set-function: "npm:^7.0.0" - postcss-lab-function: "npm:^7.0.2" + postcss-lab-function: "npm:^7.0.3" postcss-logical: "npm:^8.0.0" postcss-nesting: "npm:^13.0.0" postcss-opacity-percentage: "npm:^3.0.0" @@ -13972,7 +13982,7 @@ __metadata: postcss-selector-not: "npm:^8.0.0" peerDependencies: postcss: ^8.4 - checksum: 10c0/01660acf3b9ddf4d612a31819e9a5de9fe5383e9eddd2c130180f66ae90c5a881eb408e73454fd50e1839eae71678d738bf72073de08f9013c183b0bd9950fe5 + checksum: 10c0/f789000e0504fd827e854bb0feb8b4c218d381314e4d863c5a36df925df412d0844c912952fe27892a320433640aeaff03ee94a3057b42011bf5d32b3963f333 languageName: node linkType: hard From 3b07fe1bba713fb10f5c873dccb38f6875180c77 Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 10 Oct 2024 15:42:08 +0200 Subject: [PATCH 22/47] =?UTF-8?q?Fix=20=E2=80=9CMark=20every=20notificatio?= =?UTF-8?q?n=20as=20read=E2=80=9D=20not=20updating=20the=20read=20marker?= =?UTF-8?q?=20if=20scrolled=20down=20(#32385)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/javascript/mastodon/reducers/notification_groups.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/reducers/notification_groups.ts b/app/javascript/mastodon/reducers/notification_groups.ts index 8b033f0fc7..91e91d7549 100644 --- a/app/javascript/mastodon/reducers/notification_groups.ts +++ b/app/javascript/mastodon/reducers/notification_groups.ts @@ -559,7 +559,10 @@ export const notificationGroupsReducer = createReducer( compareId(state.lastReadId, mostRecentGroup.page_max_id) < 0 ) state.lastReadId = mostRecentGroup.page_max_id; - commitLastReadId(state); + + // We don't call `commitLastReadId`, because that is conditional + // and we want to unconditionally update the state instead. + state.readMarkerId = state.lastReadId; }) .addCase(fetchMarkers.fulfilled, (state, action) => { if ( From 22fd767425a02eb1b39d18a54053603772777b86 Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 10 Oct 2024 16:53:12 +0200 Subject: [PATCH 23/47] Fix mute duration not being shown in list of muted accounts in web UI (#32388) --- app/javascript/mastodon/api_types/accounts.ts | 11 ++++++++++- app/javascript/mastodon/models/account.ts | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/javascript/mastodon/api_types/accounts.ts b/app/javascript/mastodon/api_types/accounts.ts index 5bf3e64288..fdbd7523fc 100644 --- a/app/javascript/mastodon/api_types/accounts.ts +++ b/app/javascript/mastodon/api_types/accounts.ts @@ -13,7 +13,7 @@ export interface ApiAccountRoleJSON { } // See app/serializers/rest/account_serializer.rb -export interface ApiAccountJSON { +export interface BaseApiAccountJSON { acct: string; avatar: string; avatar_static: string; @@ -45,3 +45,12 @@ export interface ApiAccountJSON { memorial?: boolean; hide_collections: boolean; } + +// See app/serializers/rest/muted_account_serializer.rb +export interface ApiMutedAccountJSON extends BaseApiAccountJSON { + mute_expires_at?: string | null; +} + +// For now, we have the same type representing both `Account` and `MutedAccount` +// objects, but we should refactor this in the future. +export type ApiAccountJSON = ApiMutedAccountJSON; diff --git a/app/javascript/mastodon/models/account.ts b/app/javascript/mastodon/models/account.ts index a04ebe6291..8e8e3b0e8d 100644 --- a/app/javascript/mastodon/models/account.ts +++ b/app/javascript/mastodon/models/account.ts @@ -95,6 +95,9 @@ export const accountDefaultValues: AccountShape = { limited: false, moved: null, hide_collections: false, + // This comes from `ApiMutedAccountJSON`, but we should eventually + // store that in a different object. + mute_expires_at: null, }; const AccountFactory = ImmutableRecord(accountDefaultValues); From 6e96ec840d9fdf0ba83f48d8482b2bcdd573c08e Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 10 Oct 2024 19:31:51 +0200 Subject: [PATCH 24/47] Fix the favicon notification badge not using the correct notification count (#2880) Fixes #2879 --- app/javascript/flavours/glitch/features/ui/index.jsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/javascript/flavours/glitch/features/ui/index.jsx b/app/javascript/flavours/glitch/features/ui/index.jsx index d1165194ba..1ef29f8db2 100644 --- a/app/javascript/flavours/glitch/features/ui/index.jsx +++ b/app/javascript/flavours/glitch/features/ui/index.jsx @@ -21,6 +21,7 @@ import { Permalink } from 'flavours/glitch/components/permalink'; import { PictureInPicture } from 'flavours/glitch/features/picture_in_picture'; import { identityContextPropShape, withIdentity } from 'flavours/glitch/identity_context'; import { layoutFromWindow } from 'flavours/glitch/is_mobile'; +import { selectUnreadNotificationGroupsCount } from 'flavours/glitch/selectors/notifications'; import { WithRouterPropTypes } from 'flavours/glitch/utils/react_router'; import { uploadCompose, resetCompose, changeComposeSpoilerness } from '../../actions/compose'; @@ -90,7 +91,7 @@ const mapStateToProps = state => ({ hasMediaAttachments: state.getIn(['compose', 'media_attachments']).size > 0, canUploadMore: !state.getIn(['compose', 'media_attachments']).some(x => ['audio', 'video'].includes(x.get('type'))) && state.getIn(['compose', 'media_attachments']).size < 4, isWide: state.getIn(['local_settings', 'stretch']), - unreadNotifications: state.getIn(['notifications', 'unread']), + unreadNotifications: selectUnreadNotificationGroupsCount(state), showFaviconBadge: state.getIn(['local_settings', 'notifications', 'favicon_badge']), hicolorPrivacyIcons: state.getIn(['local_settings', 'hicolor_privacy_icons']), moved: state.getIn(['accounts', me, 'moved']) && state.getIn(['accounts', state.getIn(['accounts', me, 'moved'])]), From bb0cf04d71783214aab0a65f410f76ba6989513c Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 11 Oct 2024 11:19:48 +0200 Subject: [PATCH 25/47] Add note about not changing ActiveRecord encryption secrets once they are set (#32413) --- lib/tasks/db.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index d8bc927bc4..79599bd917 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -8,7 +8,7 @@ namespace :db do desc 'Generate a set of keys for configuring Active Record encryption in a given environment' task :init do # rubocop:disable Rails/RakeEnvironment puts <<~MSG - Add these secret environment variables to your Mastodon environment (e.g. .env.production):#{' '} + Add the following secret environment variables to your Mastodon environment (e.g. .env.production), ensure they are shared across all your nodes and do not change them after they are set:#{' '} ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY=#{SecureRandom.alphanumeric(32)} ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT=#{SecureRandom.alphanumeric(32)} From 10ea6da09ffc46a402800d22c81bad6dfa0beecb Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 11 Oct 2024 12:24:03 +0200 Subject: [PATCH 26/47] Fix language of push notifications (#32415) --- app/workers/web/push_notification_worker.rb | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/app/workers/web/push_notification_worker.rb b/app/workers/web/push_notification_worker.rb index 104503f130..e771928ef3 100644 --- a/app/workers/web/push_notification_worker.rb +++ b/app/workers/web/push_notification_worker.rb @@ -55,12 +55,8 @@ class Web::PushNotificationWorker end def push_notification_json - Oj.dump(serialized_notification_in_subscription_locale.as_json) - end - - def serialized_notification_in_subscription_locale I18n.with_locale(@subscription.locale.presence || I18n.default_locale) do - serialized_notification + Oj.dump(serialized_notification.as_json) end end From e15befebbd288faeec55ef6ad323d106f4ec57e1 Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 11 Oct 2024 16:16:37 +0200 Subject: [PATCH 27/47] Add tag with commit hash to PR image builds (#32418) --- .github/workflows/build-push-pr.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-push-pr.yml b/.github/workflows/build-push-pr.yml index 72baed5121..d3bc8e5df8 100644 --- a/.github/workflows/build-push-pr.yml +++ b/.github/workflows/build-push-pr.yml @@ -21,9 +21,11 @@ jobs: uses: actions/checkout@v4 - id: version_vars run: | - echo mastodon_version_metadata=pr-${{ github.event.pull_request.number }}-$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT + echo mastodon_version_metadata=pr-${{ github.event.pull_request.number }}-$(git rev-parse --short ${{github.event.pull_request.head.sha}}) >> $GITHUB_OUTPUT + echo mastodon_short_sha=$(git rev-parse --short ${{github.event.pull_request.head.sha}}) >> $GITHUB_OUTPUT outputs: metadata: ${{ steps.version_vars.outputs.mastodon_version_metadata }} + short_sha: ${{ steps.version_vars.outputs.mastodon_short_sha }} build-image: needs: compute-suffix @@ -39,6 +41,7 @@ jobs: latest=auto tags: | type=ref,event=pr + type=ref,event=pr,suffix=-${{ needs.compute-suffix.outputs.short_sha }} secrets: inherit build-image-streaming: @@ -55,4 +58,5 @@ jobs: latest=auto tags: | type=ref,event=pr + type=ref,event=pr,suffix=-${{ needs.compute-suffix.outputs.short_sha }} secrets: inherit From 888e6a3439ed1324a53d1085a2b293809c9e1eb6 Mon Sep 17 00:00:00 2001 From: Claire Date: Fri, 11 Oct 2024 17:45:07 +0200 Subject: [PATCH 28/47] Fix setting to hide the quick filter bar (#2882) Fixes #2881 --- .../glitch/features/notifications_v2/filter_bar.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/javascript/flavours/glitch/features/notifications_v2/filter_bar.tsx b/app/javascript/flavours/glitch/features/notifications_v2/filter_bar.tsx index 1299796662..d9a6b4d07f 100644 --- a/app/javascript/flavours/glitch/features/notifications_v2/filter_bar.tsx +++ b/app/javascript/flavours/glitch/features/notifications_v2/filter_bar.tsx @@ -14,6 +14,7 @@ import { Icon } from 'flavours/glitch/components/icon'; import { selectSettingsNotificationsQuickFilterActive, selectSettingsNotificationsQuickFilterAdvanced, + selectSettingsNotificationsQuickFilterShow, } from 'flavours/glitch/selectors/settings'; import { useAppDispatch, useAppSelector } from 'flavours/glitch/store'; @@ -65,6 +66,11 @@ export const FilterBar: React.FC = () => { const advancedMode = useAppSelector( selectSettingsNotificationsQuickFilterAdvanced, ); + const useFilterBar = useAppSelector( + selectSettingsNotificationsQuickFilterShow, + ); + + if (!useFilterBar) return null; if (advancedMode) return ( From b0dd38433beda1e72ed74e80b6523805fa0a9d56 Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 14 Oct 2024 10:18:25 +0200 Subject: [PATCH 29/47] Fix follow recommendation suppressions not applying immediately (#32392) --- app/models/follow_recommendation.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/models/follow_recommendation.rb b/app/models/follow_recommendation.rb index 7ac9e6dfb9..0435437a81 100644 --- a/app/models/follow_recommendation.rb +++ b/app/models/follow_recommendation.rb @@ -18,5 +18,6 @@ class FollowRecommendation < ApplicationRecord belongs_to :account_summary, foreign_key: :account_id, inverse_of: false belongs_to :account - scope :localized, ->(locale) { joins(:account_summary).merge(AccountSummary.localized(locale)) } + scope :unsupressed, -> { where.not(FollowRecommendationSuppression.where(FollowRecommendationSuppression.arel_table[:account_id].eq(arel_table[:account_id])).select(1).arel.exists) } + scope :localized, ->(locale) { unsupressed.joins(:account_summary).merge(AccountSummary.localized(locale)) } end From de422a37e8092768a6e8bef45479c43da8681d5d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 10:22:46 +0200 Subject: [PATCH 30/47] Update dependency fuzzysort to v3.1.0 (#32460) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 548d94fc2e..cd4ac5ce96 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8934,9 +8934,9 @@ __metadata: linkType: hard "fuzzysort@npm:^3.0.0": - version: 3.0.2 - resolution: "fuzzysort@npm:3.0.2" - checksum: 10c0/c6cdbd092a8e91ed822aeac6d4fb95559759c10602cb29f27307c1cabd01fdd384fa399f7757722435b595244efb000cd63f144104c41b8551b2faff123279cb + version: 3.1.0 + resolution: "fuzzysort@npm:3.1.0" + checksum: 10c0/da9bb32de16f2a5c2c000b99031d9f4f8a01380c12d5d3b67296443a1152c55987ce3c4ddbfe97481b0e9b6f2fb77d61dceba29a93ad36ee23ef5bab6a31afb8 languageName: node linkType: hard From e9eac648964b1c3cdbbc49022bdf44483dba6b34 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 08:23:20 +0000 Subject: [PATCH 31/47] Update devDependencies (non-major) (#32457) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 98 ++++++++++++++++++++++++++++++++----------------------- 1 file changed, 57 insertions(+), 41 deletions(-) diff --git a/yarn.lock b/yarn.lock index cd4ac5ce96..8c8c98bbc7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2267,8 +2267,8 @@ __metadata: linkType: hard "@formatjs/cli@npm:^6.1.1": - version: 6.2.12 - resolution: "@formatjs/cli@npm:6.2.12" + version: 6.2.15 + resolution: "@formatjs/cli@npm:6.2.15" peerDependencies: "@glimmer/env": ^0.1.7 "@glimmer/reference": ^0.91.1 || ^0.92.0 @@ -2297,7 +2297,7 @@ __metadata: optional: true bin: formatjs: bin/formatjs - checksum: 10c0/3bd05a9fad6c837e22988e6638f426c128efa46ab80ff88cf2ad81fb3bc10cf4f228907577fc01e24c2d7d505cfabfaa69f0496d2ec8f0ab2d6b5eaccb5e475c + checksum: 10c0/e947aa7f3994251392fe15673752a8d8e3c8a30733bb49de5e617d45a327a3e1d16419e2d6b01f7ef2cbe86e2946024342d5b3301e6a8f17de3de9e2e7aedb29 languageName: node linkType: hard @@ -6622,10 +6622,10 @@ __metadata: languageName: node linkType: hard -"css-functions-list@npm:^3.2.2": - version: 3.2.2 - resolution: "css-functions-list@npm:3.2.2" - checksum: 10c0/8638a63d0cf1bdc50d4a752ec1c94a57e9953c3b03eace4f5526db20bec3c061e95089f905dbb4999c44b9780ce777ba856967560f6d15119a303f6030901c10 +"css-functions-list@npm:^3.2.3": + version: 3.2.3 + resolution: "css-functions-list@npm:3.2.3" + checksum: 10c0/03f9ed34eeed310d2b1cf0e524eea02bc5f87854a4de85f8957ea432ab1036841a3fb00879590519f7bb8fda40d992ce7a72fa9b61696ca1dc53b90064858f96 languageName: node linkType: hard @@ -6733,6 +6733,16 @@ __metadata: languageName: node linkType: hard +"css-tree@npm:^3.0.0": + version: 3.0.0 + resolution: "css-tree@npm:3.0.0" + dependencies: + mdn-data: "npm:2.10.0" + source-map-js: "npm:^1.0.1" + checksum: 10c0/43d44fdf7004ae91d73d486f17894fef77efa33747a6752b9241cf0f5fb47fabc16ec34a96a993651d9014dfdeee803d7c5fcd3548214252ee19f4e5c98999b2 + languageName: node + linkType: hard + "css-tree@npm:~2.2.0": version: 2.2.1 resolution: "css-tree@npm:2.2.1" @@ -6982,15 +6992,15 @@ __metadata: languageName: node linkType: hard -"debug@npm:4, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.4, debug@npm:^4.3.5, debug@npm:^4.3.6, debug@npm:~4.3.6": - version: 4.3.6 - resolution: "debug@npm:4.3.6" +"debug@npm:4, debug@npm:^4.1.0, debug@npm:^4.1.1, debug@npm:^4.3.1, debug@npm:^4.3.2, debug@npm:^4.3.4, debug@npm:^4.3.5, debug@npm:^4.3.6, debug@npm:^4.3.7, debug@npm:~4.3.6": + version: 4.3.7 + resolution: "debug@npm:4.3.7" dependencies: - ms: "npm:2.1.2" + ms: "npm:^2.1.3" peerDependenciesMeta: supports-color: optional: true - checksum: 10c0/3293416bff072389c101697d4611c402a6bacd1900ac20c0492f61a9cdd6b3b29750fc7f5e299f8058469ef60ff8fb79b86395a30374fbd2490113c1c7112285 + checksum: 10c0/1471db19c3b06d485a622d62f65947a19a23fbd0dd73f7fd3eafb697eec5360cde447fb075919987899b1a2096e85d35d4eb5a4de09a57600ac9cf7e6c8e768b languageName: node linkType: hard @@ -8577,12 +8587,12 @@ __metadata: languageName: node linkType: hard -"file-entry-cache@npm:^9.0.0": - version: 9.0.0 - resolution: "file-entry-cache@npm:9.0.0" +"file-entry-cache@npm:^9.1.0": + version: 9.1.0 + resolution: "file-entry-cache@npm:9.1.0" dependencies: flat-cache: "npm:^5.0.0" - checksum: 10c0/07b0a4f062dc0aa258f3e1b06ac083ea25313f5e289943e146fafdaf3315dcc031635545eea7fe98fe5598b91d6c7f48dba7a251dd7ac20108a6ebf7d00b0b1c + checksum: 10c0/4b4dbc1e972f50202b1a4430d30fd99378ef6e2a64857176abdc65c5e4730a948fb37e274478520a7bacbc70f3abba455a4b9d2c1915c53f30d11dc85d3fef5e languageName: node linkType: hard @@ -9656,13 +9666,20 @@ __metadata: languageName: node linkType: hard -"ignore@npm:^5.2.0, ignore@npm:^5.3.1, ignore@npm:^5.3.2": +"ignore@npm:^5.2.0, ignore@npm:^5.3.1": version: 5.3.2 resolution: "ignore@npm:5.3.2" checksum: 10c0/f9f652c957983634ded1e7f02da3b559a0d4cc210fca3792cb67f1b153623c9c42efdc1c4121af171e295444459fc4a9201101fb041b1104a3c000bccb188337 languageName: node linkType: hard +"ignore@npm:^6.0.2": + version: 6.0.2 + resolution: "ignore@npm:6.0.2" + checksum: 10c0/9a38feac1861906a78ba0f03e8ef3cd6b0526dce2a1a84e1009324b557763afeb9c3ebcc04666b21f7bbf71adda45e76781bb9e2eaa0903d45dcaded634454f5 + languageName: node + linkType: hard + "immer@npm:^10.0.3": version: 10.0.3 resolution: "immer@npm:10.0.3" @@ -11828,6 +11845,13 @@ __metadata: languageName: node linkType: hard +"mdn-data@npm:2.10.0": + version: 2.10.0 + resolution: "mdn-data@npm:2.10.0" + checksum: 10c0/f6f1a6a6eb092bab250d06f6f6c7cb1733a77a17e7119aac829ad67d4322bbf6a30df3c6d88686e71942e66bd49274b2ddfede22a1d3df0d6c49a56fbd09eb7c + languageName: node + linkType: hard + "media-typer@npm:0.3.0": version: 0.3.0 resolution: "media-typer@npm:0.3.0" @@ -12207,14 +12231,7 @@ __metadata: languageName: node linkType: hard -"ms@npm:2.1.2": - version: 2.1.2 - resolution: "ms@npm:2.1.2" - checksum: 10c0/a437714e2f90dbf881b5191d35a6db792efbca5badf112f87b9e1c712aace4b4b9b742dd6537f3edf90fd6f684de897cec230abde57e87883766712ddda297cc - languageName: node - linkType: hard - -"ms@npm:2.1.3, ms@npm:^2.1.1": +"ms@npm:2.1.3, ms@npm:^2.1.1, ms@npm:^2.1.3": version: 2.1.3 resolution: "ms@npm:2.1.3" checksum: 10c0/d924b57e7312b3b63ad21fc5b3dc0af5e78d61a1fc7cfb5457edaf26326bf62be5307cc87ffb6862ef1c2b33b0233cdb5d4f01c4c958cc0d660948b65a287a48 @@ -14036,12 +14053,12 @@ __metadata: languageName: node linkType: hard -"postcss-safe-parser@npm:^7.0.0": - version: 7.0.0 - resolution: "postcss-safe-parser@npm:7.0.0" +"postcss-safe-parser@npm:^7.0.1": + version: 7.0.1 + resolution: "postcss-safe-parser@npm:7.0.1" peerDependencies: postcss: ^8.4.31 - checksum: 10c0/4217afd8ce2809e959dc365e4675f499303cc6b91f94db06c8164422822db2d3b3124df701ee2234db4127ad05619b016bfb9c2bccae9bf9cf898a396f1632c9 + checksum: 10c0/6957b10b818bd8d4664ec0e548af967f7549abedfb37f844d389571d36af681340f41f9477b9ccf34bcc7599bdef222d1d72e79c64373001fae77089fba6d965 languageName: node linkType: hard @@ -14105,7 +14122,7 @@ __metadata: languageName: node linkType: hard -"postcss@npm:^8.2.15, postcss@npm:^8.4.24, postcss@npm:^8.4.41": +"postcss@npm:^8.2.15, postcss@npm:^8.4.24, postcss@npm:^8.4.47": version: 8.4.47 resolution: "postcss@npm:8.4.47" dependencies: @@ -16703,8 +16720,8 @@ __metadata: linkType: hard "stylelint@npm:^16.0.2": - version: 16.9.0 - resolution: "stylelint@npm:16.9.0" + version: 16.10.0 + resolution: "stylelint@npm:16.10.0" dependencies: "@csstools/css-parser-algorithms": "npm:^3.0.1" "@csstools/css-tokenizer": "npm:^3.0.1" @@ -16714,17 +16731,17 @@ __metadata: balanced-match: "npm:^2.0.0" colord: "npm:^2.9.3" cosmiconfig: "npm:^9.0.0" - css-functions-list: "npm:^3.2.2" - css-tree: "npm:^2.3.1" - debug: "npm:^4.3.6" + css-functions-list: "npm:^3.2.3" + css-tree: "npm:^3.0.0" + debug: "npm:^4.3.7" fast-glob: "npm:^3.3.2" fastest-levenshtein: "npm:^1.0.16" - file-entry-cache: "npm:^9.0.0" + file-entry-cache: "npm:^9.1.0" global-modules: "npm:^2.0.0" globby: "npm:^11.1.0" globjoin: "npm:^0.1.4" html-tags: "npm:^3.3.1" - ignore: "npm:^5.3.2" + ignore: "npm:^6.0.2" imurmurhash: "npm:^0.1.4" is-plain-object: "npm:^5.0.0" known-css-properties: "npm:^0.34.0" @@ -16733,21 +16750,20 @@ __metadata: micromatch: "npm:^4.0.8" normalize-path: "npm:^3.0.0" picocolors: "npm:^1.0.1" - postcss: "npm:^8.4.41" + postcss: "npm:^8.4.47" postcss-resolve-nested-selector: "npm:^0.1.6" - postcss-safe-parser: "npm:^7.0.0" + postcss-safe-parser: "npm:^7.0.1" postcss-selector-parser: "npm:^6.1.2" postcss-value-parser: "npm:^4.2.0" resolve-from: "npm:^5.0.0" string-width: "npm:^4.2.3" - strip-ansi: "npm:^7.1.0" supports-hyperlinks: "npm:^3.1.0" svg-tags: "npm:^1.0.0" table: "npm:^6.8.2" write-file-atomic: "npm:^5.0.1" bin: stylelint: bin/stylelint.mjs - checksum: 10c0/d3ff9c8945c56b04a2fa16ec33d163325496d5db94b6fcb5adf74c76f7f794ac992888273f9a3317652ba8b6195168b2ffff382ca2a667a241e2ace8c9505ae2 + checksum: 10c0/d07dd156c225d16c740995daacd78090f7fc317602e87bda2fca323a4ae427a8526d724f3089df3b2185df4520f987547668ceea9b30985988ccbc514034aa21 languageName: node linkType: hard From 05bc82e1ab7fab0beae7dc300d2dd369faf0504a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 08:24:10 +0000 Subject: [PATCH 32/47] Update dependency use-debounce to v10.0.4 (#32452) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/yarn.lock b/yarn.lock index 8c8c98bbc7..30317f9a1f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17662,11 +17662,11 @@ __metadata: linkType: hard "use-debounce@npm:^10.0.0": - version: 10.0.3 - resolution: "use-debounce@npm:10.0.3" + version: 10.0.4 + resolution: "use-debounce@npm:10.0.4" peerDependencies: react: "*" - checksum: 10c0/351b62c565d6dce5a21ecc21fe3e1f8db74f70c81c8f7d9dbdfc2da1cb82d883578589f6146e684d91dac534bc3c8b145ab1a36fbf4d44cbb4113827508b39aa + checksum: 10c0/73494fc44b2bd58a7ec799a528fc20077c45fe2e94fedff6dcd88d136f7a39f417d77f584d5613aac615ed32aeb2ea393797ae1f7d5b2645eab57cb497a6d0cb languageName: node linkType: hard From 555fb98cbb1f6e951d8ee0401bd95215ed8dd58c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 10:28:15 +0200 Subject: [PATCH 33/47] Update dependency typescript to v5.6.3 (#32456) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/yarn.lock b/yarn.lock index 30317f9a1f..fe975f3a75 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17408,22 +17408,22 @@ __metadata: linkType: hard "typescript@npm:5, typescript@npm:^5.0.4": - version: 5.6.2 - resolution: "typescript@npm:5.6.2" + version: 5.6.3 + resolution: "typescript@npm:5.6.3" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 10c0/3ed8297a8c7c56b7fec282532503d1ac795239d06e7c4966b42d4330c6cf433a170b53bcf93a130a7f14ccc5235de5560df4f1045eb7f3550b46ebed16d3c5e5 + checksum: 10c0/44f61d3fb15c35359bc60399cb8127c30bae554cd555b8e2b46d68fa79d680354b83320ad419ff1b81a0bdf324197b29affe6cc28988cd6a74d4ac60c94f9799 languageName: node linkType: hard "typescript@patch:typescript@npm%3A5#optional!builtin, typescript@patch:typescript@npm%3A^5.0.4#optional!builtin": - version: 5.6.2 - resolution: "typescript@patch:typescript@npm%3A5.6.2#optional!builtin::version=5.6.2&hash=8c6c40" + version: 5.6.3 + resolution: "typescript@patch:typescript@npm%3A5.6.3#optional!builtin::version=5.6.3&hash=8c6c40" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 10c0/94eb47e130d3edd964b76da85975601dcb3604b0c848a36f63ac448d0104e93819d94c8bdf6b07c00120f2ce9c05256b8b6092d23cf5cf1c6fa911159e4d572f + checksum: 10c0/7c9d2e07c81226d60435939618c91ec2ff0b75fbfa106eec3430f0fcf93a584bc6c73176676f532d78c3594fe28a54b36eb40b3d75593071a7ec91301533ace7 languageName: node linkType: hard From 2343ce4441c2304da1e20adcb7d9262d71890abd Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 14 Oct 2024 08:28:47 +0000 Subject: [PATCH 34/47] Update dependency rack to v2.2.10 (#32455) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1c2bb8df08..4c9cfe828e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -615,7 +615,7 @@ GEM activesupport (>= 3.0.0) raabro (1.4.0) racc (1.8.1) - rack (2.2.9) + rack (2.2.10) rack-attack (6.7.0) rack (>= 1.0, < 4) rack-cors (2.0.2) From 06d6b35e884dbfa10ba7cb0069b5dd8c25c76399 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 14 Oct 2024 04:31:12 -0400 Subject: [PATCH 35/47] Convert `admin/tags` controller specs to system specs (#32447) --- .../controllers/admin/tags_controller_spec.rb | 82 ------------------- spec/system/admin/tags_spec.rb | 38 +++++++++ 2 files changed, 38 insertions(+), 82 deletions(-) delete mode 100644 spec/controllers/admin/tags_controller_spec.rb create mode 100644 spec/system/admin/tags_spec.rb diff --git a/spec/controllers/admin/tags_controller_spec.rb b/spec/controllers/admin/tags_controller_spec.rb deleted file mode 100644 index 1df2bc4003..0000000000 --- a/spec/controllers/admin/tags_controller_spec.rb +++ /dev/null @@ -1,82 +0,0 @@ -# frozen_string_literal: true - -require 'rails_helper' - -RSpec.describe Admin::TagsController do - render_views - - before do - sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin')) - end - - describe 'GET #index' do - before do - Fabricate(:tag) - - tag_filter = instance_double(Admin::TagFilter, results: Tag.all) - allow(Admin::TagFilter).to receive(:new).and_return(tag_filter) - end - - let(:params) { { order: 'newest' } } - - it 'returns http success' do - get :index - - expect(response).to have_http_status(200) - expect(response).to render_template(:index) - - expect(Admin::TagFilter) - .to have_received(:new) - .with(hash_including(params)) - end - - describe 'with filters' do - let(:params) { { order: 'newest', name: 'test' } } - - it 'returns http success' do - get :index, params: { name: 'test' } - - expect(response).to have_http_status(200) - expect(response).to render_template(:index) - - expect(Admin::TagFilter) - .to have_received(:new) - .with(hash_including(params)) - end - end - end - - describe 'GET #show' do - let!(:tag) { Fabricate(:tag) } - - before do - get :show, params: { id: tag.id } - end - - it 'returns status 200' do - expect(response).to have_http_status(200) - end - end - - describe 'PUT #update' do - let!(:tag) { Fabricate(:tag, listable: false) } - - context 'with valid params' do - it 'updates the tag' do - put :update, params: { id: tag.id, tag: { listable: '1' } } - - expect(response).to redirect_to(admin_tag_path(tag.id)) - expect(tag.reload).to be_listable - end - end - - context 'with invalid params' do - it 'does not update the tag' do - put :update, params: { id: tag.id, tag: { name: 'cant-change-name' } } - - expect(response).to have_http_status(200) - expect(response).to render_template(:show) - end - end - end -end diff --git a/spec/system/admin/tags_spec.rb b/spec/system/admin/tags_spec.rb new file mode 100644 index 0000000000..a3eca80d13 --- /dev/null +++ b/spec/system/admin/tags_spec.rb @@ -0,0 +1,38 @@ +# frozen_string_literal: true + +require 'rails_helper' + +RSpec.describe 'Admin Tags' do + describe 'Tag interaction' do + let!(:tag) { Fabricate(:tag, name: 'test') } + + before { sign_in Fabricate(:user, role: UserRole.find_by(name: 'Admin')) } + + it 'allows tags listing and editing' do + visit admin_tags_path + + expect(page) + .to have_title(I18n.t('admin.tags.title')) + + click_on '#test' + + fill_in display_name_field, with: 'NewTagName' + expect { click_on submit_button } + .to_not(change { tag.reload.display_name }) + expect(page) + .to have_content(match_error_text) + + fill_in display_name_field, with: 'TEST' + expect { click_on submit_button } + .to(change { tag.reload.display_name }.to('TEST')) + end + + def display_name_field + I18n.t('simple_form.labels.defaults.display_name') + end + + def match_error_text + I18n.t('tags.does_not_match_previous_name') + end + end +end From 2404d6d1a13d1e59f026c14403b89a328decabe3 Mon Sep 17 00:00:00 2001 From: Florian Kohler <13822756+FlohEinstein@users.noreply.github.com> Date: Mon, 14 Oct 2024 10:57:34 +0200 Subject: [PATCH 36/47] Added Swiss German to languages dropdown (#29281) Co-authored-by: David Roetzel --- app/helpers/languages_helper.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/helpers/languages_helper.rb b/app/helpers/languages_helper.rb index b6c09b7314..394202e39a 100644 --- a/app/helpers/languages_helper.rb +++ b/app/helpers/languages_helper.rb @@ -193,6 +193,7 @@ module LanguagesHelper ckb: ['Sorani (Kurdish)', 'سۆرانی'].freeze, cnr: ['Montenegrin', 'crnogorski'].freeze, csb: ['Kashubian', 'Kaszëbsczi'].freeze, + gsw: ['Swiss German', 'Schwiizertütsch'].freeze, jbo: ['Lojban', 'la .lojban.'].freeze, kab: ['Kabyle', 'Taqbaylit'].freeze, ldn: ['Láadan', 'Láadan'].freeze, From d8eab3d81f1ab46026801d4698380110e25f7b44 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 14 Oct 2024 08:51:01 -0400 Subject: [PATCH 37/47] Reinforce coverage for `DomainBlock` model (#32473) --- app/models/domain_block.rb | 4 +++- spec/models/domain_block_spec.rb | 33 ++++++++++++++++++++++++++------ 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/app/models/domain_block.rb b/app/models/domain_block.rb index b5d1f2e079..2853f6457a 100644 --- a/app/models/domain_block.rb +++ b/app/models/domain_block.rb @@ -40,7 +40,9 @@ class DomainBlock < ApplicationRecord if suspend? [:suspend] else - [severity.to_sym, reject_media? ? :reject_media : nil, reject_reports? ? :reject_reports : nil].reject { |policy| policy == :noop || policy.nil? } + [severity.to_sym, reject_media? ? :reject_media : nil, reject_reports? ? :reject_reports : nil] + .reject { |policy| policy == :noop } + .compact end end diff --git a/spec/models/domain_block_spec.rb b/spec/models/domain_block_spec.rb index 8278454cd7..14f904ea7f 100644 --- a/spec/models/domain_block_spec.rb +++ b/spec/models/domain_block_spec.rb @@ -3,14 +3,13 @@ require 'rails_helper' RSpec.describe DomainBlock do - describe 'validations' do + describe 'Validations' do it { is_expected.to validate_presence_of(:domain) } - it 'is invalid if the same normalized domain already exists' do - _domain_block = Fabricate(:domain_block, domain: 'にゃん') - domain_block_with_normalized_value = Fabricate.build(:domain_block, domain: 'xn--r9j5b5b') - domain_block_with_normalized_value.valid? - expect(domain_block_with_normalized_value).to model_have_error_on_field(:domain) + context 'when a normalized domain exists' do + before { Fabricate(:domain_block, domain: 'にゃん') } + + it { is_expected.to_not allow_value('xn--r9j5b5b').for(:domain) } end end @@ -105,4 +104,26 @@ RSpec.describe DomainBlock do end end end + + describe '#policies' do + subject { domain_block.policies } + + context 'when severity is suspend' do + let(:domain_block) { Fabricate.build :domain_block, severity: :suspend } + + it { is_expected.to eq(%i(suspend)) } + end + + context 'when severity is noop' do + let(:domain_block) { Fabricate.build :domain_block, severity: :noop, reject_media: true } + + it { is_expected.to eq(%i(reject_media)) } + end + + context 'when severity is silence' do + let(:domain_block) { Fabricate.build :domain_block, severity: :silence, reject_reports: true } + + it { is_expected.to eq(%i(silence reject_reports)) } + end + end end From cc70acc11cf488660ebd4a207633380e56cbf417 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Mon, 14 Oct 2024 08:52:47 -0400 Subject: [PATCH 38/47] Augment coverage for `Status` model (#32468) --- spec/models/status_spec.rb | 52 ++++++++++++++++++++++++++++++++++---- 1 file changed, 47 insertions(+), 5 deletions(-) diff --git a/spec/models/status_spec.rb b/spec/models/status_spec.rb index df67c365eb..90f5968438 100644 --- a/spec/models/status_spec.rb +++ b/spec/models/status_spec.rb @@ -472,11 +472,53 @@ RSpec.describe Status do end end - describe 'validation' do - it 'disallow empty uri for remote status' do - alice.update(domain: 'example.com') - status = Fabricate.build(:status, uri: '', account: alice) - expect(status).to model_have_error_on_field(:uri) + describe 'Validations' do + context 'with a remote account' do + subject { Fabricate.build :status, account: remote_account } + + let(:remote_account) { Fabricate :account, domain: 'example.com' } + + it { is_expected.to_not allow_value('').for(:uri) } + end + end + + describe 'Callbacks' do + describe 'Stripping content when required' do + context 'with a remote account' do + subject { Fabricate.build :status, local: false, account:, text: ' text ', spoiler_text: ' spoiler ' } + + let(:account) { Fabricate.build :account, domain: 'host.example' } + + it 'preserves content' do + expect { subject.valid? } + .to not_change(subject, :text) + .and not_change(subject, :spoiler_text) + end + end + + context 'with a local account' do + let(:account) { Fabricate.build :account, domain: nil } + + context 'with populated fields' do + subject { Fabricate.build :status, local: true, account:, text: ' text ', spoiler_text: ' spoiler ' } + + it 'strips content' do + expect { subject.valid? } + .to change(subject, :text).to('text') + .and change(subject, :spoiler_text).to('spoiler') + end + end + + context 'with empty fields' do + subject { Fabricate.build :status, local: true, account:, text: nil, spoiler_text: nil } + + it 'preserves content' do + expect { subject.valid? } + .to not_change(subject, :text) + .and not_change(subject, :spoiler_text) + end + end + end end end From ffa10323814b3ea0f15ac9cd2238164e42a873ad Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 14 Oct 2024 15:00:20 +0200 Subject: [PATCH 39/47] Add further warnings about encryption secrets (#32476) --- config/initializers/active_record_encryption.rb | 1 + lib/tasks/db.rake | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/config/initializers/active_record_encryption.rb b/config/initializers/active_record_encryption.rb index b7a874e404..c53f16d4d1 100644 --- a/config/initializers/active_record_encryption.rb +++ b/config/initializers/active_record_encryption.rb @@ -20,6 +20,7 @@ - ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY Run `bin/rails db:encryption:init` to generate new secrets and then assign the environment variables. + Do not change the secrets once they are set, as doing so may cause data loss and other issues that will be difficult or impossible to recover from. MESSAGE end diff --git a/lib/tasks/db.rake b/lib/tasks/db.rake index 79599bd917..73de0c120f 100644 --- a/lib/tasks/db.rake +++ b/lib/tasks/db.rake @@ -7,6 +7,17 @@ namespace :db do namespace :encryption do desc 'Generate a set of keys for configuring Active Record encryption in a given environment' task :init do # rubocop:disable Rails/RakeEnvironment + if %w( + ACTIVE_RECORD_ENCRYPTION_DETERMINISTIC_KEY + ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT + ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY + ).any? { |key| ENV.key?(key) } + pastel = Pastel.new + puts pastel.red(<<~MSG) + WARNING: It looks like encryption secrets have already been set. Please ensure you are not changing secrets for a Mastodon installation that already uses them, as this will cause data loss and other issues that are difficult to recover from. + MSG + end + puts <<~MSG Add the following secret environment variables to your Mastodon environment (e.g. .env.production), ensure they are shared across all your nodes and do not change them after they are set:#{' '} From 7c10b0fb7a078661558fef86399d86831423260c Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 14 Oct 2024 17:25:32 +0200 Subject: [PATCH 40/47] Fix follow recommendation carrousel scrolling on RTL layouts (#32462) --- .../components/inline_follow_suggestions.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/javascript/mastodon/features/home_timeline/components/inline_follow_suggestions.jsx b/app/javascript/mastodon/features/home_timeline/components/inline_follow_suggestions.jsx index 1b8040e55b..14ea6bd996 100644 --- a/app/javascript/mastodon/features/home_timeline/components/inline_follow_suggestions.jsx +++ b/app/javascript/mastodon/features/home_timeline/components/inline_follow_suggestions.jsx @@ -129,8 +129,13 @@ export const InlineFollowSuggestions = ({ hidden }) => { return; } - setCanScrollLeft(bodyRef.current.scrollLeft > 0); - setCanScrollRight((bodyRef.current.scrollLeft + bodyRef.current.clientWidth) < bodyRef.current.scrollWidth); + if (getComputedStyle(bodyRef.current).direction === 'rtl') { + setCanScrollLeft((bodyRef.current.clientWidth - bodyRef.current.scrollLeft) < bodyRef.current.scrollWidth); + setCanScrollRight(bodyRef.current.scrollLeft < 0); + } else { + setCanScrollLeft(bodyRef.current.scrollLeft > 0); + setCanScrollRight((bodyRef.current.scrollLeft + bodyRef.current.clientWidth) < bodyRef.current.scrollWidth); + } }, [setCanScrollRight, setCanScrollLeft, bodyRef, suggestions]); const handleLeftNav = useCallback(() => { From 6cedbb4c5056818a2c1b6b618d987f46cebf50c8 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 8 Oct 2024 09:21:36 -0400 Subject: [PATCH 41/47] [Glitch] Bring icon vertical middle to applications list style Port fa4a82326d4e33c63a76c6725c36e85fe3ae9310 to glitch-soc Signed-off-by: Claire --- app/javascript/flavours/glitch/styles/admin.scss | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/javascript/flavours/glitch/styles/admin.scss b/app/javascript/flavours/glitch/styles/admin.scss index 9bc3c7758e..fadc678de3 100644 --- a/app/javascript/flavours/glitch/styles/admin.scss +++ b/app/javascript/flavours/glitch/styles/admin.scss @@ -1050,6 +1050,12 @@ a.name-tag, color: var(--user-role-accent); } +.applications-list { + .icon { + vertical-align: middle; + } +} + .announcements-list, .filters-list { border: 1px solid var(--background-border-color); From 39723a4d9cdb321617b25290f09be99d6026641b Mon Sep 17 00:00:00 2001 From: Claire Date: Wed, 9 Oct 2024 19:24:22 +0200 Subject: [PATCH 42/47] [Glitch] Fix list edition modal styling Port 45a520603b10792e24a2190215c0305c739108d0 to glitch-soc Signed-off-by: Claire --- .../flavours/glitch/styles/components.scss | 111 ++++++++---------- 1 file changed, 50 insertions(+), 61 deletions(-) diff --git a/app/javascript/flavours/glitch/styles/components.scss b/app/javascript/flavours/glitch/styles/components.scss index 261aaae495..39ee2da242 100644 --- a/app/javascript/flavours/glitch/styles/components.scss +++ b/app/javascript/flavours/glitch/styles/components.scss @@ -8498,7 +8498,6 @@ noscript { justify-content: flex-start; gap: 15px; align-items: center; - border: 1px solid var(--background-border-color); border-top: 0; label { @@ -8525,79 +8524,23 @@ noscript { background: rgba($base-overlay-background, 0.5); } +.list-adder, .list-editor { - background: $ui-base-color; + backdrop-filter: var(--background-filter); + background: var(--modal-background-color); + border: 1px solid var(--modal-border-color); flex-direction: column; border-radius: 8px; - box-shadow: 2px 4px 15px rgba($base-shadow-color, 0.4); width: 380px; overflow: hidden; @media screen and (width <= 420px) { width: 90%; } - - h4 { - padding: 15px 0; - background: lighten($ui-base-color, 13%); - font-weight: 500; - font-size: 16px; - text-align: center; - border-radius: 8px 8px 0 0; - } - - .drawer__pager { - height: 50vh; - border-radius: 4px; - } - - .drawer__inner { - border-radius: 0 0 8px 8px; - - &.backdrop { - width: calc(100% - 60px); - box-shadow: 2px 4px 15px rgba($base-shadow-color, 0.4); - border-radius: 0 0 0 8px; - } - } - - &__accounts { - overflow-y: auto; - } - - .account__display-name { - &:hover strong { - text-decoration: none; - } - } - - .account__avatar { - cursor: default; - } - - .search { - margin-bottom: 0; - } } .list-adder { - background: $ui-base-color; - flex-direction: column; - border-radius: 8px; - box-shadow: 2px 4px 15px rgba($base-shadow-color, 0.4); - width: 380px; - overflow: hidden; - - @media screen and (width <= 420px) { - width: 90%; - } - - &__account { - background: lighten($ui-base-color, 13%); - } - &__lists { - background: lighten($ui-base-color, 13%); height: 50vh; border-radius: 0 0 8px 8px; overflow-y: auto; @@ -8618,6 +8561,52 @@ noscript { text-decoration: none; font-size: 16px; padding: 10px; + display: flex; + align-items: center; + gap: 4px; + } +} + +.list-editor { + h4 { + padding: 15px 0; + background: lighten($ui-base-color, 13%); + font-weight: 500; + font-size: 16px; + text-align: center; + border-radius: 8px 8px 0 0; + } + + .drawer__pager { + height: 50vh; + border: 0; + } + + .drawer__inner { + &.backdrop { + width: calc(100% - 60px); + box-shadow: 2px 4px 15px rgba($base-shadow-color, 0.4); + border-radius: 0 0 0 8px; + } + } + + &__accounts { + background: unset; + overflow-y: auto; + } + + .account__display-name { + &:hover strong { + text-decoration: none; + } + } + + .account__avatar { + cursor: default; + } + + .search { + margin-bottom: 0; } } From 1a9be3e0eb045352ce93ff6e7e11cc60202fc867 Mon Sep 17 00:00:00 2001 From: Michael Stanclift Date: Wed, 9 Oct 2024 14:33:28 -0500 Subject: [PATCH 43/47] [Glitch] Restore list column border Port de4f7859b4cf5fc5254173368cf35f0d711331b6 to glitch-soc Signed-off-by: Claire --- app/javascript/flavours/glitch/styles/components.scss | 1 + 1 file changed, 1 insertion(+) diff --git a/app/javascript/flavours/glitch/styles/components.scss b/app/javascript/flavours/glitch/styles/components.scss index 39ee2da242..7c2f19bde1 100644 --- a/app/javascript/flavours/glitch/styles/components.scss +++ b/app/javascript/flavours/glitch/styles/components.scss @@ -8498,6 +8498,7 @@ noscript { justify-content: flex-start; gap: 15px; align-items: center; + border: 1px solid var(--background-border-color); border-top: 0; label { From 9b3aaa96095c0f71ea93947c732917ce986c4592 Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 10 Oct 2024 13:04:38 +0200 Subject: [PATCH 44/47] =?UTF-8?q?[Glitch]=20Fix=20=E2=80=9CMention?= =?UTF-8?q?=E2=80=9D=20appearing=20for=20otherwise=20filtered=20posts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Port f75eb1a8b0386d2ca5c1c05ee3b10364b3e11211 to glitch-soc Signed-off-by: Claire --- .../components/notification_with_status.tsx | 9 +++- .../flavours/glitch/selectors/filters.ts | 50 +++++++++++++++++++ .../flavours/glitch/selectors/index.js | 15 +----- 3 files changed, 60 insertions(+), 14 deletions(-) create mode 100644 app/javascript/flavours/glitch/selectors/filters.ts diff --git a/app/javascript/flavours/glitch/features/notifications_v2/components/notification_with_status.tsx b/app/javascript/flavours/glitch/features/notifications_v2/components/notification_with_status.tsx index 941b1254f7..4f45189e59 100644 --- a/app/javascript/flavours/glitch/features/notifications_v2/components/notification_with_status.tsx +++ b/app/javascript/flavours/glitch/features/notifications_v2/components/notification_with_status.tsx @@ -16,6 +16,7 @@ import { import type { IconProp } from 'flavours/glitch/components/icon'; import { Icon } from 'flavours/glitch/components/icon'; import Status from 'flavours/glitch/containers/status_container'; +import { getStatusHidden } from 'flavours/glitch/selectors/filters'; import { useAppSelector, useAppDispatch } from 'flavours/glitch/store'; import { DisplayedName } from './displayed_name'; @@ -51,6 +52,12 @@ export const NotificationWithStatus: React.FC<{ (state) => state.statuses.getIn([statusId, 'visibility']) === 'direct', ); + const isFiltered = useAppSelector( + (state) => + statusId && + getStatusHidden(state, { id: statusId, contextType: 'notifications' }), + ); + const handlers = useMemo( () => ({ open: () => { @@ -77,7 +84,7 @@ export const NotificationWithStatus: React.FC<{ [dispatch, statusId], ); - if (!statusId) return null; + if (!statusId || isFiltered) return null; return ( diff --git a/app/javascript/flavours/glitch/selectors/filters.ts b/app/javascript/flavours/glitch/selectors/filters.ts new file mode 100644 index 0000000000..5d7bfcbdc7 --- /dev/null +++ b/app/javascript/flavours/glitch/selectors/filters.ts @@ -0,0 +1,50 @@ +import { createSelector } from '@reduxjs/toolkit'; + +import type { RootState } from 'flavours/glitch/store'; +import { toServerSideType } from 'flavours/glitch/utils/filters'; + +// TODO: move to `app/javascript/flavours/glitch/models` and use more globally +type Filter = Immutable.Map; + +// TODO: move to `app/javascript/flavours/glitch/models` and use more globally +type FilterResult = Immutable.Map; + +export const getFilters = createSelector( + [ + (state: RootState) => state.filters as Immutable.Map, + (_, { contextType }: { contextType: string }) => contextType, + ], + (filters, contextType) => { + if (!contextType) { + return null; + } + + const now = new Date(); + const serverSideType = toServerSideType(contextType); + + return filters.filter((filter) => { + const context = filter.get('context') as Immutable.List; + const expiration = filter.get('expires_at') as Date | null; + return ( + context.includes(serverSideType) && + (expiration === null || expiration > now) + ); + }); + }, +); + +export const getStatusHidden = ( + state: RootState, + { id, contextType }: { id: string; contextType: string }, +) => { + const filters = getFilters(state, { contextType }); + if (filters === null) return false; + + const filtered = state.statuses.getIn([id, 'filtered']) as + | Immutable.List + | undefined; + return filtered?.some( + (result) => + filters.getIn([result.get('filter'), 'filter_action']) === 'hide', + ); +}; diff --git a/app/javascript/flavours/glitch/selectors/index.js b/app/javascript/flavours/glitch/selectors/index.js index 1b2d63ae36..7c9a68cba4 100644 --- a/app/javascript/flavours/glitch/selectors/index.js +++ b/app/javascript/flavours/glitch/selectors/index.js @@ -1,23 +1,12 @@ import { createSelector } from '@reduxjs/toolkit'; import { List as ImmutableList, Map as ImmutableMap } from 'immutable'; -import { toServerSideType } from 'flavours/glitch/utils/filters'; - import { me } from '../initial_state'; +import { getFilters } from './filters'; + export { makeGetAccount } from "./accounts"; -const getFilters = createSelector([state => state.get('filters'), (_, { contextType }) => contextType], (filters, contextType) => { - if (!contextType) { - return null; - } - - const now = new Date(); - const serverSideType = toServerSideType(contextType); - - return filters.filter(filter => filter.get('context').includes(serverSideType) && (filter.get('expires_at') === null || filter.get('expires_at') > now)); -}); - export const makeGetStatus = () => { return createSelector( [ From 71a6ced55cc13f7e23e53623b0fbf2c1871a2245 Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 10 Oct 2024 15:42:08 +0200 Subject: [PATCH 45/47] =?UTF-8?q?[Glitch]=20Fix=20=E2=80=9CMark=20every=20?= =?UTF-8?q?notification=20as=20read=E2=80=9D=20not=20updating=20the=20read?= =?UTF-8?q?=20marker=20if=20scrolled=20down?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Port e018e6321feb97609b18ac61d3349beb6de170b5 to glitch-soc Signed-off-by: Claire --- .../flavours/glitch/reducers/notification_groups.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/javascript/flavours/glitch/reducers/notification_groups.ts b/app/javascript/flavours/glitch/reducers/notification_groups.ts index 3eece4b1d0..d1dacc7964 100644 --- a/app/javascript/flavours/glitch/reducers/notification_groups.ts +++ b/app/javascript/flavours/glitch/reducers/notification_groups.ts @@ -559,7 +559,10 @@ export const notificationGroupsReducer = createReducer( compareId(state.lastReadId, mostRecentGroup.page_max_id) < 0 ) state.lastReadId = mostRecentGroup.page_max_id; - commitLastReadId(state); + + // We don't call `commitLastReadId`, because that is conditional + // and we want to unconditionally update the state instead. + state.readMarkerId = state.lastReadId; }) .addCase(fetchMarkers.fulfilled, (state, action) => { if ( From 075eb3ed389e46241811be79c8399485291acc4a Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 10 Oct 2024 16:53:12 +0200 Subject: [PATCH 46/47] [Glitch] Fix mute duration not being shown in list of muted accounts in web UI Port a295832960f3a782b928145279af335f956fff1f to glitch-soc Signed-off-by: Claire --- app/javascript/flavours/glitch/api_types/accounts.ts | 11 ++++++++++- app/javascript/flavours/glitch/models/account.ts | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/javascript/flavours/glitch/api_types/accounts.ts b/app/javascript/flavours/glitch/api_types/accounts.ts index 5bf3e64288..fdbd7523fc 100644 --- a/app/javascript/flavours/glitch/api_types/accounts.ts +++ b/app/javascript/flavours/glitch/api_types/accounts.ts @@ -13,7 +13,7 @@ export interface ApiAccountRoleJSON { } // See app/serializers/rest/account_serializer.rb -export interface ApiAccountJSON { +export interface BaseApiAccountJSON { acct: string; avatar: string; avatar_static: string; @@ -45,3 +45,12 @@ export interface ApiAccountJSON { memorial?: boolean; hide_collections: boolean; } + +// See app/serializers/rest/muted_account_serializer.rb +export interface ApiMutedAccountJSON extends BaseApiAccountJSON { + mute_expires_at?: string | null; +} + +// For now, we have the same type representing both `Account` and `MutedAccount` +// objects, but we should refactor this in the future. +export type ApiAccountJSON = ApiMutedAccountJSON; diff --git a/app/javascript/flavours/glitch/models/account.ts b/app/javascript/flavours/glitch/models/account.ts index 0b698ead3d..799265831e 100644 --- a/app/javascript/flavours/glitch/models/account.ts +++ b/app/javascript/flavours/glitch/models/account.ts @@ -95,6 +95,9 @@ export const accountDefaultValues: AccountShape = { limited: false, moved: null, hide_collections: false, + // This comes from `ApiMutedAccountJSON`, but we should eventually + // store that in a different object. + mute_expires_at: null, }; const AccountFactory = ImmutableRecord(accountDefaultValues); From ab50b2613e0faf19a3b68def947eb557db267102 Mon Sep 17 00:00:00 2001 From: Claire Date: Mon, 14 Oct 2024 17:25:32 +0200 Subject: [PATCH 47/47] [Glitch] Fix follow recommendation carrousel scrolling on RTL layouts Port 7c10b0fb7a078661558fef86399d86831423260c to glitch-soc Signed-off-by: Claire --- .../components/inline_follow_suggestions.jsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/javascript/flavours/glitch/features/home_timeline/components/inline_follow_suggestions.jsx b/app/javascript/flavours/glitch/features/home_timeline/components/inline_follow_suggestions.jsx index 4e727a63ed..4dc47f7515 100644 --- a/app/javascript/flavours/glitch/features/home_timeline/components/inline_follow_suggestions.jsx +++ b/app/javascript/flavours/glitch/features/home_timeline/components/inline_follow_suggestions.jsx @@ -129,8 +129,13 @@ export const InlineFollowSuggestions = ({ hidden }) => { return; } - setCanScrollLeft(bodyRef.current.scrollLeft > 0); - setCanScrollRight((bodyRef.current.scrollLeft + bodyRef.current.clientWidth) < bodyRef.current.scrollWidth); + if (getComputedStyle(bodyRef.current).direction === 'rtl') { + setCanScrollLeft((bodyRef.current.clientWidth - bodyRef.current.scrollLeft) < bodyRef.current.scrollWidth); + setCanScrollRight(bodyRef.current.scrollLeft < 0); + } else { + setCanScrollLeft(bodyRef.current.scrollLeft > 0); + setCanScrollRight((bodyRef.current.scrollLeft + bodyRef.current.clientWidth) < bodyRef.current.scrollWidth); + } }, [setCanScrollRight, setCanScrollLeft, bodyRef, suggestions]); const handleLeftNav = useCallback(() => {