Merge pull request #1604 from ClearlyClaire/glitch-soc/merge-upstream

Merge upstream changes
main
Claire 2021-09-19 14:10:26 +02:00 committed by GitHub
commit 3d05ebfdc3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 382 additions and 401 deletions

View File

@ -25,7 +25,7 @@ gem 'blurhash', '~> 0.1'
gem 'active_model_serializers', '~> 0.10' gem 'active_model_serializers', '~> 0.10'
gem 'addressable', '~> 2.8' gem 'addressable', '~> 2.8'
gem 'bootsnap', '~> 1.6.0', require: false gem 'bootsnap', '~> 1.8.1', require: false
gem 'browser' gem 'browser'
gem 'charlock_holmes', '~> 0.7.7' gem 'charlock_holmes', '~> 0.7.7'
gem 'iso-639' gem 'iso-639'
@ -65,7 +65,7 @@ gem 'nsa', '~> 0.2'
gem 'oj', '~> 3.13' gem 'oj', '~> 3.13'
gem 'ox', '~> 2.14' gem 'ox', '~> 2.14'
gem 'parslet' gem 'parslet'
gem 'parallel', '~> 1.20' gem 'parallel', '~> 1.21'
gem 'posix-spawn' gem 'posix-spawn'
gem 'pundit', '~> 2.1' gem 'pundit', '~> 2.1'
gem 'premailer-rails' gem 'premailer-rails'
@ -137,9 +137,9 @@ group :development do
gem 'letter_opener_web', '~> 1.4' gem 'letter_opener_web', '~> 1.4'
gem 'memory_profiler' gem 'memory_profiler'
gem 'rubocop', '~> 1.21', require: false gem 'rubocop', '~> 1.21', require: false
gem 'rubocop-rails', '~> 2.11', require: false gem 'rubocop-rails', '~> 2.12', require: false
gem 'brakeman', '~> 5.1', require: false gem 'brakeman', '~> 5.1', require: false
gem 'bundler-audit', '~> 0.8', require: false gem 'bundler-audit', '~> 0.9', require: false
gem 'capistrano', '~> 3.16' gem 'capistrano', '~> 3.16'
gem 'capistrano-rails', '~> 1.6' gem 'capistrano-rails', '~> 1.6'

View File

@ -104,7 +104,7 @@ GEM
debug_inspector (>= 0.0.1) debug_inspector (>= 0.0.1)
blurhash (0.1.5) blurhash (0.1.5)
ffi (~> 1.14) ffi (~> 1.14)
bootsnap (1.6.0) bootsnap (1.8.1)
msgpack (~> 1.0) msgpack (~> 1.0)
brakeman (5.1.1) brakeman (5.1.1)
browser (4.2.0) browser (4.2.0)
@ -115,7 +115,7 @@ GEM
bullet (6.1.5) bullet (6.1.5)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
uniform_notifier (~> 1.11) uniform_notifier (~> 1.11)
bundler-audit (0.8.0) bundler-audit (0.9.0.1)
bundler (>= 1.2.0, < 3) bundler (>= 1.2.0, < 3)
thor (~> 1.0) thor (~> 1.0)
byebug (11.1.3) byebug (11.1.3)
@ -373,7 +373,7 @@ GEM
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
sidekiq (>= 3.5) sidekiq (>= 3.5)
statsd-ruby (~> 1.4, >= 1.4.0) statsd-ruby (~> 1.4, >= 1.4.0)
oj (3.13.4) oj (3.13.7)
omniauth (1.9.1) omniauth (1.9.1)
hashie (>= 3.4.6) hashie (>= 3.4.6)
rack (>= 1.6.2, < 3) rack (>= 1.6.2, < 3)
@ -397,7 +397,7 @@ GEM
mime-types mime-types
mimemagic (~> 0.3.0) mimemagic (~> 0.3.0)
terrapin (~> 0.6.0) terrapin (~> 0.6.0)
parallel (1.20.1) parallel (1.21.0)
parallel_tests (3.7.1) parallel_tests (3.7.1)
parallel parallel
parser (3.0.2.0) parser (3.0.2.0)
@ -534,7 +534,7 @@ GEM
unicode-display_width (>= 1.4.0, < 3.0) unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.11.0) rubocop-ast (1.11.0)
parser (>= 3.0.1.1) parser (>= 3.0.1.1)
rubocop-rails (2.11.3) rubocop-rails (2.12.2)
activesupport (>= 4.2.0) activesupport (>= 4.2.0)
rack (>= 1.1) rack (>= 1.1)
rubocop (>= 1.7.0, < 2.0) rubocop (>= 1.7.0, < 2.0)
@ -678,11 +678,11 @@ DEPENDENCIES
better_errors (~> 2.9) better_errors (~> 2.9)
binding_of_caller (~> 1.0) binding_of_caller (~> 1.0)
blurhash (~> 0.1) blurhash (~> 0.1)
bootsnap (~> 1.6.0) bootsnap (~> 1.8.1)
brakeman (~> 5.1) brakeman (~> 5.1)
browser browser
bullet (~> 6.1) bullet (~> 6.1)
bundler-audit (~> 0.8) bundler-audit (~> 0.9)
capistrano (~> 3.16) capistrano (~> 3.16)
capistrano-rails (~> 1.6) capistrano-rails (~> 1.6)
capistrano-rbenv (~> 2.2) capistrano-rbenv (~> 2.2)
@ -740,7 +740,7 @@ DEPENDENCIES
omniauth-saml (~> 1.10) omniauth-saml (~> 1.10)
ox (~> 2.14) ox (~> 2.14)
paperclip (~> 6.0) paperclip (~> 6.0)
parallel (~> 1.20) parallel (~> 1.21)
parallel_tests (~> 3.7) parallel_tests (~> 3.7)
parslet parslet
pg (~> 1.2) pg (~> 1.2)
@ -769,7 +769,7 @@ DEPENDENCIES
rspec-sidekiq (~> 3.1) rspec-sidekiq (~> 3.1)
rspec_junit_formatter (~> 0.4) rspec_junit_formatter (~> 0.4)
rubocop (~> 1.21) rubocop (~> 1.21)
rubocop-rails (~> 2.11) rubocop-rails (~> 2.12)
ruby-progressbar (~> 1.11) ruby-progressbar (~> 1.11)
sanitize (~> 6.0) sanitize (~> 6.0)
scenic (~> 1.5) scenic (~> 1.5)

View File

@ -19,11 +19,11 @@ class ActivityPub::FollowersSynchronizationsController < ActivityPub::BaseContro
private private
def uri_prefix def uri_prefix
signed_request_account.uri[/http(s?):\/\/[^\/]+\//] signed_request_account.uri[Account::URL_PREFIX_RE]
end end
def set_items def set_items
@items = @account.followers.where(Account.arel_table[:uri].matches(uri_prefix + '%', false, true)).pluck(:uri) @items = @account.followers.where(Account.arel_table[:uri].matches("#{Account.sanitize_sql_like(uri_prefix)}/%", false, true)).or(@account.followers.where(uri: uri_prefix)).pluck(:uri)
end end
def collection_presenter def collection_presenter

View File

@ -12,8 +12,6 @@ Bootsnap.setup(
cache_dir: File.expand_path('../tmp/cache', __dir__), cache_dir: File.expand_path('../tmp/cache', __dir__),
development_mode: ENV.fetch('RAILS_ENV', 'development') == 'development', development_mode: ENV.fetch('RAILS_ENV', 'development') == 'development',
load_path_cache: true, load_path_cache: true,
autoload_paths_cache: true,
disable_trace: false,
compile_cache_iseq: false, compile_cache_iseq: false,
compile_cache_yaml: false compile_cache_yaml: false
) )

View File

