Merge pull request #2749 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes up to 2cda1dd542
shrike
commit
7a29b1ed46
27
.eslintrc.js
27
.eslintrc.js
|
@ -20,10 +20,6 @@ module.exports = defineConfig({
|
|||
es6: true,
|
||||
},
|
||||
|
||||
globals: {
|
||||
ATTACHMENT_HOST: false,
|
||||
},
|
||||
|
||||
parser: '@typescript-eslint/parser',
|
||||
|
||||
plugins: [
|
||||
|
@ -79,7 +75,7 @@ module.exports = defineConfig({
|
|||
],
|
||||
},
|
||||
],
|
||||
'no-empty': 'off',
|
||||
'no-empty': ['error', { "allowEmptyCatch": true }],
|
||||
'no-restricted-properties': [
|
||||
'error',
|
||||
{ property: 'substring', message: 'Use .slice instead of .substring.' },
|
||||
|
@ -94,7 +90,6 @@ module.exports = defineConfig({
|
|||
message: "Use '·' (middle dot) instead of '•' (bullet)",
|
||||
},
|
||||
],
|
||||
'no-self-assign': 'off',
|
||||
'no-unused-expressions': 'error',
|
||||
'no-unused-vars': 'off',
|
||||
'@typescript-eslint/no-unused-vars': [
|
||||
|
@ -119,12 +114,10 @@ module.exports = defineConfig({
|
|||
'react/jsx-tag-spacing': 'error',
|
||||
'react/jsx-uses-react': 'off', // not needed with new JSX transform
|
||||
'react/jsx-wrap-multilines': 'error',
|
||||
'react/no-deprecated': 'off',
|
||||
'react/react-in-jsx-scope': 'off', // not needed with new JSX transform
|
||||
'react/self-closing-comp': 'error',
|
||||
|
||||
// recommended values found in https://github.com/jsx-eslint/eslint-plugin-jsx-a11y/blob/v6.8.0/src/index.js#L46
|
||||
'jsx-a11y/accessible-emoji': 'warn',
|
||||
'jsx-a11y/click-events-have-key-events': 'off',
|
||||
'jsx-a11y/label-has-associated-control': 'off',
|
||||
'jsx-a11y/media-has-caption': 'off',
|
||||
|
@ -139,23 +132,6 @@ module.exports = defineConfig({
|
|||
// ],
|
||||
'jsx-a11y/no-interactive-element-to-noninteractive-role': 'off',
|
||||
// recommended rule is:
|
||||
// 'jsx-a11y/no-noninteractive-element-interactions': [
|
||||
// 'error',
|
||||
// {
|
||||
// body: ['onError', 'onLoad'],
|
||||
// iframe: ['onError', 'onLoad'],
|
||||
// img: ['onError', 'onLoad'],
|
||||
// },
|
||||
// ],
|
||||
'jsx-a11y/no-noninteractive-element-interactions': [
|
||||
'warn',
|
||||
{
|
||||
handlers: [
|
||||
'onClick',
|
||||
],
|
||||
},
|
||||
],
|
||||
// recommended rule is:
|
||||
// 'jsx-a11y/no-noninteractive-tabindex': [
|
||||
// 'error',
|
||||
// {
|
||||
|
@ -165,7 +141,6 @@ module.exports = defineConfig({
|
|||
// },
|
||||
// ],
|
||||
'jsx-a11y/no-noninteractive-tabindex': 'off',
|
||||
'jsx-a11y/no-onchange': 'off',
|
||||
// recommended is full 'error'
|
||||
'jsx-a11y/no-static-element-interactions': [
|
||||
'warn',
|
||||
|
|
|
@ -49,6 +49,7 @@ require_relative '../lib/webpacker/manifest_extensions'
|
|||
require_relative '../lib/webpacker/helper_extensions'
|
||||
require_relative '../lib/rails/engine_extensions'
|
||||
require_relative '../lib/action_dispatch/remote_ip_extensions'
|
||||
require_relative '../lib/stoplight/redis_data_store_extensions'
|
||||
require_relative '../lib/active_record/database_tasks_extensions'
|
||||
require_relative '../lib/active_record/batches'
|
||||
require_relative '../lib/active_record/with_recursive'
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
# Restore compatibility with Redis < 6.2
|
||||
|
||||
module Stoplight
|
||||
module DataStore
|
||||
module RedisExtensions
|
||||
def query_failures(light, transaction: @redis)
|
||||
window_start = Time.now.to_i - light.window_size
|
||||
|
||||
transaction.zrevrangebyscore(failures_key(light), Float::INFINITY, window_start)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Stoplight::DataStore::Redis.prepend(Stoplight::DataStore::RedisExtensions)
|
|
@ -6,3 +6,14 @@ RSpec::Matchers.define :match_json_schema do |schema|
|
|||
JSON::Validator.validate(schema_path, input_json, validate_schema: true)
|
||||
end
|
||||
end
|
||||
|
||||
RSpec::Matchers.define :match_json_values do |values|
|
||||
match do |string|
|
||||
expect(json_str_to_hash(string))
|
||||
.to include(values)
|
||||
end
|
||||
|
||||
failure_message do |value|
|
||||
"expected that #{value} would have the same values as #{values}."
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ describe ActivityPub::DistributePollUpdateWorker do
|
|||
end
|
||||
|
||||
it 'delivers to followers' do
|
||||
expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), account.id, 'http://example.com']]) do
|
||||
expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[match_json_values(type: 'Update'), account.id, 'http://example.com']]) do
|
||||
subject.perform(status.id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -19,7 +19,7 @@ describe ActivityPub::DistributionWorker do
|
|||
end
|
||||
|
||||
it 'delivers to followers' do
|
||||
expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), status.account.id, 'http://example.com', anything]]) do
|
||||
expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[match_json_values(type: 'Create'), status.account.id, 'http://example.com', anything]]) do
|
||||
subject.perform(status.id)
|
||||
end
|
||||
end
|
||||
|
@ -31,7 +31,7 @@ describe ActivityPub::DistributionWorker do
|
|||
end
|
||||
|
||||
it 'delivers to followers' do
|
||||
expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), status.account.id, 'http://example.com', anything]]) do
|
||||
expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[match_json_values(type: 'Create'), status.account.id, 'http://example.com', anything]]) do
|
||||
subject.perform(status.id)
|
||||
end
|
||||
end
|
||||
|
@ -46,7 +46,7 @@ describe ActivityPub::DistributionWorker do
|
|||
end
|
||||
|
||||
it 'delivers to mentioned accounts' do
|
||||
expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), status.account.id, 'https://foo.bar/inbox', anything]]) do
|
||||
expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[match_json_values(type: 'Create'), status.account.id, 'https://foo.bar/inbox', anything]]) do
|
||||
subject.perform(status.id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,12 +16,16 @@ describe ActivityPub::MoveDistributionWorker do
|
|||
end
|
||||
|
||||
it 'delivers to followers and known blockers' do
|
||||
expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [
|
||||
[kind_of(String), migration.account.id, 'http://example.com'],
|
||||
[kind_of(String), migration.account.id, 'http://example2.com'],
|
||||
]) do
|
||||
expect_push_bulk_to_match(ActivityPub::DeliveryWorker, expected_migration_deliveries) do
|
||||
subject.perform(migration.id)
|
||||
end
|
||||
end
|
||||
|
||||
def expected_migration_deliveries
|
||||
[
|
||||
[match_json_values(type: 'Move'), migration.account.id, 'http://example.com'],
|
||||
[match_json_values(type: 'Move'), migration.account.id, 'http://example2.com'],
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -25,7 +25,7 @@ describe ActivityPub::StatusUpdateDistributionWorker do
|
|||
end
|
||||
|
||||
it 'delivers to followers' do
|
||||
expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), status.account.id, 'http://example.com', anything]]) do
|
||||
expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[match_json_values(type: 'Update'), status.account.id, 'http://example.com', anything]]) do
|
||||
subject.perform(status.id)
|
||||
end
|
||||
end
|
||||
|
@ -37,7 +37,7 @@ describe ActivityPub::StatusUpdateDistributionWorker do
|
|||
end
|
||||
|
||||
it 'delivers to followers' do
|
||||
expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), status.account.id, 'http://example.com', anything]]) do
|
||||
expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[match_json_values(type: 'Update'), status.account.id, 'http://example.com', anything]]) do
|
||||
subject.perform(status.id)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -14,7 +14,7 @@ describe ActivityPub::UpdateDistributionWorker do
|
|||
end
|
||||
|
||||
it 'delivers to followers' do
|
||||
expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[kind_of(String), account.id, 'http://example.com', anything]]) do
|
||||
expect_push_bulk_to_match(ActivityPub::DeliveryWorker, [[match_json_values(type: 'Update'), account.id, 'http://example.com', anything]]) do
|
||||
subject.perform(account.id)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue