From adcd693b71805e703d04d1306c0ac2575cd8f383 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 30 Jan 2024 10:29:42 -0500 Subject: [PATCH 01/11] Use existing `MediaAttachment.remote` scope in media CLI (#28912) --- lib/mastodon/cli/media.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/mastodon/cli/media.rb b/lib/mastodon/cli/media.rb index 87946e0262..ac8f219807 100644 --- a/lib/mastodon/cli/media.rb +++ b/lib/mastodon/cli/media.rb @@ -58,7 +58,7 @@ module Mastodon::CLI end unless options[:prune_profiles] || options[:remove_headers] - processed, aggregate = parallelize_with_progress(MediaAttachment.cached.where.not(remote_url: '').where(created_at: ..time_ago)) do |media_attachment| + processed, aggregate = parallelize_with_progress(MediaAttachment.cached.remote.where(created_at: ..time_ago)) do |media_attachment| next if media_attachment.file.blank? size = (media_attachment.file_file_size || 0) + (media_attachment.thumbnail_file_size || 0) From 9d3830344fc01bf72a3d624b30c881bf1c90888a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 30 Jan 2024 16:30:39 +0100 Subject: [PATCH 02/11] Update dependency immutable to v4.3.5 (#28933) 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 3f70a02e74..c97667808a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9123,9 +9123,9 @@ __metadata: linkType: hard "immutable@npm:^4.0.0, immutable@npm:^4.0.0-rc.1, immutable@npm:^4.3.0": - version: 4.3.4 - resolution: "immutable@npm:4.3.4" - checksum: c15b9f0fa7b3c9315725cb00704fddad59f0e668a7379c39b9a528a8386140ee9effb015ae51a5b423e05c59d15fc0b38c970db6964ad6b3e05d0761db68441f + version: 4.3.5 + resolution: "immutable@npm:4.3.5" + checksum: 63d2d7908241a955d18c7822fd2215b6e89ff5a1a33cc72cd475b013cbbdef7a705aa5170a51ce9f84a57f62fdddfaa34e7b5a14b33d8a43c65cc6a881d6e894 languageName: node linkType: hard From f91acba70ac455b1240616e61968a36f99176ce7 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 30 Jan 2024 10:32:20 -0500 Subject: [PATCH 03/11] Combine repeated requests in account controller concern spec (#28957) --- .../account_controller_concern_spec.rb | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/spec/controllers/concerns/account_controller_concern_spec.rb b/spec/controllers/concerns/account_controller_concern_spec.rb index e3295204aa..6eb970dedb 100644 --- a/spec/controllers/concerns/account_controller_concern_spec.rb +++ b/spec/controllers/concerns/account_controller_concern_spec.rb @@ -49,22 +49,21 @@ describe AccountControllerConcern do end context 'when account is not suspended' do - it 'assigns @account' do - account = Fabricate(:account) + let(:account) { Fabricate(:account, username: 'username') } + + it 'assigns @account, returns success, and sets link headers' do get 'success', params: { account_username: account.username } + expect(assigns(:account)).to eq account - end - - it 'sets link headers' do - Fabricate(:account, username: 'username') - get 'success', params: { account_username: 'username' } - expect(response.headers['Link'].to_s).to eq '; rel="lrdd"; type="application/jrd+json", ; rel="alternate"; type="application/activity+json"' - end - - it 'returns http success' do - account = Fabricate(:account) - get 'success', params: { account_username: account.username } expect(response).to have_http_status(200) + expect(response.headers['Link'].to_s).to eq(expected_link_headers) + end + + def expected_link_headers + [ + '; rel="lrdd"; type="application/jrd+json"', + '; rel="alternate"; type="application/activity+json"', + ].join(', ') end end end From b3075a9993bff1bfca18ada91fe5587e921781d5 Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Wed, 31 Jan 2024 00:34:07 +0900 Subject: [PATCH 04/11] Remove unused l18n messages (#28964) --- .../mastodon/features/compose/components/poll_form.jsx | 2 -- app/javascript/mastodon/locales/en.json | 2 -- 2 files changed, 4 deletions(-) diff --git a/app/javascript/mastodon/features/compose/components/poll_form.jsx b/app/javascript/mastodon/features/compose/components/poll_form.jsx index 3c02810e7a..b3566fd6f5 100644 --- a/app/javascript/mastodon/features/compose/components/poll_form.jsx +++ b/app/javascript/mastodon/features/compose/components/poll_form.jsx @@ -18,8 +18,6 @@ import AutosuggestInput from 'mastodon/components/autosuggest_input'; const messages = defineMessages({ option_placeholder: { id: 'compose_form.poll.option_placeholder', defaultMessage: 'Option {number}' }, - add_option: { id: 'compose_form.poll.add_option', defaultMessage: 'Add option' }, - remove_option: { id: 'compose_form.poll.remove_option', defaultMessage: 'Remove this option' }, duration: { id: 'compose_form.poll.duration', defaultMessage: 'Poll length' }, type: { id: 'compose_form.poll.type', defaultMessage: 'Style' }, switchToMultiple: { id: 'compose_form.poll.switch_to_multiple', defaultMessage: 'Change poll to allow multiple choices' }, diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json index 4befe77949..22a831b093 100644 --- a/app/javascript/mastodon/locales/en.json +++ b/app/javascript/mastodon/locales/en.json @@ -145,11 +145,9 @@ "compose_form.lock_disclaimer": "Your account is not {locked}. Anyone can follow you to view your follower-only posts.", "compose_form.lock_disclaimer.lock": "locked", "compose_form.placeholder": "What's on your mind?", - "compose_form.poll.add_option": "Add option", "compose_form.poll.duration": "Poll duration", "compose_form.poll.multiple": "Multiple choice", "compose_form.poll.option_placeholder": "Option {number}", - "compose_form.poll.remove_option": "Remove this option", "compose_form.poll.single": "Pick one", "compose_form.poll.switch_to_multiple": "Change poll to allow multiple choices", "compose_form.poll.switch_to_single": "Change poll to allow for a single choice", From 86fbde7b4615a1ac8209ca8886b4d7a3d8754063 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 30 Jan 2024 10:38:33 -0500 Subject: [PATCH 05/11] Fix `Style/NumericLiterals` cop in ProfileStories support module (#28971) --- spec/support/stories/profile_stories.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/support/stories/profile_stories.rb b/spec/support/stories/profile_stories.rb index 2b345ddef1..74342c337d 100644 --- a/spec/support/stories/profile_stories.rb +++ b/spec/support/stories/profile_stories.rb @@ -10,7 +10,7 @@ module ProfileStories account: Fabricate(:account, username: 'bob') ) - Web::Setting.where(user: bob).first_or_initialize(user: bob).update!(data: { introductionVersion: 201812160442020 }) if finished_onboarding # rubocop:disable Style/NumericLiterals + Web::Setting.where(user: bob).first_or_initialize(user: bob).update!(data: { introductionVersion: 2018_12_16_044202 }) if finished_onboarding end def as_a_logged_in_user From ce0d134147707cf7037784fe703837ca1627ea21 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 30 Jan 2024 10:39:01 -0500 Subject: [PATCH 06/11] Add `redirect_with_vary` to `AllowedMethods` for `Style/FormatStringToken` cop (#28973) --- .rubocop.yml | 9 +++++++++ config/routes.rb | 12 ++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 6998941144..330c40de1b 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -174,6 +174,15 @@ Style/ClassAndModuleChildren: Style/Documentation: Enabled: false +# Reason: Route redirects are not token-formatted and must be skipped +# https://docs.rubocop.org/rubocop/cops_style.html#styleformatstringtoken +Style/FormatStringToken: + inherit_mode: + merge: + - AllowedMethods # The rubocop-rails config adds `redirect` + AllowedMethods: + - redirect_with_vary + # Reason: Enforce modern Ruby style # https://docs.rubocop.org/rubocop/cops_style.html#stylehashsyntax Style/HashSyntax: diff --git a/config/routes.rb b/config/routes.rb index c4f862acaf..bb088821fd 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -104,12 +104,12 @@ Rails.application.routes.draw do confirmations: 'auth/confirmations', } - # rubocop:disable Style/FormatStringToken - those do not go through the usual formatting functions and are not safe to correct - get '/users/:username', to: redirect_with_vary('/@%{username}'), constraints: ->(req) { req.format.nil? || req.format.html? } - get '/users/:username/following', to: redirect_with_vary('/@%{username}/following'), constraints: ->(req) { req.format.nil? || req.format.html? } - get '/users/:username/followers', to: redirect_with_vary('/@%{username}/followers'), constraints: ->(req) { req.format.nil? || req.format.html? } - get '/users/:username/statuses/:id', to: redirect_with_vary('/@%{username}/%{id}'), constraints: ->(req) { req.format.nil? || req.format.html? } - # rubocop:enable Style/FormatStringToken + with_options constraints: ->(req) { req.format.nil? || req.format.html? } do + get '/users/:username', to: redirect_with_vary('/@%{username}') + get '/users/:username/following', to: redirect_with_vary('/@%{username}/following') + get '/users/:username/followers', to: redirect_with_vary('/@%{username}/followers') + get '/users/:username/statuses/:id', to: redirect_with_vary('/@%{username}/%{id}') + end get '/authorize_follow', to: redirect { |_, request| "/authorize_interaction?#{request.params.to_query}" } From 8c08e5cdb282bb5bc7229335b24e947c179498f8 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 30 Jan 2024 15:39:34 +0000 Subject: [PATCH 07/11] Update devDependencies (non-major) (#29000) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/yarn.lock b/yarn.lock index c97667808a..8ddbb0d0c0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1777,8 +1777,8 @@ __metadata: linkType: hard "@formatjs/cli@npm:^6.1.1": - version: 6.2.6 - resolution: "@formatjs/cli@npm:6.2.6" + version: 6.2.7 + resolution: "@formatjs/cli@npm:6.2.7" peerDependencies: vue: ^3.3.4 peerDependenciesMeta: @@ -1786,7 +1786,7 @@ __metadata: optional: true bin: formatjs: bin/formatjs - checksum: f8b0bc45c72b83437f0dc91a2d3ea513852c11bfd8eedbc2f255b19552f153bccb4d38fcd281f897ca60d0dfddf2b99de22e5a87cb1e173ca11df88c61cde2e4 + checksum: ee7b0873a734e02721ce1ee107ee60845bb30855f4ca686bfb6c5e9862353249d5d20748b18db93200aabc7a59875ff062f485c64d41cb8e61f1d43e2bb5eceb languageName: node linkType: hard @@ -2945,8 +2945,8 @@ __metadata: linkType: hard "@testing-library/jest-dom@npm:^6.0.0": - version: 6.2.0 - resolution: "@testing-library/jest-dom@npm:6.2.0" + version: 6.4.0 + resolution: "@testing-library/jest-dom@npm:6.4.0" dependencies: "@adobe/css-tools": "npm:^4.3.2" "@babel/runtime": "npm:^7.9.2" @@ -2958,19 +2958,22 @@ __metadata: redent: "npm:^3.0.0" peerDependencies: "@jest/globals": ">= 28" + "@types/bun": "*" "@types/jest": ">= 28" jest: ">= 28" vitest: ">= 0.32" peerDependenciesMeta: "@jest/globals": optional: true + "@types/bun": + optional: true "@types/jest": optional: true jest: optional: true vitest: optional: true - checksum: 71421693e0ad6a46be7d16f00b58a45725c238693972b8b5b1fd9ab797902ccf1209cf259afe8da1bf59d7c958762c46ee85d1aa5b164a5ec330981ea2376b08 + checksum: 6b7eba9ca388986a721fb12f84adf0f5534bf7ec5851982023a889c4a0afac6e9e91291bdac39e1f59a05adefd7727e30463d98b21c3da32fbfec229ccb11ef1 languageName: node linkType: hard From 0bc526a967f121cdee85bb529ec72bcd2244e2fd Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 30 Jan 2024 15:39:59 +0000 Subject: [PATCH 08/11] Update eslint (non-major) (#29001) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- yarn.lock | 178 ++++++++++++++++++------------------------------------ 1 file changed, 59 insertions(+), 119 deletions(-) diff --git a/yarn.lock b/yarn.lock index 8ddbb0d0c0..4d1084c229 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1790,16 +1790,6 @@ __metadata: languageName: node linkType: hard -"@formatjs/ecma402-abstract@npm:1.18.0": - version: 1.18.0 - resolution: "@formatjs/ecma402-abstract@npm:1.18.0" - dependencies: - "@formatjs/intl-localematcher": "npm:0.5.2" - tslib: "npm:^2.4.0" - checksum: bbdad0aee8e48baad6bfe6b2c27caf3befe35e658b922ee2f84417a819f0bdc7e849a8c0c782db8b53f5666bf19669d2b10a1104257c08796d198c87766bfc92 - languageName: node - linkType: hard - "@formatjs/ecma402-abstract@npm:1.18.2": version: 1.18.2 resolution: "@formatjs/ecma402-abstract@npm:1.18.2" @@ -1819,17 +1809,6 @@ __metadata: languageName: node linkType: hard -"@formatjs/icu-messageformat-parser@npm:2.7.3": - version: 2.7.3 - resolution: "@formatjs/icu-messageformat-parser@npm:2.7.3" - dependencies: - "@formatjs/ecma402-abstract": "npm:1.18.0" - "@formatjs/icu-skeleton-parser": "npm:1.7.0" - tslib: "npm:^2.4.0" - checksum: 2a51038813e5cff7e2df767e1227373d228e907adb7268fc3744b3d82c4fa69d4aa9f6020a62de2c468cf724600e9372ac07ae43a4480ed066fe34e224e80e4a - languageName: node - linkType: hard - "@formatjs/icu-messageformat-parser@npm:2.7.6": version: 2.7.6 resolution: "@formatjs/icu-messageformat-parser@npm:2.7.6" @@ -1841,16 +1820,6 @@ __metadata: languageName: node linkType: hard -"@formatjs/icu-skeleton-parser@npm:1.7.0": - version: 1.7.0 - resolution: "@formatjs/icu-skeleton-parser@npm:1.7.0" - dependencies: - "@formatjs/ecma402-abstract": "npm:1.18.0" - tslib: "npm:^2.4.0" - checksum: 2e4db815247ddb10f7990bbb501c85b854ee951ee45143673eb91b4392b11d0a8312327adb8b624c6a2fdafab12083904630d6d22475503d025f1612da4dcaee - languageName: node - linkType: hard - "@formatjs/icu-skeleton-parser@npm:1.8.0": version: 1.8.0 resolution: "@formatjs/icu-skeleton-parser@npm:1.8.0" @@ -1883,15 +1852,6 @@ __metadata: languageName: node linkType: hard -"@formatjs/intl-localematcher@npm:0.5.2": - version: 0.5.2 - resolution: "@formatjs/intl-localematcher@npm:0.5.2" - dependencies: - tslib: "npm:^2.4.0" - checksum: 4b3ae75470e3e53ffa39b2d46e65a2a4c9c4becbc0aac989b0694370e10c6687643660a045512d676509bc29b257fe5726fbb028de12f889be02c2d20b6527e6 - languageName: node - linkType: hard - "@formatjs/intl-localematcher@npm:0.5.4": version: 0.5.4 resolution: "@formatjs/intl-localematcher@npm:0.5.4" @@ -1952,26 +1912,6 @@ __metadata: languageName: node linkType: hard -"@formatjs/ts-transformer@npm:3.13.9": - version: 3.13.9 - resolution: "@formatjs/ts-transformer@npm:3.13.9" - dependencies: - "@formatjs/icu-messageformat-parser": "npm:2.7.3" - "@types/json-stable-stringify": "npm:^1.0.32" - "@types/node": "npm:14 || 16 || 17" - chalk: "npm:^4.0.0" - json-stable-stringify: "npm:^1.0.1" - tslib: "npm:^2.4.0" - typescript: "npm:5" - peerDependencies: - ts-jest: ">=27" - peerDependenciesMeta: - ts-jest: - optional: true - checksum: 4e313b967e45aae79246174c3181d31cc7cd297380d3a880a98fc0be16d76b783868712151e840ea16d22e2fbec0388b1005f688b6d4cb74ee4411b43f6d33f4 - languageName: node - linkType: hard - "@gamestdio/websocket@npm:^0.3.2": version: 0.3.2 resolution: "@gamestdio/websocket@npm:0.3.2" @@ -3723,14 +3663,14 @@ __metadata: linkType: hard "@typescript-eslint/eslint-plugin@npm:^6.0.0": - version: 6.19.0 - resolution: "@typescript-eslint/eslint-plugin@npm:6.19.0" + version: 6.20.0 + resolution: "@typescript-eslint/eslint-plugin@npm:6.20.0" dependencies: "@eslint-community/regexpp": "npm:^4.5.1" - "@typescript-eslint/scope-manager": "npm:6.19.0" - "@typescript-eslint/type-utils": "npm:6.19.0" - "@typescript-eslint/utils": "npm:6.19.0" - "@typescript-eslint/visitor-keys": "npm:6.19.0" + "@typescript-eslint/scope-manager": "npm:6.20.0" + "@typescript-eslint/type-utils": "npm:6.20.0" + "@typescript-eslint/utils": "npm:6.20.0" + "@typescript-eslint/visitor-keys": "npm:6.20.0" debug: "npm:^4.3.4" graphemer: "npm:^1.4.0" ignore: "npm:^5.2.4" @@ -3743,44 +3683,44 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: ab1a5ace6663b0c6d2418e321328fa28aa4bdc4b5fae257addec01346fb3a9c2d3a2960ade0f7114e6974c513a28632c9e8e602333cc0fab3135c445babdef59 + checksum: 5020faac39be476de056342f58f2bf68bb788f230e2fa4a2e27ceab8a5187dc450beba7333b0aa741a43aeaff45a117558132953f9390b5eca4c2cc004fde716 languageName: node linkType: hard "@typescript-eslint/parser@npm:^6.17.0": - version: 6.19.0 - resolution: "@typescript-eslint/parser@npm:6.19.0" + version: 6.20.0 + resolution: "@typescript-eslint/parser@npm:6.20.0" dependencies: - "@typescript-eslint/scope-manager": "npm:6.19.0" - "@typescript-eslint/types": "npm:6.19.0" - "@typescript-eslint/typescript-estree": "npm:6.19.0" - "@typescript-eslint/visitor-keys": "npm:6.19.0" + "@typescript-eslint/scope-manager": "npm:6.20.0" + "@typescript-eslint/types": "npm:6.20.0" + "@typescript-eslint/typescript-estree": "npm:6.20.0" + "@typescript-eslint/visitor-keys": "npm:6.20.0" debug: "npm:^4.3.4" peerDependencies: eslint: ^7.0.0 || ^8.0.0 peerDependenciesMeta: typescript: optional: true - checksum: d547bfb1aaed112cfc0f9f0be8506a280952ba3b61be42b749352139361bd94e4a47fa043d819e19c6a498cacbd8bb36a46e3628c436a7e2009e7ac27afc8861 + checksum: d84ad5e2282b1096c80dedb903c83ecc31eaf7be1aafcb14c18d9ec2d4a319f2fd1e5a9038b944d9f42c36c1c57add5e4292d4026ca7d3d5441d41286700d402 languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:6.19.0": - version: 6.19.0 - resolution: "@typescript-eslint/scope-manager@npm:6.19.0" +"@typescript-eslint/scope-manager@npm:6.20.0": + version: 6.20.0 + resolution: "@typescript-eslint/scope-manager@npm:6.20.0" dependencies: - "@typescript-eslint/types": "npm:6.19.0" - "@typescript-eslint/visitor-keys": "npm:6.19.0" - checksum: 1ec7b9dedca7975f0aa4543c1c382f7d6131411bd443a5f9b96f137acb6adb450888ed13c95f6d26546b682b2e0579ce8a1c883fdbe2255dc0b61052193b8243 + "@typescript-eslint/types": "npm:6.20.0" + "@typescript-eslint/visitor-keys": "npm:6.20.0" + checksum: f6768ed2dcd2d1771d55ed567ff392a6569ffd683a26500067509dd41769f8838c43686460fe7337144f324fd063df33f5d5646d44e5df4998ceffb3ad1fb790 languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:6.19.0": - version: 6.19.0 - resolution: "@typescript-eslint/type-utils@npm:6.19.0" +"@typescript-eslint/type-utils@npm:6.20.0": + version: 6.20.0 + resolution: "@typescript-eslint/type-utils@npm:6.20.0" dependencies: - "@typescript-eslint/typescript-estree": "npm:6.19.0" - "@typescript-eslint/utils": "npm:6.19.0" + "@typescript-eslint/typescript-estree": "npm:6.20.0" + "@typescript-eslint/utils": "npm:6.20.0" debug: "npm:^4.3.4" ts-api-utils: "npm:^1.0.1" peerDependencies: @@ -3788,23 +3728,23 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 5b146b985481e587122026c703ac9f537ad7e90eee1dca814971bca0d7e4a5d4ff9861fb4bf749014c28c6a4fbb4a01a4527355961315eb9501f3569f8e8dd38 + checksum: 8f622fbb14268f1d00b2948f995b570f0ef82be02c12be41d90385290a56ea0dbd34d855d6a5aff100b57f3bdd300ff0c300f16c78f12d6064f7ae6e34fd71bf languageName: node linkType: hard -"@typescript-eslint/types@npm:6.19.0": - version: 6.19.0 - resolution: "@typescript-eslint/types@npm:6.19.0" - checksum: 6f81860a3c14df55232c2e6dec21fb166867b9f30b3c3369b325aef5ee1c7e41e827c0504654daa49c8ff1a3a9ca9d9bfe76786882b6212a7c1b58991a9c80b9 +"@typescript-eslint/types@npm:6.20.0": + version: 6.20.0 + resolution: "@typescript-eslint/types@npm:6.20.0" + checksum: 37589003b0e06f83c1945e3748e91af85918cfd997766894642a08e6f355f611cfe11df4e7632dda96e3a9b3441406283fe834ab0906cf81ea97fd43ca2aebe3 languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:6.19.0": - version: 6.19.0 - resolution: "@typescript-eslint/typescript-estree@npm:6.19.0" +"@typescript-eslint/typescript-estree@npm:6.20.0": + version: 6.20.0 + resolution: "@typescript-eslint/typescript-estree@npm:6.20.0" dependencies: - "@typescript-eslint/types": "npm:6.19.0" - "@typescript-eslint/visitor-keys": "npm:6.19.0" + "@typescript-eslint/types": "npm:6.20.0" + "@typescript-eslint/visitor-keys": "npm:6.20.0" debug: "npm:^4.3.4" globby: "npm:^11.1.0" is-glob: "npm:^4.0.3" @@ -3814,34 +3754,34 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 5b365f009e43c7beafdbb7d8ecad78ee1087b0a4338cd9ec695eed514b7b4c1089e56239761139ddae629ec0ce8d428840c6ebfeea3618d2efe00c84f8794da5 + checksum: 551f13445a303882d9fc0fbe14ef8507eb8414253fd87a5f13d2e324b5280b626421a238b8ec038e628bc80128dc06c057757f668738e82e64d5b39a9083c27d languageName: node linkType: hard -"@typescript-eslint/utils@npm:6.19.0, @typescript-eslint/utils@npm:^6.5.0": - version: 6.19.0 - resolution: "@typescript-eslint/utils@npm:6.19.0" +"@typescript-eslint/utils@npm:6.20.0, @typescript-eslint/utils@npm:^6.18.1": + version: 6.20.0 + resolution: "@typescript-eslint/utils@npm:6.20.0" dependencies: "@eslint-community/eslint-utils": "npm:^4.4.0" "@types/json-schema": "npm:^7.0.12" "@types/semver": "npm:^7.5.0" - "@typescript-eslint/scope-manager": "npm:6.19.0" - "@typescript-eslint/types": "npm:6.19.0" - "@typescript-eslint/typescript-estree": "npm:6.19.0" + "@typescript-eslint/scope-manager": "npm:6.20.0" + "@typescript-eslint/types": "npm:6.20.0" + "@typescript-eslint/typescript-estree": "npm:6.20.0" semver: "npm:^7.5.4" peerDependencies: eslint: ^7.0.0 || ^8.0.0 - checksum: 343ff4cd4f7e102df8c46b41254d017a33d95df76455531fda679fdb92aebb9c111df8ee9ab54972e73c1e8fad9dd7e421001233f0aee8115384462b0821852e + checksum: 0a8ede3d80a365b52ae96d88e4a9f6e6abf3569c6b60ff9f42ff900cd843ae7c5493cd95f8f2029d90bb0acbf31030980206af98e581d760d6d41e0f80e9fb86 languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:6.19.0": - version: 6.19.0 - resolution: "@typescript-eslint/visitor-keys@npm:6.19.0" +"@typescript-eslint/visitor-keys@npm:6.20.0": + version: 6.20.0 + resolution: "@typescript-eslint/visitor-keys@npm:6.20.0" dependencies: - "@typescript-eslint/types": "npm:6.19.0" + "@typescript-eslint/types": "npm:6.20.0" eslint-visitor-keys: "npm:^3.4.1" - checksum: bb34e922e018aadf34866995ea5949d6623f184cc4f6470ab05767dd208ffabb003b7dc3872199714574b7f10afe89d49c6f89a4e8d086edea82be73e189f1bb + checksum: 852d938f2e5d57200cf62733b42e73a369f797b097d17e8fd3fffd0f7315c3b9e1863eed60bb8d57d6535a3b7f1980f645f96ec6d513950f182bfa8107b33fab languageName: node linkType: hard @@ -7359,23 +7299,23 @@ __metadata: linkType: hard "eslint-plugin-formatjs@npm:^4.10.1": - version: 4.11.3 - resolution: "eslint-plugin-formatjs@npm:4.11.3" + version: 4.12.2 + resolution: "eslint-plugin-formatjs@npm:4.12.2" dependencies: - "@formatjs/icu-messageformat-parser": "npm:2.7.3" - "@formatjs/ts-transformer": "npm:3.13.9" + "@formatjs/icu-messageformat-parser": "npm:2.7.6" + "@formatjs/ts-transformer": "npm:3.13.12" "@types/eslint": "npm:7 || 8" "@types/picomatch": "npm:^2.3.0" - "@typescript-eslint/utils": "npm:^6.5.0" + "@typescript-eslint/utils": "npm:^6.18.1" emoji-regex: "npm:^10.2.1" magic-string: "npm:^0.30.0" picomatch: "npm:^2.3.1" tslib: "npm:2.6.2" typescript: "npm:5" - unicode-emoji-utils: "npm:^1.1.1" + unicode-emoji-utils: "npm:^1.2.0" peerDependencies: eslint: 7 || 8 - checksum: 66481e0b5af5738bdb2b164ac1c74216c5c26f7c7400456a58387e71424bb30554aef39da43ce29bfd551f7dad678818d9af029022edadc4e1024349339f6984 + checksum: 77cc1a2959903fcb6639d9fec89e7dfc55cf1e4ea58fca7d3bd6d12fa540aa173cbf5f90fc629b6aaf2ea3b8e61ed0a3cfce940fd2bec6f0796353315e2dbeef languageName: node linkType: hard @@ -7407,8 +7347,8 @@ __metadata: linkType: hard "eslint-plugin-jsdoc@npm:^48.0.0": - version: 48.0.2 - resolution: "eslint-plugin-jsdoc@npm:48.0.2" + version: 48.0.4 + resolution: "eslint-plugin-jsdoc@npm:48.0.4" dependencies: "@es-joy/jsdoccomment": "npm:~0.41.0" are-docs-informative: "npm:^0.0.2" @@ -7421,7 +7361,7 @@ __metadata: spdx-expression-parse: "npm:^4.0.0" peerDependencies: eslint: ^7.0.0 || ^8.0.0 || ^9.0.0 - checksum: 6e6062c22fa4039e4be898a62f8ca0edef8bcbdc8257abb18302471e9819ccd63941971cf8de0ccf4eb59b3508902aa06de56214d80bdfc9bde7cadb94906190 + checksum: c73063d26ca70d37ea00eea9750d1f889e5bfda64ca46dbfc6bf4842b892551c320368220cb46acc9d3d96a89fd5391486650284b82dc722f700e3b5df5c78db languageName: node linkType: hard @@ -16510,7 +16450,7 @@ __metadata: languageName: node linkType: hard -"unicode-emoji-utils@npm:^1.1.1": +"unicode-emoji-utils@npm:^1.2.0": version: 1.2.0 resolution: "unicode-emoji-utils@npm:1.2.0" dependencies: From 0c0d07727638ca795b7290e5918678450eec903c Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 30 Jan 2024 16:40:43 +0100 Subject: [PATCH 09/11] Update dependency chewy to v7.5.1 (#29018) 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 57b2580722..3891139dce 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -180,7 +180,7 @@ GEM activesupport cbor (0.5.9.6) charlock_holmes (0.7.7) - chewy (7.5.0) + chewy (7.5.1) activesupport (>= 5.2) elasticsearch (>= 7.12.0, < 7.14.0) elasticsearch-dsl From c4af668e5ccf0ba26b3abc83b9bc36c3aa57a549 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 30 Jan 2024 18:24:40 +0100 Subject: [PATCH 10/11] Fix follow recommendations for less used languages (#29017) --- app/models/account_summary.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/account_summary.rb b/app/models/account_summary.rb index 2a21d09a8b..f052816361 100644 --- a/app/models/account_summary.rb +++ b/app/models/account_summary.rb @@ -15,7 +15,7 @@ class AccountSummary < ApplicationRecord has_many :follow_recommendation_suppressions, primary_key: :account_id, foreign_key: :account_id, inverse_of: false scope :safe, -> { where(sensitive: false) } - scope :localized, ->(locale) { where(language: locale) } + scope :localized, ->(locale) { order(Arel::Nodes::Case.new.when(arel_table[:language].eq(locale)).then(1).else(0).desc) } scope :filtered, -> { where.missing(:follow_recommendation_suppressions) } def self.refresh From fa0ba677538588086d83c97c0ea56f9cd1556590 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 30 Jan 2024 19:21:30 +0100 Subject: [PATCH 11/11] Change materialized views to be refreshed concurrently to avoid locks (#29015) --- app/models/account_summary.rb | 2 ++ app/models/follow_recommendation.rb | 2 ++ db/migrate/20210322164601_create_account_summaries.rb | 2 +- ...0505174616_update_follow_recommendations_to_version_2.rb | 2 +- .../20211213040746_update_account_summaries_to_version_2.rb | 6 +++--- .../20230818141056_create_global_follow_recommendations.rb | 2 +- .../20230818142253_drop_follow_recommendations.rb | 2 +- 7 files changed, 11 insertions(+), 7 deletions(-) diff --git a/app/models/account_summary.rb b/app/models/account_summary.rb index f052816361..30ada50cc0 100644 --- a/app/models/account_summary.rb +++ b/app/models/account_summary.rb @@ -19,6 +19,8 @@ class AccountSummary < ApplicationRecord scope :filtered, -> { where.missing(:follow_recommendation_suppressions) } def self.refresh + Scenic.database.refresh_materialized_view(table_name, concurrently: true, cascade: false) + rescue ActiveRecord::StatementInvalid Scenic.database.refresh_materialized_view(table_name, concurrently: false, cascade: false) end diff --git a/app/models/follow_recommendation.rb b/app/models/follow_recommendation.rb index 9d2648394b..6b49a3ca66 100644 --- a/app/models/follow_recommendation.rb +++ b/app/models/follow_recommendation.rb @@ -19,6 +19,8 @@ class FollowRecommendation < ApplicationRecord scope :localized, ->(locale) { joins(:account_summary).merge(AccountSummary.localized(locale)) } def self.refresh + Scenic.database.refresh_materialized_view(table_name, concurrently: true, cascade: false) + rescue ActiveRecord::StatementInvalid Scenic.database.refresh_materialized_view(table_name, concurrently: false, cascade: false) end diff --git a/db/migrate/20210322164601_create_account_summaries.rb b/db/migrate/20210322164601_create_account_summaries.rb index 8d18e9eeb4..5c93291e0a 100644 --- a/db/migrate/20210322164601_create_account_summaries.rb +++ b/db/migrate/20210322164601_create_account_summaries.rb @@ -2,7 +2,7 @@ class CreateAccountSummaries < ActiveRecord::Migration[5.2] def change - create_view :account_summaries, materialized: { no_data: true } + create_view :account_summaries, materialized: true # To be able to refresh the view concurrently, # at least one unique index is required diff --git a/db/migrate/20210505174616_update_follow_recommendations_to_version_2.rb b/db/migrate/20210505174616_update_follow_recommendations_to_version_2.rb index 22c27a0e7a..3a9024ffcb 100644 --- a/db/migrate/20210505174616_update_follow_recommendations_to_version_2.rb +++ b/db/migrate/20210505174616_update_follow_recommendations_to_version_2.rb @@ -6,7 +6,7 @@ class UpdateFollowRecommendationsToVersion2 < ActiveRecord::Migration[6.1] def up drop_view :follow_recommendations - create_view :follow_recommendations, version: 2, materialized: { no_data: true } + create_view :follow_recommendations, version: 2, materialized: true # To be able to refresh the view concurrently, # at least one unique index is required diff --git a/db/migrate/20211213040746_update_account_summaries_to_version_2.rb b/db/migrate/20211213040746_update_account_summaries_to_version_2.rb index e347a874ff..a82cf4afa2 100644 --- a/db/migrate/20211213040746_update_account_summaries_to_version_2.rb +++ b/db/migrate/20211213040746_update_account_summaries_to_version_2.rb @@ -4,7 +4,7 @@ class UpdateAccountSummariesToVersion2 < ActiveRecord::Migration[6.1] def up reapplication_follow_recommendations_v2 do drop_view :account_summaries, materialized: true - create_view :account_summaries, version: 2, materialized: { no_data: true } + create_view :account_summaries, version: 2, materialized: true safety_assured { add_index :account_summaries, :account_id, unique: true } end end @@ -12,7 +12,7 @@ class UpdateAccountSummariesToVersion2 < ActiveRecord::Migration[6.1] def down reapplication_follow_recommendations_v2 do drop_view :account_summaries, materialized: true - create_view :account_summaries, version: 1, materialized: { no_data: true } + create_view :account_summaries, version: 1, materialized: true safety_assured { add_index :account_summaries, :account_id, unique: true } end end @@ -20,7 +20,7 @@ class UpdateAccountSummariesToVersion2 < ActiveRecord::Migration[6.1] def reapplication_follow_recommendations_v2 drop_view :follow_recommendations, materialized: true yield - create_view :follow_recommendations, version: 2, materialized: { no_data: true } + create_view :follow_recommendations, version: 2, materialized: true safety_assured { add_index :follow_recommendations, :account_id, unique: true } end end diff --git a/db/migrate/20230818141056_create_global_follow_recommendations.rb b/db/migrate/20230818141056_create_global_follow_recommendations.rb index b88c71b9d7..1a3f23d228 100644 --- a/db/migrate/20230818141056_create_global_follow_recommendations.rb +++ b/db/migrate/20230818141056_create_global_follow_recommendations.rb @@ -2,7 +2,7 @@ class CreateGlobalFollowRecommendations < ActiveRecord::Migration[7.0] def change - create_view :global_follow_recommendations, materialized: { no_data: true } + create_view :global_follow_recommendations, materialized: true safety_assured { add_index :global_follow_recommendations, :account_id, unique: true } end end diff --git a/db/post_migrate/20230818142253_drop_follow_recommendations.rb b/db/post_migrate/20230818142253_drop_follow_recommendations.rb index 95913d6caa..e0a24753ca 100644 --- a/db/post_migrate/20230818142253_drop_follow_recommendations.rb +++ b/db/post_migrate/20230818142253_drop_follow_recommendations.rb @@ -6,7 +6,7 @@ class DropFollowRecommendations < ActiveRecord::Migration[7.0] end def down - create_view :follow_recommendations, version: 2, materialized: { no_data: true } + create_view :follow_recommendations, version: 2, materialized: true safety_assured { add_index :follow_recommendations, :account_id, unique: true } end end