@ -65,7 +65,7 @@
"@babel/plugin-proposal-decorators": "^7.15.4", "@babel/plugin-proposal-decorators": "^7.15.4",
"@babel/plugin-transform-react-inline-elements": "^7.14.5", "@babel/plugin-transform-react-inline-elements": "^7.14.5",
"@babel/plugin-transform-runtime": "^7.15.0", "@babel/plugin-transform-runtime": "^7.15.0",
"@babel/preset-env": "^7.15.4", "@babel/preset-env": "^7.15.6",
"@babel/preset-react": "^7.14.5", "@babel/preset-react": "^7.14.5",
"@babel/runtime": "^7.15.4", "@babel/runtime": "^7.15.4",
"@gamestdio/websocket": "^0.3.2", "@gamestdio/websocket": "^0.3.2",
@ -155,7 +155,7 @@
"requestidlecallback": "^0.3.0", "requestidlecallback": "^0.3.0",
"reselect": "^4.0.0", "reselect": "^4.0.0",
"rimraf": "^3.0.2", "rimraf": "^3.0.2",
"sass": "^1.39.0", "sass": "^1.39.2",
"sass-loader": "^10.2.0", "sass-loader": "^10.2.0",
"stacktrace-js": "^2.0.2", "stacktrace-js": "^2.0.2",
"stringz": "^2.1.0", "stringz": "^2.1.0",
@ -172,19 +172,19 @@
"webpack-cli": "^3.3.12", "webpack-cli": "^3.3.12",
"webpack-merge": "^5.8.0", "webpack-merge": "^5.8.0",
"wicg-inert": "^3.1.1", "wicg-inert": "^3.1.1",
"ws": "^8.2.1" "ws": "^8.2.2"
}, },
"devDependencies": { "devDependencies": {
"@testing-library/jest-dom": "^5.14.1", "@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.0.0", "@testing-library/react": "^12.1.0",
"babel-eslint": "^10.1.0", "babel-eslint": "^10.1.0",
"babel-jest": "^27.1.0", "babel-jest": "^27.2.0",
"eslint": "^7.32.0", "eslint": "^7.32.0",
"eslint-plugin-import": "~2.24.2", "eslint-plugin-import": "~2.24.2",
"eslint-plugin-jsx-a11y": "~6.4.1", "eslint-plugin-jsx-a11y": "~6.4.1",
"eslint-plugin-promise": "~5.1.0", "eslint-plugin-promise": "~5.1.0",
"eslint-plugin-react": "~7.25.1", "eslint-plugin-react": "~7.25.1",
"jest": "^27.1.0", "jest": "^27.2.0",
"raf": "^3.4.1", "raf": "^3.4.1",
"react-intl-translations-manager": "^5.0.3", "react-intl-translations-manager": "^5.0.3",
"react-test-renderer": "^16.14.0", "react-test-renderer": "^16.14.0",

View File

@ -5,11 +5,13 @@ RSpec.describe ActivityPub::FollowersSynchronizationsController, type: :controll
let!(:follower_1) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/users/a') } let!(:follower_1) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/users/a') }
let!(:follower_2) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/users/b') } let!(:follower_2) { Fabricate(:account, domain: 'example.com', uri: 'https://example.com/users/b') }
let!(:follower_3) { Fabricate(:account, domain: 'foo.com', uri: 'https://foo.com/users/a') } let!(:follower_3) { Fabricate(:account, domain: 'foo.com', uri: 'https://foo.com/users/a') }
let!(:follower_4) { Fabricate(:account, username: 'instance-actor', domain: 'example.com', uri: 'https://example.com') }
before do before do
follower_1.follow!(account) follower_1.follow!(account)
follower_2.follow!(account) follower_2.follow!(account)
follower_3.follow!(account) follower_3.follow!(account)
follower_4.follow!(account)
end end
before do before do
@ -45,7 +47,7 @@ RSpec.describe ActivityPub::FollowersSynchronizationsController, type: :controll
it 'returns orderedItems with followers from example.com' do it 'returns orderedItems with followers from example.com' do
expect(body[:orderedItems]).to be_an Array expect(body[:orderedItems]).to be_an Array
expect(body[:orderedItems].sort).to eq [follower_1.uri, follower_2.uri] expect(body[:orderedItems].sort).to eq [follower_4.uri, follower_1.uri, follower_2.uri]
end end
it 'returns private Cache-Control header' do it 'returns private Cache-Control header' do

735
yarn.lock

File diff suppressed because it is too large Load Diff