Merge branch 'master' into glitch-soc/merge-upstream

lolsob-rspec
Thibaut Girka 2018-11-29 19:22:52 +01:00
commit 77b9249250
9 changed files with 73 additions and 52 deletions

View File

@ -15,7 +15,7 @@ gem 'makara', '~> 0.4'
gem 'pghero', '~> 2.2' gem 'pghero', '~> 2.2'
gem 'dotenv-rails', '~> 2.5' gem 'dotenv-rails', '~> 2.5'
gem 'aws-sdk-s3', '~> 1.25', require: false gem 'aws-sdk-s3', '~> 1.27', require: false
gem 'fog-core', '<= 2.1.0' gem 'fog-core', '<= 2.1.0'
gem 'fog-openstack', '~> 0.3', require: false gem 'fog-openstack', '~> 0.3', require: false
gem 'paperclip', '~> 6.0' gem 'paperclip', '~> 6.0'

View File

@ -15,25 +15,25 @@ GIT
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actioncable (5.2.1) actioncable (5.2.1.1)
actionpack (= 5.2.1) actionpack (= 5.2.1.1)
nio4r (~> 2.0) nio4r (~> 2.0)
websocket-driver (>= 0.6.1) websocket-driver (>= 0.6.1)
actionmailer (5.2.1) actionmailer (5.2.1.1)
actionpack (= 5.2.1) actionpack (= 5.2.1.1)
actionview (= 5.2.1) actionview (= 5.2.1.1)
activejob (= 5.2.1) activejob (= 5.2.1.1)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
actionpack (5.2.1) actionpack (5.2.1.1)
actionview (= 5.2.1) actionview (= 5.2.1.1)
activesupport (= 5.2.1) activesupport (= 5.2.1.1)
rack (~> 2.0) rack (~> 2.0)
rack-test (>= 0.6.3) rack-test (>= 0.6.3)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (5.2.1) actionview (5.2.1.1)
activesupport (= 5.2.1) activesupport (= 5.2.1.1)
builder (~> 3.1) builder (~> 3.1)
erubi (~> 1.4) erubi (~> 1.4)
rails-dom-testing (~> 2.0) rails-dom-testing (~> 2.0)
@ -44,20 +44,20 @@ GEM
case_transform (>= 0.2) case_transform (>= 0.2)
jsonapi-renderer (>= 0.1.1.beta1, < 0.3) jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
active_record_query_trace (1.5.4) active_record_query_trace (1.5.4)
activejob (5.2.1) activejob (5.2.1.1)
activesupport (= 5.2.1) activesupport (= 5.2.1.1)
globalid (>= 0.3.6) globalid (>= 0.3.6)
activemodel (5.2.1) activemodel (5.2.1.1)
activesupport (= 5.2.1) activesupport (= 5.2.1.1)
activerecord (5.2.1) activerecord (5.2.1.1)
activemodel (= 5.2.1) activemodel (= 5.2.1.1)
activesupport (= 5.2.1) activesupport (= 5.2.1.1)
arel (>= 9.0) arel (>= 9.0)
activestorage (5.2.1) activestorage (5.2.1.1)
actionpack (= 5.2.1) actionpack (= 5.2.1.1)
activerecord (= 5.2.1) activerecord (= 5.2.1.1)
marcel (~> 0.3.1) marcel (~> 0.3.1)
activesupport (5.2.1) activesupport (5.2.1.1)
concurrent-ruby (~> 1.0, >= 1.0.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 0.7, < 2) i18n (>= 0.7, < 2)
minitest (~> 5.1) minitest (~> 5.1)
@ -76,16 +76,16 @@ GEM
av (0.9.0) av (0.9.0)
cocaine (~> 0.5.3) cocaine (~> 0.5.3)
aws-eventstream (1.0.1) aws-eventstream (1.0.1)
aws-partitions (1.115.0) aws-partitions (1.118.0)
aws-sdk-core (3.39.0) aws-sdk-core (3.41.0)
aws-eventstream (~> 1.0) aws-eventstream (~> 1.0)
aws-partitions (~> 1.0) aws-partitions (~> 1.0)
aws-sigv4 (~> 1.0) aws-sigv4 (~> 1.0)
jmespath (~> 1.0) jmespath (~> 1.0)
aws-sdk-kms (1.12.0) aws-sdk-kms (1.13.0)
aws-sdk-core (~> 3, >= 3.39.0) aws-sdk-core (~> 3, >= 3.39.0)
aws-sigv4 (~> 1.0) aws-sigv4 (~> 1.0)
aws-sdk-s3 (1.25.0) aws-sdk-s3 (1.27.0)
aws-sdk-core (~> 3, >= 3.39.0) aws-sdk-core (~> 3, >= 3.39.0)
aws-sdk-kms (~> 1) aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.0) aws-sigv4 (~> 1.0)
@ -323,16 +323,16 @@ GEM
loofah (2.2.3) loofah (2.2.3)
crass (~> 1.0.2) crass (~> 1.0.2)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.7.0) mail (2.7.1)
mini_mime (>= 0.1.1) mini_mime (>= 0.1.1)
makara (0.4.0) makara (0.4.0)
activerecord (>= 3.0.0) activerecord (>= 3.0.0)
marcel (0.3.2) marcel (0.3.3)
mimemagic (~> 0.3.2) mimemagic (~> 0.3.2)
mario-redis-lock (1.2.1) mario-redis-lock (1.2.1)
redis (>= 3.0.5) redis (>= 3.0.5)
memory_profiler (0.9.12) memory_profiler (0.9.12)
method_source (0.9.1) method_source (0.9.2)
microformats (4.0.7) microformats (4.0.7)
json json
nokogiri nokogiri
@ -431,18 +431,18 @@ GEM
rack rack
rack-test (1.1.0) rack-test (1.1.0)
rack (>= 1.0, < 3) rack (>= 1.0, < 3)
rails (5.2.1) rails (5.2.1.1)
actioncable (= 5.2.1) actioncable (= 5.2.1.1)
actionmailer (= 5.2.1) actionmailer (= 5.2.1.1)
actionpack (= 5.2.1) actionpack (= 5.2.1.1)
actionview (= 5.2.1) actionview (= 5.2.1.1)
activejob (= 5.2.1) activejob (= 5.2.1.1)
activemodel (= 5.2.1) activemodel (= 5.2.1.1)
activerecord (= 5.2.1) activerecord (= 5.2.1.1)
activestorage (= 5.2.1) activestorage (= 5.2.1.1)
activesupport (= 5.2.1) activesupport (= 5.2.1.1)
bundler (>= 1.3.0) bundler (>= 1.3.0)
railties (= 5.2.1) railties (= 5.2.1.1)
sprockets-rails (>= 2.0.0) sprockets-rails (>= 2.0.0)
rails-controller-testing (1.0.2) rails-controller-testing (1.0.2)
actionpack (~> 5.x, >= 5.0.1) actionpack (~> 5.x, >= 5.0.1)
@ -458,9 +458,9 @@ GEM
railties (>= 5.0, < 6) railties (>= 5.0, < 6)
rails-settings-cached (0.6.6) rails-settings-cached (0.6.6)
rails (>= 4.2.0) rails (>= 4.2.0)
railties (5.2.1) railties (5.2.1.1)
actionpack (= 5.2.1) actionpack (= 5.2.1.1)
activesupport (= 5.2.1) activesupport (= 5.2.1.1)
method_source method_source
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.19.0, < 2.0) thor (>= 0.19.0, < 2.0)
@ -653,7 +653,7 @@ DEPENDENCIES
active_record_query_trace (~> 1.5) active_record_query_trace (~> 1.5)
addressable (~> 2.5) addressable (~> 2.5)
annotate (~> 2.7) annotate (~> 2.7)
aws-sdk-s3 (~> 1.25) aws-sdk-s3 (~> 1.27)
better_errors (~> 2.5) better_errors (~> 2.5)
binding_of_caller (~> 0.7) binding_of_caller (~> 0.7)
bootsnap (~> 1.3) bootsnap (~> 1.3)

View File

@ -4,6 +4,16 @@ require 'ipaddr'
require 'socket' require 'socket'
require 'resolv' require 'resolv'
# Monkey-patch the HTTP.rb timeout class to avoid using a timeout block
# around the Socket#open method, since we use our own timeout blocks inside
# that method
class HTTP::Timeout::PerOperation
def connect(socket_class, host, port, nodelay = false)
@socket = socket_class.open(host, port)
@socket.setsockopt(Socket::IPPROTO_TCP, Socket::TCP_NODELAY, 1) if nodelay
end
end
class Request class Request
REQUEST_TARGET = '(request-target)' REQUEST_TARGET = '(request-target)'
@ -95,7 +105,11 @@ class Request
end end
def timeout def timeout
{ connect: nil, read: 10, write: 10 } # We enforce a 1s timeout on DNS resolving, 10s timeout on socket opening
# and 5s timeout on the TLS handshake, meaning the worst case should take
# about 16s in total
{ connect: 5, read: 10, write: 10 }
end end
def http_client def http_client
@ -163,7 +177,11 @@ class Request
end end
end end
raise outer_e if outer_e if outer_e
raise outer_e
else
raise SocketError, "No address for #{host}"
end
end end
alias new open alias new open

View File

@ -18,7 +18,7 @@ class InstancePresenter
end end
def user_count def user_count
Rails.cache.fetch('user_count') { User.confirmed.count } Rails.cache.fetch('user_count') { User.confirmed.joins(:account).merge(Account.without_suspended).count }
end end
def status_count def status_count

View File

@ -14,9 +14,10 @@
= render 'application/card', account: @account = render 'application/card', account: @account
.fields-row__column.fields-group.fields-row__column-6 .fields-row__column.fields-group.fields-row__column-6
= f.input :header, wrapper: :with_label, input_html: { accept: AccountHeader::IMAGE_MIME_TYPES.join(',') }, hint: t('simple_form.hints.defaults.header', dimensions: '1500x500', size: number_to_human_size(AccountHeader::LIMIT))
= f.input :avatar, wrapper: :with_label, input_html: { accept: AccountAvatar::IMAGE_MIME_TYPES.join(',') }, hint: t('simple_form.hints.defaults.avatar', dimensions: '400x400', size: number_to_human_size(AccountAvatar::LIMIT)) = f.input :avatar, wrapper: :with_label, input_html: { accept: AccountAvatar::IMAGE_MIME_TYPES.join(',') }, hint: t('simple_form.hints.defaults.avatar', dimensions: '400x400', size: number_to_human_size(AccountAvatar::LIMIT))
= f.input :header, wrapper: :with_label, input_html: { accept: AccountHeader::IMAGE_MIME_TYPES.join(',') }, hint: t('simple_form.hints.defaults.header', dimensions: '1500x500', size: number_to_human_size(AccountHeader::LIMIT))
%hr.spacer/ %hr.spacer/

View File

@ -11,6 +11,8 @@ class ActivityPub::DeliveryWorker
HEADERS = { 'Content-Type' => 'application/activity+json' }.freeze HEADERS = { 'Content-Type' => 'application/activity+json' }.freeze
def perform(json, source_account_id, inbox_url, options = {}) def perform(json, source_account_id, inbox_url, options = {})
return if DeliveryFailureTracker.unavailable?(inbox_url)
@options = options.with_indifferent_access @options = options.with_indifferent_access
@json = json @json = json
@source_account = Account.find(source_account_id) @source_account = Account.find(source_account_id)

View File

@ -8,7 +8,7 @@ fr:
failure: failure:
already_authenticated: Vous êtes déjà connecté⋅e. already_authenticated: Vous êtes déjà connecté⋅e.
inactive: Votre compte nest pas encore activé. inactive: Votre compte nest pas encore activé.
invalid: "%{authentication_keys} incorrect." invalid: "%{authentication_keys} invalide."
last_attempt: Vous avez droit à une tentative avant que votre compte ne soit verrouillé. last_attempt: Vous avez droit à une tentative avant que votre compte ne soit verrouillé.
locked: Votre compte est verrouillé. locked: Votre compte est verrouillé.
not_found_in_database: "%{authentication_keys} invalide." not_found_in_database: "%{authentication_keys} invalide."

View File

@ -8,7 +8,7 @@ hr:
invalid: Nevaljan %{authentication_keys} ili lozinka. invalid: Nevaljan %{authentication_keys} ili lozinka.
last_attempt: Imaš još jedan pokušaj prije no što ti se račun zaključa. last_attempt: Imaš još jedan pokušaj prije no što ti se račun zaključa.
locked: Tvoj račun je zaključan. locked: Tvoj račun je zaključan.
not_found_in_database: Nevaljani %{authentication_keys} ili lozinka. not_found_in_database: Nevaljan %{authentication_keys} ili lozinka.
send_instructions: Primit ćeš email sa uputama kako potvrditi svoju email adresu za nekoliko minuta. send_instructions: Primit ćeš email sa uputama kako potvrditi svoju email adresu za nekoliko minuta.
send_paranoid_instructions: Ako tvoja email adresa postoji u našoj bazi podataka, primit ćeš email sa uputama kako ju potvrditi za nekoliko minuta. send_paranoid_instructions: Ako tvoja email adresa postoji u našoj bazi podataka, primit ćeš email sa uputama kako ju potvrditi za nekoliko minuta.
timeout: Tvoja sesija je istekla. Molimo te, prijavi se ponovo kako bi nastavio. timeout: Tvoja sesija je istekla. Molimo te, prijavi se ponovo kako bi nastavio.

View File

@ -11,7 +11,7 @@ uk:
invalid: Неправильний %{authentication_keys} або пароль. invalid: Неправильний %{authentication_keys} або пароль.
last_attempt: У вас є остання спроба, після якої вхід буде заблокований. last_attempt: У вас є остання спроба, після якої вхід буде заблокований.
locked: Ваш акаунт заблокований. locked: Ваш акаунт заблокований.
not_found_in_database: Неправильні %{authentication_keys} або пароль. not_found_in_database: Неправильний %{authentication_keys} або пароль.
timeout: Ваша сесія вичерпана. Будь ласка, зайдіть знову, щоб продовжити. timeout: Ваша сесія вичерпана. Будь ласка, зайдіть знову, щоб продовжити.
unauthenticated: Для продовження Вам потрібно увійти або зареєструватися. unauthenticated: Для продовження Вам потрібно увійти або зареєструватися.
unconfirmed: Для продовження Вам потрібно підтвердити Вашу поштову скриньку. unconfirmed: Для продовження Вам потрібно підтвердити Вашу поштову скриньку.