From 3a2f007eb0edd317b22835a720ef3478dbc4f5a9 Mon Sep 17 00:00:00 2001 From: Grey Baker Date: Mon, 1 Oct 2018 21:34:25 +0100 Subject: [PATCH 01/28] Promote colorize to top-level dependency (#8844) --- Gemfile | 1 + Gemfile.lock | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Gemfile b/Gemfile index c5421e3714..a9df6d001f 100644 --- a/Gemfile +++ b/Gemfile @@ -27,6 +27,7 @@ gem 'addressable', '~> 2.5' gem 'bootsnap', '~> 1.3', require: false gem 'browser' gem 'charlock_holmes', '~> 0.7.6' +gem 'colorize' gem 'iso-639' gem 'chewy', '~> 5.0' gem 'cld3', '~> 3.2.0' diff --git a/Gemfile.lock b/Gemfile.lock index 3a8e2c5c56..7b01ad87a7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -669,6 +669,7 @@ DEPENDENCIES chewy (~> 5.0) cld3 (~> 3.2.0) climate_control (~> 0.2) + colorize derailed_benchmarks devise (~> 4.5) devise-two-factor (~> 3.0) @@ -768,4 +769,4 @@ RUBY VERSION ruby 2.5.0p0 BUNDLED WITH - 1.16.3 + 1.16.5 From 194ad2c90b06a7ec1d38a5798dd1fa42465fbd13 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Mon, 1 Oct 2018 22:49:26 +0200 Subject: [PATCH 02/28] Bump rack-attack from 5.2.0 to 5.4.1 (#8838) Bumps [rack-attack](https://github.com/kickstarter/rack-attack) from 5.2.0 to 5.4.1. - [Release notes](https://github.com/kickstarter/rack-attack/releases) - [Changelog](https://github.com/kickstarter/rack-attack/blob/master/CHANGELOG.md) - [Commits](https://github.com/kickstarter/rack-attack/compare/v5.2.0...v5.4.1) Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index a9df6d001f..6e2d3c2d36 100644 --- a/Gemfile +++ b/Gemfile @@ -66,7 +66,7 @@ gem 'ox', '~> 2.10' gem 'posix-spawn', git: 'https://github.com/rtomayko/posix-spawn', ref: '58465d2e213991f8afb13b984854a49fcdcc980c' gem 'pundit', '~> 1.1' gem 'premailer-rails' -gem 'rack-attack', '~> 5.2' +gem 'rack-attack', '~> 5.4' gem 'rack-cors', '~> 1.0', require: 'rack/cors' gem 'rails-i18n', '~> 5.1' gem 'rails-settings-cached', '~> 0.6' diff --git a/Gemfile.lock b/Gemfile.lock index 7b01ad87a7..387186f1d0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -420,8 +420,8 @@ GEM activesupport (>= 3.0.0) raabro (1.1.6) rack (2.0.5) - rack-attack (5.2.0) - rack + rack-attack (5.4.1) + rack (>= 1.0, < 3) rack-cors (1.0.2) rack-protection (2.0.4) rack @@ -727,7 +727,7 @@ DEPENDENCIES pry-rails (~> 0.3) puma (~> 3.11) pundit (~> 1.1) - rack-attack (~> 5.2) + rack-attack (~> 5.4) rack-cors (~> 1.0) rails (~> 5.2.1) rails-controller-testing (~> 1.0) From b95d944625ce1b1624d9ac58b417f1b5000dd28a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Tue, 2 Oct 2018 15:37:28 +0900 Subject: [PATCH 03/28] Bump webpush from 0.3.3 to 0.3.4 (#8846) Bumps [webpush](https://github.com/zaru/webpush) from 0.3.3 to 0.3.4. - [Release notes](https://github.com/zaru/webpush/releases) - [Commits](https://github.com/zaru/webpush/compare/v0.3.3...v0.3.4) Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 387186f1d0..e829424297 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -634,7 +634,7 @@ GEM activesupport (>= 4.2) rack-proxy (>= 0.6.1) railties (>= 4.2) - webpush (0.3.3) + webpush (0.3.4) hkdf (~> 0.2) jwt (~> 2.0) websocket-driver (0.7.0) From 3dac9565870a99462cd02ce30b755113bdfb97db Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Tue, 2 Oct 2018 17:20:52 +0900 Subject: [PATCH 04/28] Bump fastimage from 2.1.1 to 2.1.4 (#8847) Bumps [fastimage](https://github.com/sdsykes/fastimage) from 2.1.1 to 2.1.4. - [Release notes](https://github.com/sdsykes/fastimage/releases) - [Commits](https://github.com/sdsykes/fastimage/compare/v2.1.1...v2.1.4) Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index e829424297..0d27e0d68b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -211,7 +211,7 @@ GEM faraday (0.15.0) multipart-post (>= 1.2, < 3) fast_blank (1.0.0) - fastimage (2.1.1) + fastimage (2.1.4) ffi (1.9.25) fog-core (1.45.0) builder From d19b6253943b674b8da6e63de352d91e3fe09f9f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Tue, 2 Oct 2018 20:16:05 +0200 Subject: [PATCH 05/28] Bump redis from 4.0.1 to 4.0.2 (#8850) Bumps [redis](https://github.com/redis/redis-rb) from 4.0.1 to 4.0.2. - [Release notes](https://github.com/redis/redis-rb/releases) - [Changelog](https://github.com/redis/redis-rb/blob/master/CHANGELOG.md) - [Commits](https://github.com/redis/redis-rb/compare/v4.0.1...v4.0.2) Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 0d27e0d68b..f3edf976b1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -472,7 +472,7 @@ GEM link_header (~> 0.0, >= 0.0.8) rdf-normalize (0.3.3) rdf (>= 2.2, < 4.0) - redis (4.0.1) + redis (4.0.2) redis-actionpack (5.0.2) actionpack (>= 4.0, < 6) redis-rack (>= 1, < 3) From 3f62b119e4c97d6edf1a983842f680a5442aab41 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Tue, 2 Oct 2018 20:16:51 +0200 Subject: [PATCH 06/28] Bump rubocop from 0.55.0 to 0.59.2 (#8849) Bumps [rubocop](https://github.com/rubocop-hq/rubocop) from 0.55.0 to 0.59.2. - [Release notes](https://github.com/rubocop-hq/rubocop/releases) - [Changelog](https://github.com/rubocop-hq/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop-hq/rubocop/compare/v0.55.0...v0.59.2) Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Gemfile b/Gemfile index 6e2d3c2d36..34b071721d 100644 --- a/Gemfile +++ b/Gemfile @@ -128,7 +128,7 @@ group :development do gem 'letter_opener', '~> 1.4' gem 'letter_opener_web', '~> 1.3' gem 'memory_profiler' - gem 'rubocop', '~> 0.55', require: false + gem 'rubocop', '~> 0.59', require: false gem 'brakeman', '~> 4.2', require: false gem 'bundler-audit', '~> 0.6', require: false gem 'scss_lint', '~> 0.57', require: false diff --git a/Gemfile.lock b/Gemfile.lock index f3edf976b1..e91be11677 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -285,6 +285,7 @@ GEM idn-ruby (0.1.0) ipaddress (0.8.3) iso-639 (0.2.8) + jaro_winkler (1.5.1) jmespath (1.4.0) json (2.1.0) json-ld (2.2.1) @@ -388,7 +389,7 @@ GEM parallel (1.12.1) parallel_tests (2.21.3) parallel - parser (2.5.1.0) + parser (2.5.1.2) ast (~> 2.4.0) pastel (0.7.2) equatable (~> 0.5.0) @@ -397,7 +398,7 @@ GEM pghero (2.2.0) activerecord pkg-config (1.3.1) - powerpack (0.1.1) + powerpack (0.1.2) premailer (1.11.1) addressable css_parser (>= 1.6.0) @@ -520,9 +521,10 @@ GEM rspec-core (~> 3.0, >= 3.0.0) sidekiq (>= 2.4.0) rspec-support (3.7.1) - rubocop (0.55.0) + rubocop (0.59.2) + jaro_winkler (~> 1.5.1) parallel (~> 1.10) - parser (>= 2.5) + parser (>= 2.5, != 2.5.1.1) powerpack (~> 0.1) rainbow (>= 2.2.2, < 4.0) ruby-progressbar (~> 1.7) @@ -622,7 +624,7 @@ GEM unf (0.1.4) unf_ext unf_ext (0.0.7.5) - unicode-display_width (1.3.2) + unicode-display_width (1.4.0) uniform_notifier (1.11.0) warden (1.2.7) rack (>= 1.0) @@ -740,7 +742,7 @@ DEPENDENCIES rqrcode (~> 0.10) rspec-rails (~> 3.7) rspec-sidekiq (~> 3.0) - rubocop (~> 0.55) + rubocop (~> 0.59) ruby-progressbar (~> 1.4) sanitize (~> 4.6) scss_lint (~> 0.57) From 53275b949e08cee495eabe9b6887bacf01708840 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Wed, 3 Oct 2018 04:56:00 +0200 Subject: [PATCH 07/28] Bump httplog from 1.0.2 to 1.1.1 (#8839) Bumps [httplog](https://github.com/trusche/httplog) from 1.0.2 to 1.1.1. - [Release notes](https://github.com/trusche/httplog/releases) - [Changelog](https://github.com/trusche/httplog/blob/master/CHANGELOG.md) - [Commits](https://github.com/trusche/httplog/compare/v1.0.2...v1.1.1) Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 34b071721d..43e6ae6a15 100644 --- a/Gemfile +++ b/Gemfile @@ -53,7 +53,7 @@ gem 'htmlentities', '~> 4.3' gem 'http', '~> 3.2' gem 'http_accept_language', '~> 2.1' gem 'http_parser.rb', '~> 0.6', git: 'https://github.com/tmm1/http_parser.rb', ref: '54b17ba8c7d8d20a16dfc65d1775241833219cf2' -gem 'httplog', '~> 1.0' +gem 'httplog', '~> 1.1' gem 'idn-ruby', require: 'idn' gem 'kaminari', '~> 1.1' gem 'link_header', '~> 0.0' diff --git a/Gemfile.lock b/Gemfile.lock index e91be11677..4e8d9225b3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -267,9 +267,9 @@ GEM domain_name (~> 0.5) http-form_data (2.1.0) http_accept_language (2.1.1) - httplog (1.0.2) - colorize (~> 0.8) + httplog (1.1.1) rack (>= 1.0) + rainbow (>= 2.0.0) i18n (1.1.0) concurrent-ruby (~> 1.0) i18n-tasks (0.9.21) @@ -692,7 +692,7 @@ DEPENDENCIES http (~> 3.2) http_accept_language (~> 2.1) http_parser.rb (~> 0.6)! - httplog (~> 1.0) + httplog (~> 1.1) i18n-tasks (~> 0.9) idn-ruby iso-639 From 730f196b967203fcdfc942dcb9fe72bb86bf4ef9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Wed, 3 Oct 2018 15:20:56 +0200 Subject: [PATCH 08/28] Bump pg from 1.0.0 to 1.1.3 (#8856) Bumps [pg](https://bitbucket.org/ged/ruby-pg) from 1.0.0 to 1.1.3. - [Changelog](https://bitbucket.org/ged/ruby-pg/src/master/History.rdoc) - [Commits](https://bitbucket.org/ged/ruby-pg/branches/compare/v1.1.3..v1.0.0) Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 43e6ae6a15..90c41afb0d 100644 --- a/Gemfile +++ b/Gemfile @@ -10,7 +10,7 @@ gem 'rails', '~> 5.2.1' gem 'thor', '~> 0.20' gem 'hamlit-rails', '~> 0.2' -gem 'pg', '~> 1.0' +gem 'pg', '~> 1.1' gem 'makara', '~> 0.4' gem 'pghero', '~> 2.2' gem 'dotenv-rails', '~> 2.2', '< 2.3' diff --git a/Gemfile.lock b/Gemfile.lock index 4e8d9225b3..1461f6fed8 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -394,7 +394,7 @@ GEM pastel (0.7.2) equatable (~> 0.5.0) tty-color (~> 0.4.0) - pg (1.0.0) + pg (1.1.3) pghero (2.2.0) activerecord pkg-config (1.3.1) @@ -719,7 +719,7 @@ DEPENDENCIES paperclip (~> 6.0) paperclip-av-transcoder (~> 0.6) parallel_tests (~> 2.21) - pg (~> 1.0) + pg (~> 1.1) pghero (~> 2.2) pkg-config (~> 1.3) posix-spawn! From 58410a54b029ecd4fe32ac70877e0e3790e75c1d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Wed, 3 Oct 2018 15:21:30 +0200 Subject: [PATCH 09/28] Bump capistrano-rbenv from 2.1.3 to 2.1.4 (#8859) Bumps [capistrano-rbenv](https://github.com/capistrano/rbenv) from 2.1.3 to 2.1.4. - [Release notes](https://github.com/capistrano/rbenv/releases) - [Changelog](https://github.com/capistrano/rbenv/blob/master/CHANGELOG.md) - [Commits](https://github.com/capistrano/rbenv/compare/v2.1.3...v2.1.4) Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 1461f6fed8..5d05221105 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -119,7 +119,7 @@ GEM capistrano-rails (1.3.1) capistrano (~> 3.1) capistrano-bundler (~> 1.1) - capistrano-rbenv (2.1.3) + capistrano-rbenv (2.1.4) capistrano (~> 3.1) sshkit (~> 1.3) capistrano-yarn (2.0.2) From c62b88e3f273631be82c736b8b2cf9df1bcecea1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Wed, 3 Oct 2018 15:22:06 +0200 Subject: [PATCH 10/28] Bump derailed_benchmarks from 1.3.4 to 1.3.5 (#8857) Bumps [derailed_benchmarks](https://github.com/schneems/derailed_benchmarks) from 1.3.4 to 1.3.5. - [Release notes](https://github.com/schneems/derailed_benchmarks/releases) - [Changelog](https://github.com/schneems/derailed_benchmarks/blob/master/CHANGELOG.md) - [Commits](https://github.com/schneems/derailed_benchmarks/compare/v1.3.4...v1.3.5) Signed-off-by: dependabot[bot] --- Gemfile.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 5d05221105..5ea9ddadea 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -154,7 +154,7 @@ GEM css_parser (1.6.0) addressable debug_inspector (0.0.3) - derailed_benchmarks (1.3.4) + derailed_benchmarks (1.3.5) benchmark-ips (~> 2) get_process_mem (~> 0) heapy (~> 0) @@ -231,7 +231,7 @@ GEM fuubar (2.3.1) rspec-core (~> 3.0) ruby-progressbar (~> 1.4) - get_process_mem (0.2.1) + get_process_mem (0.2.2) globalid (0.4.1) activesupport (>= 4.2.0) goldfinger (2.1.0) @@ -252,7 +252,7 @@ GEM concurrent-ruby (~> 1.0) hashdiff (0.3.7) hashie (3.5.7) - heapy (0.1.3) + heapy (0.1.4) highline (1.7.10) hiredis (0.6.1) hitimes (1.3.0) From 3b6ab82db71892f72b4850e095f7dc635d717501 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Wed, 3 Oct 2018 15:24:48 +0200 Subject: [PATCH 11/28] Bump capybara from 2.18.0 to 3.8.2 (#8858) Bumps [capybara](https://github.com/teamcapybara/capybara) from 2.18.0 to 3.8.2. - [Release notes](https://github.com/teamcapybara/capybara/releases) - [Changelog](https://github.com/teamcapybara/capybara/blob/master/History.md) - [Commits](https://github.com/teamcapybara/capybara/compare/2.18.0...3.8.2) Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Gemfile b/Gemfile index 90c41afb0d..8831d66cee 100644 --- a/Gemfile +++ b/Gemfile @@ -108,7 +108,7 @@ group :production, :test do end group :test do - gem 'capybara', '~> 2.18' + gem 'capybara', '~> 3.8' gem 'climate_control', '~> 0.2' gem 'faker', '~> 1.8' gem 'microformats', '~> 4.0' diff --git a/Gemfile.lock b/Gemfile.lock index 5ea9ddadea..6ebba47724 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -124,13 +124,13 @@ GEM sshkit (~> 1.3) capistrano-yarn (2.0.2) capistrano (~> 3.0) - capybara (2.18.0) + capybara (3.8.2) addressable mini_mime (>= 0.1.3) - nokogiri (>= 1.3.3) - rack (>= 1.0.0) - rack-test (>= 0.5.4) - xpath (>= 2.0, < 4.0) + nokogiri (~> 1.8) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + xpath (~> 3.1) case_transform (0.2) activesupport charlock_holmes (0.7.6) @@ -339,7 +339,7 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2018.0812) mimemagic (0.3.2) - mini_mime (1.0.0) + mini_mime (1.0.1) mini_portile2 (2.3.0) minitest (5.11.3) msgpack (1.2.4) @@ -415,7 +415,7 @@ GEM pry (~> 0.10) pry-rails (0.3.6) pry (>= 0.10.4) - public_suffix (3.0.2) + public_suffix (3.0.3) puma (3.11.4) pundit (1.1.0) activesupport (>= 3.0.0) @@ -643,7 +643,7 @@ GEM websocket-extensions (>= 0.1.0) websocket-extensions (0.1.3) wisper (2.0.0) - xpath (3.0.0) + xpath (3.1.0) nokogiri (~> 1.8) PLATFORMS @@ -666,7 +666,7 @@ DEPENDENCIES capistrano-rails (~> 1.3) capistrano-rbenv (~> 2.1) capistrano-yarn (~> 2.0) - capybara (~> 2.18) + capybara (~> 3.8) charlock_holmes (~> 0.7.6) chewy (~> 5.0) cld3 (~> 3.2.0) From ba444797d20f744250fe2670a8c1f0424c909a84 Mon Sep 17 00:00:00 2001 From: ThibG Date: Wed, 3 Oct 2018 23:44:13 +0200 Subject: [PATCH 12/28] Fix handling of ActivityPub activities lacking some attributes (#8864) --- app/lib/activitypub/activity/accept.rb | 2 +- app/lib/activitypub/activity/delete.rb | 2 ++ app/lib/activitypub/activity/reject.rb | 2 +- app/lib/activitypub/activity/undo.rb | 2 ++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/lib/activitypub/activity/accept.rb b/app/lib/activitypub/activity/accept.rb index 7e60b2c00e..348ee0d1cb 100644 --- a/app/lib/activitypub/activity/accept.rb +++ b/app/lib/activitypub/activity/accept.rb @@ -26,7 +26,7 @@ class ActivityPub::Activity::Accept < ActivityPub::Activity end def relay - @relay ||= Relay.find_by(follow_activity_id: object_uri) + @relay ||= Relay.find_by(follow_activity_id: object_uri) unless object_uri.nil? end def relay_follow? diff --git a/app/lib/activitypub/activity/delete.rb b/app/lib/activitypub/activity/delete.rb index 3474d55d94..457047ac06 100644 --- a/app/lib/activitypub/activity/delete.rb +++ b/app/lib/activitypub/activity/delete.rb @@ -17,6 +17,8 @@ class ActivityPub::Activity::Delete < ActivityPub::Activity end def delete_note + return if object_uri.nil? + @status = Status.find_by(uri: object_uri, account: @account) @status ||= Status.find_by(uri: @object['atomUri'], account: @account) if @object.is_a?(Hash) && @object['atomUri'].present? diff --git a/app/lib/activitypub/activity/reject.rb b/app/lib/activitypub/activity/reject.rb index d81b157de8..dba21fb9a7 100644 --- a/app/lib/activitypub/activity/reject.rb +++ b/app/lib/activitypub/activity/reject.rb @@ -28,7 +28,7 @@ class ActivityPub::Activity::Reject < ActivityPub::Activity end def relay - @relay ||= Relay.find_by(follow_activity_id: object_uri) + @relay ||= Relay.find_by(follow_activity_id: object_uri) unless object_uri.nil? end def relay_follow? diff --git a/app/lib/activitypub/activity/undo.rb b/app/lib/activitypub/activity/undo.rb index 64c2be7d9c..599823c6e2 100644 --- a/app/lib/activitypub/activity/undo.rb +++ b/app/lib/activitypub/activity/undo.rb @@ -19,6 +19,8 @@ class ActivityPub::Activity::Undo < ActivityPub::Activity private def undo_announce + return if object_uri.nil? + status = Status.find_by(uri: object_uri, account: @account) status ||= Status.find_by(uri: @object['atomUri'], account: @account) if @object.is_a?(Hash) && @object['atomUri'].present? From a524182a17254b04a152cae958641d67356dcd33 Mon Sep 17 00:00:00 2001 From: Andreas Sander Date: Thu, 4 Oct 2018 01:04:12 +0200 Subject: [PATCH 13/28] German translation issue on landingpage CTA (#8865) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is a German translation issue on the landingpage's CTA showing number of users and status posted on the instance. But as it is right now a verb is missing for the number of status posted. But adding there the right verb like "Zuhause für X Benutzer die Y Status veröffentlichten" the text at the bottom of the numbers is getting a bit too big. That's the reason I changed wording to "Zuhause für X Benutzer mit Y Statusmeldungen" which seems shorter and more in balance regarding top and bottom text on the numbers. --- config/locales/de.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/config/locales/de.yml b/config/locales/de.yml index a6d65203fb..09e381f96e 100644 --- a/config/locales/de.yml +++ b/config/locales/de.yml @@ -31,9 +31,9 @@ de: privacy_policy: Datenschutzerklärung source_code: Quellcode status_count_after: - one: Status - other: Status - status_count_before: die + one: Statusmeldung + other: Statusmeldungen + status_count_before: mit terms: Nutzungsbedingungen user_count_after: one: Benutzer From 941c9d0d4270efa8c93b8c4136605e4bca6e4321 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Thu, 4 Oct 2018 01:06:54 +0200 Subject: [PATCH 14/28] Bump aws-sdk-s3 from 1.9.1 to 1.20.0 (#8848) Bumps [aws-sdk-s3](https://github.com/aws/aws-sdk-ruby) from 1.9.1 to 1.20.0. - [Release notes](https://github.com/aws/aws-sdk-ruby/releases) - [Changelog](https://github.com/aws/aws-sdk-ruby/blob/master/gems/aws-sdk-s3/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-ruby/commits) Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Gemfile b/Gemfile index 8831d66cee..7a74aaf3f1 100644 --- a/Gemfile +++ b/Gemfile @@ -15,7 +15,7 @@ gem 'makara', '~> 0.4' gem 'pghero', '~> 2.2' gem 'dotenv-rails', '~> 2.2', '< 2.3' -gem 'aws-sdk-s3', '~> 1.9', require: false +gem 'aws-sdk-s3', '~> 1.20', require: false gem 'fog-core', '~> 1.45' gem 'fog-openstack', '~> 0.1', require: false gem 'paperclip', '~> 6.0' diff --git a/Gemfile.lock b/Gemfile.lock index 6ebba47724..ffe4e43d95 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -75,19 +75,21 @@ GEM encryptor (~> 3.0.0) av (0.9.0) cocaine (~> 0.5.3) - aws-partitions (1.80.0) - aws-sdk-core (3.19.0) + aws-eventstream (1.0.1) + aws-partitions (1.105.0) + aws-sdk-core (3.29.0) + aws-eventstream (~> 1.0) aws-partitions (~> 1.0) aws-sigv4 (~> 1.0) jmespath (~> 1.0) - aws-sdk-kms (1.5.0) - aws-sdk-core (~> 3) + aws-sdk-kms (1.9.0) + aws-sdk-core (~> 3, >= 3.26.0) aws-sigv4 (~> 1.0) - aws-sdk-s3 (1.9.1) - aws-sdk-core (~> 3) + aws-sdk-s3 (1.20.0) + aws-sdk-core (~> 3, >= 3.26.0) aws-sdk-kms (~> 1) aws-sigv4 (~> 1.0) - aws-sigv4 (1.0.2) + aws-sigv4 (1.0.3) bcrypt (3.1.12) benchmark-ips (2.7.2) better_errors (2.4.0) @@ -654,7 +656,7 @@ DEPENDENCIES active_record_query_trace (~> 1.5) addressable (~> 2.5) annotate (~> 2.7) - aws-sdk-s3 (~> 1.9) + aws-sdk-s3 (~> 1.20) better_errors (~> 2.4) binding_of_caller (~> 0.7) bootsnap (~> 1.3) From ad459ab83749594b33e91c62ba72bdd9e19f7030 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Thu, 4 Oct 2018 01:07:13 +0200 Subject: [PATCH 15/28] Bump fog-openstack from 0.1.25 to 0.3.6 (#8860) Bumps [fog-openstack](https://github.com/fog/fog-openstack) from 0.1.25 to 0.3.6. - [Release notes](https://github.com/fog/fog-openstack/releases) - [Changelog](https://github.com/fog/fog-openstack/blob/master/CHANGELOG.md) - [Commits](https://github.com/fog/fog-openstack/compare/v0.1.25...v0.3.6) Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Gemfile b/Gemfile index 7a74aaf3f1..7f46ffa66c 100644 --- a/Gemfile +++ b/Gemfile @@ -17,7 +17,7 @@ gem 'dotenv-rails', '~> 2.2', '< 2.3' gem 'aws-sdk-s3', '~> 1.20', require: false gem 'fog-core', '~> 1.45' -gem 'fog-openstack', '~> 0.1', require: false +gem 'fog-openstack', '~> 0.3', require: false gem 'paperclip', '~> 6.0' gem 'paperclip-av-transcoder', '~> 0.6' gem 'streamio-ffmpeg', '~> 3.0' diff --git a/Gemfile.lock b/Gemfile.lock index ffe4e43d95..df1a05d1a5 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -219,11 +219,11 @@ GEM builder excon (~> 0.58) formatador (~> 0.2) - fog-json (1.0.2) - fog-core (~> 1.0) + fog-json (1.2.0) + fog-core multi_json (~> 1.10) - fog-openstack (0.1.25) - fog-core (~> 1.40) + fog-openstack (0.3.6) + fog-core (>= 1.45, <= 2.1.0) fog-json (>= 1.0) ipaddress (>= 0.8) formatador (0.2.5) @@ -685,7 +685,7 @@ DEPENDENCIES fast_blank (~> 1.0) fastimage fog-core (~> 1.45) - fog-openstack (~> 0.1) + fog-openstack (~> 0.3) fuubar (~> 2.2) goldfinger (~> 2.1) hamlit-rails (~> 0.2) From ebb3631216de3adb9dc38846d28e83d32fe3192b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Thu, 4 Oct 2018 12:31:22 +0200 Subject: [PATCH 16/28] Bump brakeman from 4.2.1 to 4.3.1 (#8872) Bumps [brakeman](https://github.com/presidentbeef/brakeman) from 4.2.1 to 4.3.1. - [Release notes](https://github.com/presidentbeef/brakeman/releases) - [Changelog](https://github.com/presidentbeef/brakeman/blob/master/CHANGES.md) - [Commits](https://github.com/presidentbeef/brakeman/compare/v4.2.1...v4.3.1) Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 7f46ffa66c..61ea600705 100644 --- a/Gemfile +++ b/Gemfile @@ -129,7 +129,7 @@ group :development do gem 'letter_opener_web', '~> 1.3' gem 'memory_profiler' gem 'rubocop', '~> 0.59', require: false - gem 'brakeman', '~> 4.2', require: false + gem 'brakeman', '~> 4.3', require: false gem 'bundler-audit', '~> 0.6', require: false gem 'scss_lint', '~> 0.57', require: false diff --git a/Gemfile.lock b/Gemfile.lock index df1a05d1a5..5d410affbf 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -100,7 +100,7 @@ GEM debug_inspector (>= 0.0.1) bootsnap (1.3.2) msgpack (~> 1.0) - brakeman (4.2.1) + brakeman (4.3.1) browser (2.5.3) builder (3.2.3) bullet (5.7.5) @@ -660,7 +660,7 @@ DEPENDENCIES better_errors (~> 2.4) binding_of_caller (~> 0.7) bootsnap (~> 1.3) - brakeman (~> 4.2) + brakeman (~> 4.3) browser bullet (~> 5.7) bundler-audit (~> 0.6) From b70de2cf6908db2ddbe0c35faebead70e8cd8f22 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Thu, 4 Oct 2018 12:32:26 +0200 Subject: [PATCH 17/28] Bump http from 3.2.0 to 3.3.0 (#8871) Bumps [http](https://github.com/httprb/http) from 3.2.0 to 3.3.0. - [Release notes](https://github.com/httprb/http/releases) - [Changelog](https://github.com/httprb/http/blob/master/CHANGES.md) - [Commits](https://github.com/httprb/http/compare/v3.2.0...v3.3.0) Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Gemfile b/Gemfile index 61ea600705..371df28022 100644 --- a/Gemfile +++ b/Gemfile @@ -50,7 +50,7 @@ gem 'goldfinger', '~> 2.1' gem 'hiredis', '~> 0.6' gem 'redis-namespace', '~> 1.5' gem 'htmlentities', '~> 4.3' -gem 'http', '~> 3.2' +gem 'http', '~> 3.3' gem 'http_accept_language', '~> 2.1' gem 'http_parser.rb', '~> 0.6', git: 'https://github.com/tmm1/http_parser.rb', ref: '54b17ba8c7d8d20a16dfc65d1775241833219cf2' gem 'httplog', '~> 1.1' diff --git a/Gemfile.lock b/Gemfile.lock index 5d410affbf..4900adfc61 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -260,14 +260,14 @@ GEM hitimes (1.3.0) hkdf (0.3.0) htmlentities (4.3.4) - http (3.2.0) + http (3.3.0) addressable (~> 2.3) http-cookie (~> 1.0) http-form_data (~> 2.0) http_parser.rb (~> 0.6.0) http-cookie (1.0.3) domain_name (~> 0.5) - http-form_data (2.1.0) + http-form_data (2.1.1) http_accept_language (2.1.1) httplog (1.1.1) rack (>= 1.0) @@ -691,7 +691,7 @@ DEPENDENCIES hamlit-rails (~> 0.2) hiredis (~> 0.6) htmlentities (~> 4.3) - http (~> 3.2) + http (~> 3.3) http_accept_language (~> 2.1) http_parser.rb (~> 0.6)! httplog (~> 1.1) From 10f7916f37472fc228abe4434687028fd0fc38ca Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Thu, 4 Oct 2018 12:33:02 +0200 Subject: [PATCH 18/28] Bump fuubar from 2.3.1 to 2.3.2 (#8875) Bumps [fuubar](https://github.com/thekompanee/fuubar) from 2.3.1 to 2.3.2. - [Release notes](https://github.com/thekompanee/fuubar/releases) - [Changelog](https://github.com/thekompanee/fuubar/blob/master/CHANGELOG.md) - [Commits](https://github.com/thekompanee/fuubar/compare/releases/v2.3.1...releases/v2.3.2) Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 371df28022..36e24f7658 100644 --- a/Gemfile +++ b/Gemfile @@ -96,7 +96,7 @@ gem 'rdf-normalize', '~> 0.3' group :development, :test do gem 'fabrication', '~> 2.20' - gem 'fuubar', '~> 2.2' + gem 'fuubar', '~> 2.3' gem 'i18n-tasks', '~> 0.9', require: false gem 'pry-byebug', '~> 3.6' gem 'pry-rails', '~> 0.3' diff --git a/Gemfile.lock b/Gemfile.lock index 4900adfc61..1cefd09565 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -230,7 +230,7 @@ GEM fugit (1.1.6) et-orbi (~> 1.1, >= 1.1.6) raabro (~> 1.1) - fuubar (2.3.1) + fuubar (2.3.2) rspec-core (~> 3.0) ruby-progressbar (~> 1.4) get_process_mem (0.2.2) @@ -686,7 +686,7 @@ DEPENDENCIES fastimage fog-core (~> 1.45) fog-openstack (~> 0.3) - fuubar (~> 2.2) + fuubar (~> 2.3) goldfinger (~> 2.1) hamlit-rails (~> 0.2) hiredis (~> 0.6) From 928102284a4e77e5f0ab340f4516749d665c2d67 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Thu, 4 Oct 2018 12:34:17 +0200 Subject: [PATCH 19/28] Bump webmock from 3.3.0 to 3.4.2 (#8874) Bumps [webmock](https://github.com/bblimke/webmock) from 3.3.0 to 3.4.2. - [Release notes](https://github.com/bblimke/webmock/releases) - [Changelog](https://github.com/bblimke/webmock/blob/master/CHANGELOG.md) - [Commits](https://github.com/bblimke/webmock/compare/v3.3.0...v3.4.2) Signed-off-by: dependabot[bot] --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 36e24f7658..8b2f3d33d3 100644 --- a/Gemfile +++ b/Gemfile @@ -115,7 +115,7 @@ group :test do gem 'rails-controller-testing', '~> 1.0' gem 'rspec-sidekiq', '~> 3.0' gem 'simplecov', '~> 0.16', require: false - gem 'webmock', '~> 3.3' + gem 'webmock', '~> 3.4' gem 'parallel_tests', '~> 2.21' end diff --git a/Gemfile.lock b/Gemfile.lock index 1cefd09565..0f00a8003f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -630,7 +630,7 @@ GEM uniform_notifier (1.11.0) warden (1.2.7) rack (>= 1.0) - webmock (3.3.0) + webmock (3.4.2) addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff @@ -765,7 +765,7 @@ DEPENDENCIES tty-prompt (~> 0.17) twitter-text (~> 1.14) tzinfo-data (~> 1.2018) - webmock (~> 3.3) + webmock (~> 3.4) webpacker (~> 3.5) webpush From 1f98eae1cf916a18007a26e1740b0e65aa7ff752 Mon Sep 17 00:00:00 2001 From: aus-social <42644106+aus-social@users.noreply.github.com> Date: Thu, 4 Oct 2018 20:36:53 +1000 Subject: [PATCH 20/28] Lint pass (#8876) --- config/boot.rb | 2 +- config/initializers/omniauth.rb | 3 +-- config/initializers/ostatus.rb | 2 +- config/initializers/twitter_regex.rb | 1 - config/initializers/vapid.rb | 1 - .../20160306172223_create_doorkeeper_tables.rb | 4 ++-- .../20161006213403_rails_settings_migration.rb | 2 +- ...170606113804_change_tag_search_index_to_btree.rb | 1 - ...20170716191202_add_hide_notifications_to_mute.rb | 2 +- db/migrate/20170920032311_fix_reblogs_in_feeds.rb | 2 +- db/migrate/20171028221157_add_reblogs_to_follows.rb | 2 +- db/schema.rb | 1 - spec/controllers/accounts_controller_spec.rb | 4 ++-- spec/controllers/admin/accounts_controller_spec.rb | 1 - .../admin/email_domain_blocks_controller_spec.rb | 4 ++-- spec/controllers/admin/invites_controller_spec.rb | 2 +- .../admin/report_notes_controller_spec.rb | 11 +++++------ .../admin/reported_statuses_controller_spec.rb | 2 +- spec/controllers/api/v1/accounts_controller_spec.rb | 4 ++-- .../favourited_by_accounts_controller_spec.rb | 1 - .../controllers/api/v1/streaming_controller_spec.rb | 3 +-- .../api/v1/timelines/home_controller_spec.rb | 2 +- .../api/v1/timelines/public_controller_spec.rb | 2 +- spec/controllers/api/web/embeds_controller_spec.rb | 2 +- spec/controllers/application_controller_spec.rb | 4 ++-- .../auth/confirmations_controller_spec.rb | 2 +- spec/controllers/invites_controller_spec.rb | 2 +- .../controllers/remote_unfollows_controller_spec.rb | 6 +++--- .../settings/applications_controller_spec.rb | 1 - .../settings/migrations_controller_spec.rb | 2 -- .../confirmations_controller_spec.rb | 2 +- spec/fabricators/account_fabricator.rb | 2 +- spec/fabricators/list_fabricator.rb | 2 +- spec/fabricators/relay_fabricator.rb | 2 +- spec/fabricators/site_upload_fabricator.rb | 1 - spec/lib/feed_manager_spec.rb | 2 +- spec/lib/formatter_spec.rb | 13 ++++++------- spec/lib/language_detector_spec.rb | 2 +- spec/lib/ostatus/atom_serializer_spec.rb | 2 +- spec/lib/request_spec.rb | 2 +- spec/models/account_moderation_note_spec.rb | 1 - spec/models/admin/action_log_spec.rb | 1 - spec/models/backup_spec.rb | 1 - spec/models/conversation_mute_spec.rb | 1 - spec/models/custom_emoji_spec.rb | 2 +- spec/models/custom_filter_spec.rb | 1 - spec/models/list_account_spec.rb | 1 - spec/models/list_spec.rb | 1 - spec/models/media_attachment_spec.rb | 2 +- spec/models/mute_spec.rb | 1 - spec/models/preview_card_spec.rb | 1 - spec/models/remote_follow_spec.rb | 4 ++-- spec/models/web/setting_spec.rb | 1 - .../activitypub/process_collection_service_spec.rb | 4 ++-- spec/services/fetch_atom_service_spec.rb | 2 +- spec/views/stream_entries/show.html.haml_spec.rb | 2 +- 56 files changed, 55 insertions(+), 79 deletions(-) diff --git a/config/boot.rb b/config/boot.rb index 593f575e9a..beb45a5ee2 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -1,6 +1,6 @@ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) -require 'bundler/setup' # Set up gems listed in the Gemfile. +require 'bundler/setup' # Set up gems listed in the Gemfile. require 'bootsnap' # Speed up boot time by caching expensive operations. Bootsnap.setup( diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index 85fb812506..21b58eb5b3 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -38,7 +38,7 @@ Devise.setup do |config| saml_options = options saml_options[:assertion_consumer_service_url] = ENV['SAML_ACS_URL'] if ENV['SAML_ACS_URL'] saml_options[:issuer] = ENV['SAML_ISSUER'] if ENV['SAML_ISSUER'] - saml_options[:idp_sso_target_url] = ENV['SAML_IDP_SSO_TARGET_URL'] if ENV['SAML_IDP_SSO_TARGET_URL'] + saml_options[:idp_sso_target_url] = ENV['SAML_IDP_SSO_TARGET_URL'] if ENV['SAML_IDP_SSO_TARGET_URL'] saml_options[:idp_sso_target_url_runtime_params] = ENV['SAML_IDP_SSO_TARGET_PARAMS'] if ENV['SAML_IDP_SSO_TARGET_PARAMS'] # FIXME: Should be parsable Hash saml_options[:idp_cert] = ENV['SAML_IDP_CERT'] if ENV['SAML_IDP_CERT'] saml_options[:idp_cert_fingerprint] = ENV['SAML_IDP_CERT_FINGERPRINT'] if ENV['SAML_IDP_CERT_FINGERPRINT'] @@ -62,5 +62,4 @@ Devise.setup do |config| saml_options[:uid_attribute] = ENV['SAML_UID_ATTRIBUTE'] if ENV['SAML_UID_ATTRIBUTE'] config.omniauth :saml, saml_options end - end diff --git a/config/initializers/ostatus.rb b/config/initializers/ostatus.rb index 5773b72903..757f1f7355 100644 --- a/config/initializers/ostatus.rb +++ b/config/initializers/ostatus.rb @@ -7,7 +7,7 @@ web_host = ENV.fetch('WEB_DOMAIN') { host } alternate_domains = ENV.fetch('ALTERNATE_DOMAINS') { '' } Rails.application.configure do - https = Rails.env.production? || ENV['LOCAL_HTTPS'] == 'true' + https = Rails.env.production? || ENV['LOCAL_HTTPS'] == 'true' config.x.local_domain = host config.x.web_domain = web_host diff --git a/config/initializers/twitter_regex.rb b/config/initializers/twitter_regex.rb index 76b23f4168..0e8f5bfeb4 100644 --- a/config/initializers/twitter_regex.rb +++ b/config/initializers/twitter_regex.rb @@ -1,6 +1,5 @@ module Twitter class Regex - REGEXEN[:valid_general_url_path_chars] = /[^\p{White_Space}\(\)\?]/iou REGEXEN[:valid_url_path_ending_chars] = /[^\p{White_Space}\(\)\?!\*';:=\,\.\$%\[\]~&\|@]|(?:#{REGEXEN[:valid_url_balanced_parens]})/iou REGEXEN[:valid_url_balanced_parens] = / diff --git a/config/initializers/vapid.rb b/config/initializers/vapid.rb index 618f5a3fbb..7dd870c8b7 100644 --- a/config/initializers/vapid.rb +++ b/config/initializers/vapid.rb @@ -1,7 +1,6 @@ # frozen_string_literal: true Rails.application.configure do - # You can generate the keys using the following command (first is the private key, second is the public one) # You should only generate this once per instance. If you later decide to change it, all push subscription will # be invalidated, requiring the users to access the website again to resubscribe. diff --git a/db/migrate/20160306172223_create_doorkeeper_tables.rb b/db/migrate/20160306172223_create_doorkeeper_tables.rb index 9e173a43f3..462343e888 100644 --- a/db/migrate/20160306172223_create_doorkeeper_tables.rb +++ b/db/migrate/20160306172223_create_doorkeeper_tables.rb @@ -34,12 +34,12 @@ class CreateDoorkeeperTables < ActiveRecord::Migration[4.2] # https://github.com/doorkeeper-gem/doorkeeper/tree/v3.0.0.rc1#custom-access-token-generator # # t.text :token, null: false - t.string :token, null: false + t.string :token, null: false t.string :refresh_token t.integer :expires_in t.datetime :revoked_at - t.datetime :created_at, null: false + t.datetime :created_at, null: false t.string :scopes end diff --git a/db/migrate/20161006213403_rails_settings_migration.rb b/db/migrate/20161006213403_rails_settings_migration.rb index 3b2e637fc7..42875d7cbd 100644 --- a/db/migrate/20161006213403_rails_settings_migration.rb +++ b/db/migrate/20161006213403_rails_settings_migration.rb @@ -7,7 +7,7 @@ end class RailsSettingsMigration < MIGRATION_BASE_CLASS def self.up create_table :settings do |t| - t.string :var, :null => false + t.string :var, :null => false t.text :value t.references :target, :null => false, :polymorphic => true t.timestamps :null => true diff --git a/db/migrate/20170606113804_change_tag_search_index_to_btree.rb b/db/migrate/20170606113804_change_tag_search_index_to_btree.rb index 5248e17202..979df2e744 100644 --- a/db/migrate/20170606113804_change_tag_search_index_to_btree.rb +++ b/db/migrate/20170606113804_change_tag_search_index_to_btree.rb @@ -1,5 +1,4 @@ class ChangeTagSearchIndexToBtree < ActiveRecord::Migration[5.1] - def up remove_index :tags, name: :hashtag_search_index execute 'CREATE INDEX hashtag_search_index ON tags (name text_pattern_ops);' diff --git a/db/migrate/20170716191202_add_hide_notifications_to_mute.rb b/db/migrate/20170716191202_add_hide_notifications_to_mute.rb index 0410938c9b..a498396b75 100644 --- a/db/migrate/20170716191202_add_hide_notifications_to_mute.rb +++ b/db/migrate/20170716191202_add_hide_notifications_to_mute.rb @@ -8,7 +8,7 @@ class AddHideNotificationsToMute < ActiveRecord::Migration[5.1] def up add_column_with_default :mutes, :hide_notifications, :boolean, default: true, allow_null: false end - + def down remove_column :mutes, :hide_notifications end diff --git a/db/migrate/20170920032311_fix_reblogs_in_feeds.rb b/db/migrate/20170920032311_fix_reblogs_in_feeds.rb index 439c5fca08..5654bf6f87 100644 --- a/db/migrate/20170920032311_fix_reblogs_in_feeds.rb +++ b/db/migrate/20170920032311_fix_reblogs_in_feeds.rb @@ -28,7 +28,7 @@ class FixReblogsInFeeds < ActiveRecord::Migration[5.1] -- So, first, we iterate over the user's feed to find any reblogs. local items = redis.call('zrange', timeline_key, 0, -1, 'withscores') - + for i = 1, #items, 2 do local reblogged_id = items[i] local reblogging_id = items[i + 1] diff --git a/db/migrate/20171028221157_add_reblogs_to_follows.rb b/db/migrate/20171028221157_add_reblogs_to_follows.rb index 4b5d5b7ff3..3b2e46ed8a 100644 --- a/db/migrate/20171028221157_add_reblogs_to_follows.rb +++ b/db/migrate/20171028221157_add_reblogs_to_follows.rb @@ -11,7 +11,7 @@ class AddReblogsToFollows < ActiveRecord::Migration[5.1] add_column_with_default :follow_requests, :show_reblogs, :boolean, default: true, allow_null: false end end - + def down remove_column :follows, :show_reblogs remove_column :follow_requests, :show_reblogs diff --git a/db/schema.rb b/db/schema.rb index f3b06f7c0c..577296a6ae 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,6 @@ # It's strongly recommended that you check this file into your version control system. ActiveRecord::Schema.define(version: 2018_08_20_232245) do - # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" diff --git a/spec/controllers/accounts_controller_spec.rb b/spec/controllers/accounts_controller_spec.rb index 18c249c07e..3ba5d8aec2 100644 --- a/spec/controllers/accounts_controller_spec.rb +++ b/spec/controllers/accounts_controller_spec.rb @@ -3,8 +3,8 @@ require 'rails_helper' RSpec.describe AccountsController, type: :controller do render_views - let(:alice) { Fabricate(:account, username: 'alice') } - let(:eve) { Fabricate(:user) } + let(:alice) { Fabricate(:account, username: 'alice') } + let(:eve) { Fabricate(:user) } describe 'GET #show' do let!(:status1) { Status.create!(account: alice, text: 'Hello world') } diff --git a/spec/controllers/admin/accounts_controller_spec.rb b/spec/controllers/admin/accounts_controller_spec.rb index 197e019fed..fa2786c9b1 100644 --- a/spec/controllers/admin/accounts_controller_spec.rb +++ b/spec/controllers/admin/accounts_controller_spec.rb @@ -75,7 +75,6 @@ RSpec.describe Admin::AccountsController, type: :controller do end end - describe 'POST #subscribe' do subject { post :subscribe, params: { id: account.id } } diff --git a/spec/controllers/admin/email_domain_blocks_controller_spec.rb b/spec/controllers/admin/email_domain_blocks_controller_spec.rb index 133d38ff10..52db56f4e8 100644 --- a/spec/controllers/admin/email_domain_blocks_controller_spec.rb +++ b/spec/controllers/admin/email_domain_blocks_controller_spec.rb @@ -40,7 +40,7 @@ RSpec.describe Admin::EmailDomainBlocksController, type: :controller do describe 'POST #create' do it 'blocks the domain when succeeded to save' do - post :create, params: { email_domain_block: { domain: 'example.com'} } + post :create, params: { email_domain_block: { domain: 'example.com' } } expect(flash[:notice]).to eq I18n.t('admin.email_domain_blocks.created_msg') expect(response).to redirect_to(admin_email_domain_blocks_path) @@ -50,7 +50,7 @@ RSpec.describe Admin::EmailDomainBlocksController, type: :controller do describe 'DELETE #destroy' do it 'unblocks the domain' do email_domain_block = Fabricate(:email_domain_block) - delete :destroy, params: { id: email_domain_block.id } + delete :destroy, params: { id: email_domain_block.id } expect(flash[:notice]).to eq I18n.t('admin.email_domain_blocks.destroyed_msg') expect(response).to redirect_to(admin_email_domain_blocks_path) diff --git a/spec/controllers/admin/invites_controller_spec.rb b/spec/controllers/admin/invites_controller_spec.rb index e7d9954118..34b51a6aa7 100644 --- a/spec/controllers/admin/invites_controller_spec.rb +++ b/spec/controllers/admin/invites_controller_spec.rb @@ -24,7 +24,7 @@ describe Admin::InvitesController do subject { post :create, params: { invite: { max_uses: '10', expires_in: 1800 } } } it 'succeeds to create a invite' do - expect{ subject }.to change { Invite.count }.by(1) + expect { subject }.to change { Invite.count }.by(1) expect(subject).to redirect_to admin_invites_path expect(Invite.last).to have_attributes(user_id: user.id, max_uses: 10) end diff --git a/spec/controllers/admin/report_notes_controller_spec.rb b/spec/controllers/admin/report_notes_controller_spec.rb index 2c32303fb3..ec5872c7d2 100644 --- a/spec/controllers/admin/report_notes_controller_spec.rb +++ b/spec/controllers/admin/report_notes_controller_spec.rb @@ -15,7 +15,6 @@ describe Admin::ReportNotesController do let(:report) { Fabricate(:report, action_taken: action_taken, action_taken_by_account_id: account_id) } context 'when parameter is valid' do - context 'when report is unsolved' do let(:action_taken) { false } let(:account_id) { nil } @@ -24,7 +23,7 @@ describe Admin::ReportNotesController do let(:params) { { report_note: { content: 'test content', report_id: report.id }, create_and_resolve: nil } } it 'creates a report note and resolves report' do - expect{ subject }.to change{ ReportNote.count }.by(1) + expect { subject }.to change { ReportNote.count }.by(1) expect(report.reload).to be_action_taken expect(subject).to redirect_to admin_reports_path end @@ -34,7 +33,7 @@ describe Admin::ReportNotesController do let(:params) { { report_note: { content: 'test content', report_id: report.id } } } it 'creates a report note and does not resolve report' do - expect{ subject }.to change{ ReportNote.count }.by(1) + expect { subject }.to change { ReportNote.count }.by(1) expect(report.reload).not_to be_action_taken expect(subject).to redirect_to admin_report_path(report) end @@ -49,7 +48,7 @@ describe Admin::ReportNotesController do let(:params) { { report_note: { content: 'test content', report_id: report.id }, create_and_unresolve: nil } } it 'creates a report note and unresolves report' do - expect{ subject }.to change{ ReportNote.count }.by(1) + expect { subject }.to change { ReportNote.count }.by(1) expect(report.reload).not_to be_action_taken expect(subject).to redirect_to admin_report_path(report) end @@ -59,7 +58,7 @@ describe Admin::ReportNotesController do let(:params) { { report_note: { content: 'test content', report_id: report.id } } } it 'creates a report note and does not unresolve report' do - expect{ subject }.to change{ ReportNote.count }.by(1) + expect { subject }.to change { ReportNote.count }.by(1) expect(report.reload).to be_action_taken expect(subject).to redirect_to admin_report_path(report) end @@ -84,7 +83,7 @@ describe Admin::ReportNotesController do let!(:report_note) { Fabricate(:report_note) } it 'deletes note' do - expect{ subject }.to change{ ReportNote.count }.by(-1) + expect { subject }.to change { ReportNote.count }.by(-1) expect(subject).to redirect_to admin_report_path(report_note.report) end end diff --git a/spec/controllers/admin/reported_statuses_controller_spec.rb b/spec/controllers/admin/reported_statuses_controller_spec.rb index 7adbf36b9c..c358506d6d 100644 --- a/spec/controllers/admin/reported_statuses_controller_spec.rb +++ b/spec/controllers/admin/reported_statuses_controller_spec.rb @@ -13,7 +13,7 @@ describe Admin::ReportedStatusesController do describe 'POST #create' do subject do - -> { post :create, params: { :report_id => report, action => '', :form_status_batch => { status_ids: status_ids } } } + -> { post :create, params: { :report_id => report, action => '', :form_status_batch => { status_ids: status_ids } } } end let(:action) { 'nsfw_on' } diff --git a/spec/controllers/api/v1/accounts_controller_spec.rb b/spec/controllers/api/v1/accounts_controller_spec.rb index 3e54e88a5b..c506fb5f01 100644 --- a/spec/controllers/api/v1/accounts_controller_spec.rb +++ b/spec/controllers/api/v1/accounts_controller_spec.rb @@ -154,7 +154,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do before do user.account.follow!(other_account) - post :mute, params: {id: other_account.id } + post :mute, params: { id: other_account.id } end it 'returns http success' do @@ -182,7 +182,7 @@ RSpec.describe Api::V1::AccountsController, type: :controller do before do user.account.follow!(other_account) - post :mute, params: {id: other_account.id, notifications: false } + post :mute, params: { id: other_account.id, notifications: false } end it 'returns http success' do diff --git a/spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb b/spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb index 23b5d7de92..40f75c700f 100644 --- a/spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb +++ b/spec/controllers/api/v1/statuses/favourited_by_accounts_controller_spec.rb @@ -25,7 +25,6 @@ RSpec.describe Api::V1::Statuses::FavouritedByAccountsController, type: :control expect(response.headers['Link'].links.size).to eq(2) end end - end context 'without an oauth token' do diff --git a/spec/controllers/api/v1/streaming_controller_spec.rb b/spec/controllers/api/v1/streaming_controller_spec.rb index daf2807e7f..4ab409a541 100644 --- a/spec/controllers/api/v1/streaming_controller_spec.rb +++ b/spec/controllers/api/v1/streaming_controller_spec.rb @@ -31,7 +31,7 @@ describe Api::V1::StreamingController do describe 'GET #index' do it 'redirects to streaming host' do - get :index, params: {access_token: 'deadbeef', stream: 'public'} + get :index, params: { access_token: 'deadbeef', stream: 'public' } expect(response).to have_http_status(301) request_uri = URI.parse(request.url) redirect_to_uri = URI.parse(response.location) @@ -42,5 +42,4 @@ describe Api::V1::StreamingController do end end end - end diff --git a/spec/controllers/api/v1/timelines/home_controller_spec.rb b/spec/controllers/api/v1/timelines/home_controller_spec.rb index a667c33fad..63d624c355 100644 --- a/spec/controllers/api/v1/timelines/home_controller_spec.rb +++ b/spec/controllers/api/v1/timelines/home_controller_spec.rb @@ -5,7 +5,7 @@ require 'rails_helper' describe Api::V1::Timelines::HomeController do render_views - let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice'), current_sign_in_at: 1.day.ago) } + let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice'), current_sign_in_at: 1.day.ago) } before do allow(controller).to receive(:doorkeeper_token) { token } diff --git a/spec/controllers/api/v1/timelines/public_controller_spec.rb b/spec/controllers/api/v1/timelines/public_controller_spec.rb index 68d87bbcbd..a0f778cdce 100644 --- a/spec/controllers/api/v1/timelines/public_controller_spec.rb +++ b/spec/controllers/api/v1/timelines/public_controller_spec.rb @@ -5,7 +5,7 @@ require 'rails_helper' describe Api::V1::Timelines::PublicController do render_views - let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) } + let(:user) { Fabricate(:user, account: Fabricate(:account, username: 'alice')) } before do allow(controller).to receive(:doorkeeper_token) { token } diff --git a/spec/controllers/api/web/embeds_controller_spec.rb b/spec/controllers/api/web/embeds_controller_spec.rb index 6b7297189a..a8fc1718f6 100644 --- a/spec/controllers/api/web/embeds_controller_spec.rb +++ b/spec/controllers/api/web/embeds_controller_spec.rb @@ -14,7 +14,7 @@ describe Api::Web::EmbedsController do context 'when successfully finds status' do let(:status) { Fabricate(:status) } - let(:url) { "http://#{ Rails.configuration.x.web_domain }/@#{status.account.username}/#{status.id}" } + let(:url) { "http://#{Rails.configuration.x.web_domain}/@#{status.account.username}/#{status.id}" } it 'returns a right response' do expect(response).to have_http_status :ok diff --git a/spec/controllers/application_controller_spec.rb b/spec/controllers/application_controller_spec.rb index d158625e63..33cc710871 100644 --- a/spec/controllers/application_controller_spec.rb +++ b/spec/controllers/application_controller_spec.rb @@ -94,7 +94,7 @@ describe ApplicationController, type: :controller do describe 'helper_method :current_theme' do it 'returns "default" when theme wasn\'t changed in admin settings' do - allow(Setting).to receive(:default_settings).and_return({'theme' => 'default'}) + allow(Setting).to receive(:default_settings).and_return({ 'theme' => 'default' }) expect(controller.view_context.current_theme).to eq 'default' end @@ -197,7 +197,7 @@ describe ApplicationController, type: :controller do describe 'raise_not_found' do it 'raises error' do controller.params[:unmatched_route] = 'unmatched' - expect{ controller.raise_not_found }.to raise_error(ActionController::RoutingError, 'No route matches unmatched') + expect { controller.raise_not_found }.to raise_error(ActionController::RoutingError, 'No route matches unmatched') end end diff --git a/spec/controllers/auth/confirmations_controller_spec.rb b/spec/controllers/auth/confirmations_controller_spec.rb index 35eed4f513..e9a471fc5a 100644 --- a/spec/controllers/auth/confirmations_controller_spec.rb +++ b/spec/controllers/auth/confirmations_controller_spec.rb @@ -67,7 +67,7 @@ describe Auth::ConfirmationsController, type: :controller do end describe 'PATCH #finish_signup' do - subject { patch :finish_signup, params: { user: { email: email }} } + subject { patch :finish_signup, params: { user: { email: email } } } let(:user) { Fabricate(:user) } before do diff --git a/spec/controllers/invites_controller_spec.rb b/spec/controllers/invites_controller_spec.rb index 9f5ab67c30..76e617e6b6 100644 --- a/spec/controllers/invites_controller_spec.rb +++ b/spec/controllers/invites_controller_spec.rb @@ -43,7 +43,7 @@ describe InvitesController do let(:user) { Fabricate(:user, moderator: false, admin: true) } it 'succeeds to create a invite' do - expect{ subject }.to change { Invite.count }.by(1) + expect { subject }.to change { Invite.count }.by(1) expect(subject).to redirect_to invites_path expect(Invite.last).to have_attributes(user_id: user.id, max_uses: 10) end diff --git a/spec/controllers/remote_unfollows_controller_spec.rb b/spec/controllers/remote_unfollows_controller_spec.rb index 223ed64af6..a1a55ede0b 100644 --- a/spec/controllers/remote_unfollows_controller_spec.rb +++ b/spec/controllers/remote_unfollows_controller_spec.rb @@ -14,11 +14,11 @@ describe RemoteUnfollowsController do before do sign_in current_user current_account.follow!(remote_account) - stub_request(:post, 'http://example.com/inbox'){ { status: 200 } } + stub_request(:post, 'http://example.com/inbox') { { status: 200 } } end context 'when successfully unfollow remote account' do - let(:acct) {"acct:#{ remote_account.username }@#{ remote_account.domain }"} + let(:acct) { "acct:#{remote_account.username}@#{remote_account.domain}" } it do is_expected.to render_template :success @@ -27,7 +27,7 @@ describe RemoteUnfollowsController do end context 'when fails to unfollow remote account' do - let(:acct) {"acct:#{ remote_account.username + '_test' }@#{ remote_account.domain }"} + let(:acct) { "acct:#{remote_account.username + '_test'}@#{remote_account.domain}" } it do is_expected.to render_template :error diff --git a/spec/controllers/settings/applications_controller_spec.rb b/spec/controllers/settings/applications_controller_spec.rb index f87107695f..fd4b100717 100644 --- a/spec/controllers/settings/applications_controller_spec.rb +++ b/spec/controllers/settings/applications_controller_spec.rb @@ -21,7 +21,6 @@ describe Settings::ApplicationsController do end end - describe 'GET #show' do it 'returns http success' do get :show, params: { id: app.id } diff --git a/spec/controllers/settings/migrations_controller_spec.rb b/spec/controllers/settings/migrations_controller_spec.rb index a621bcf1ce..4d814a45e2 100644 --- a/spec/controllers/settings/migrations_controller_spec.rb +++ b/spec/controllers/settings/migrations_controller_spec.rb @@ -10,7 +10,6 @@ describe Settings::MigrationsController do end describe 'GET #show' do - context 'when user is not sign in' do subject { get :show } @@ -45,7 +44,6 @@ describe Settings::MigrationsController do end describe 'PUT #update' do - context 'when user is not sign in' do subject { put :update } diff --git a/spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb b/spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb index 7612bf90ec..478f245855 100644 --- a/spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb +++ b/spec/controllers/settings/two_factor_authentication/confirmations_controller_spec.rb @@ -50,7 +50,7 @@ describe Settings::TwoFactorAuthentication::ConfirmationsController do describe 'when form_two_factor_confirmation parameter is not provided' do it 'raises ActionController::ParameterMissing' do - expect { post :create, params: { } }.to raise_error(ActionController::ParameterMissing) + expect { post :create, params: {} }.to raise_error(ActionController::ParameterMissing) end end diff --git a/spec/fabricators/account_fabricator.rb b/spec/fabricators/account_fabricator.rb index 7aa983f821..e092e6c099 100644 --- a/spec/fabricators/account_fabricator.rb +++ b/spec/fabricators/account_fabricator.rb @@ -6,5 +6,5 @@ Fabricator(:account) do username { sequence(:username) { |i| "#{Faker::Internet.user_name(nil, %w(_))}#{i}" } } last_webfingered_at { Time.now.utc } public_key { public_key } - private_key { private_key} + private_key { private_key } end diff --git a/spec/fabricators/list_fabricator.rb b/spec/fabricators/list_fabricator.rb index 2a61b317b8..c3db690fa4 100644 --- a/spec/fabricators/list_fabricator.rb +++ b/spec/fabricators/list_fabricator.rb @@ -1,4 +1,4 @@ Fabricator(:list) do account - title "MyString" + title "MyString" end diff --git a/spec/fabricators/relay_fabricator.rb b/spec/fabricators/relay_fabricator.rb index 3f8726f6b3..488913f772 100644 --- a/spec/fabricators/relay_fabricator.rb +++ b/spec/fabricators/relay_fabricator.rb @@ -1,4 +1,4 @@ Fabricator(:relay) do inbox_url "https://example.com/inbox" - state :idle + state :idle end diff --git a/spec/fabricators/site_upload_fabricator.rb b/spec/fabricators/site_upload_fabricator.rb index 8f4e43ac9b..4a171486f6 100644 --- a/spec/fabricators/site_upload_fabricator.rb +++ b/spec/fabricators/site_upload_fabricator.rb @@ -1,3 +1,2 @@ Fabricator(:site_upload) do - end diff --git a/spec/lib/feed_manager_spec.rb b/spec/lib/feed_manager_spec.rb index 7535e144d7..64e109aecd 100644 --- a/spec/lib/feed_manager_spec.rb +++ b/spec/lib/feed_manager_spec.rb @@ -393,7 +393,7 @@ RSpec.describe FeedManager do end it 'sends push updates' do - status = Fabricate(:status) + status = Fabricate(:status) FeedManager.instance.push_to_home(receiver, status) diff --git a/spec/lib/formatter_spec.rb b/spec/lib/formatter_spec.rb index 0c2248cae5..ec4a6493df 100644 --- a/spec/lib/formatter_spec.rb +++ b/spec/lib/formatter_spec.rb @@ -170,12 +170,11 @@ RSpec.describe Formatter do end end - describe '#format_spoiler' do subject { Formatter.instance.format_spoiler(status) } context 'given a post containing plain text' do - let(:status) { Fabricate(:status, text: 'text', spoiler_text: 'Secret!', uri: nil) } + let(:status) { Fabricate(:status, text: 'text', spoiler_text: 'Secret!', uri: nil) } it 'Returns the spoiler text' do is_expected.to eq 'Secret!' @@ -184,7 +183,7 @@ RSpec.describe Formatter do context 'given a post with an emoji shortcode at the start' do let!(:emoji) { Fabricate(:custom_emoji) } - let(:status) { Fabricate(:status, text: 'text', spoiler_text: ':coolcat: Secret!', uri: nil) } + let(:status) { Fabricate(:status, text: 'text', spoiler_text: ':coolcat: Secret!', uri: nil) } let(:text) { ':coolcat: Beep boop' } it 'converts the shortcode to an image tag' do @@ -207,7 +206,7 @@ RSpec.describe Formatter do end context 'given a post containing plain text' do - let(:status) { Fabricate(:status, text: 'text', uri: nil) } + let(:status) { Fabricate(:status, text: 'text', uri: nil) } it 'paragraphizes the text' do is_expected.to eq '

text

' @@ -215,7 +214,7 @@ RSpec.describe Formatter do end context 'given a post containing line feeds' do - let(:status) { Fabricate(:status, text: "line\nfeed", uri: nil) } + let(:status) { Fabricate(:status, text: "line\nfeed", uri: nil) } it 'removes line feeds' do is_expected.not_to include "\n" @@ -367,7 +366,7 @@ RSpec.describe Formatter do subject { Formatter.instance.plaintext(status) } context 'given a post with local status' do - let(:status) { Fabricate(:status, text: '

a text by a nerd who uses an HTML tag in text

', uri: nil) } + let(:status) { Fabricate(:status, text: '

a text by a nerd who uses an HTML tag in text

', uri: nil) } it 'returns the raw text' do is_expected.to eq '

a text by a nerd who uses an HTML tag in text

' @@ -375,7 +374,7 @@ RSpec.describe Formatter do end context 'given a post with remote status' do - let(:status) { Fabricate(:status, account: remote_account, text: '') } + let(:status) { Fabricate(:status, account: remote_account, text: '') } it 'returns tag-stripped text' do is_expected.to eq '' diff --git a/spec/lib/language_detector_spec.rb b/spec/lib/language_detector_spec.rb index d00d2a0e61..cdc51a656c 100644 --- a/spec/lib/language_detector_spec.rb +++ b/spec/lib/language_detector_spec.rb @@ -90,7 +90,7 @@ describe LanguageDetector do end it 'uses nil when account is present but has no locale' do - result = described_class.instance.detect('', account_without_user_locale) + result = described_class.instance.detect('', account_without_user_locale) expect(result).to eq nil end diff --git a/spec/lib/ostatus/atom_serializer_spec.rb b/spec/lib/ostatus/atom_serializer_spec.rb index 0bd22880e0..3bc4b7efb7 100644 --- a/spec/lib/ostatus/atom_serializer_spec.rb +++ b/spec/lib/ostatus/atom_serializer_spec.rb @@ -880,7 +880,7 @@ RSpec.describe OStatus::AtomSerializer do ProcessInteractionService.new.call(envelope, block.target_account) - expect{ block.reload }.to raise_error ActiveRecord::RecordNotFound + expect { block.reload }.to raise_error ActiveRecord::RecordNotFound end end diff --git a/spec/lib/request_spec.rb b/spec/lib/request_spec.rb index 939ac006ae..8cc5d90ce3 100644 --- a/spec/lib/request_spec.rb +++ b/spec/lib/request_spec.rb @@ -84,7 +84,7 @@ describe Request do allow(Addrinfo).to receive(:foreach).with('example.com', nil, nil, :SOCK_STREAM) .and_yield(Addrinfo.new(["AF_INET", 0, "example.com", "0.0.0.0"], :PF_INET, :SOCK_STREAM)) .and_yield(Addrinfo.new(["AF_INET6", 0, "example.com", "2001:db8::face"], :PF_INET6, :SOCK_STREAM)) - expect{ subject.perform }.to raise_error Mastodon::ValidationError + expect { subject.perform }.to raise_error Mastodon::ValidationError end end end diff --git a/spec/models/account_moderation_note_spec.rb b/spec/models/account_moderation_note_spec.rb index 16983b2e36..69bd5500a5 100644 --- a/spec/models/account_moderation_note_spec.rb +++ b/spec/models/account_moderation_note_spec.rb @@ -1,5 +1,4 @@ require 'rails_helper' RSpec.describe AccountModerationNote, type: :model do - end diff --git a/spec/models/admin/action_log_spec.rb b/spec/models/admin/action_log_spec.rb index 59206a36b3..81d7e1be3a 100644 --- a/spec/models/admin/action_log_spec.rb +++ b/spec/models/admin/action_log_spec.rb @@ -1,5 +1,4 @@ require 'rails_helper' RSpec.describe Admin::ActionLog, type: :model do - end diff --git a/spec/models/backup_spec.rb b/spec/models/backup_spec.rb index fabcdc845a..45230986d7 100644 --- a/spec/models/backup_spec.rb +++ b/spec/models/backup_spec.rb @@ -1,5 +1,4 @@ require 'rails_helper' RSpec.describe Backup, type: :model do - end diff --git a/spec/models/conversation_mute_spec.rb b/spec/models/conversation_mute_spec.rb index b602e80c19..3fc2915d4f 100644 --- a/spec/models/conversation_mute_spec.rb +++ b/spec/models/conversation_mute_spec.rb @@ -1,5 +1,4 @@ require 'rails_helper' RSpec.describe ConversationMute, type: :model do - end diff --git a/spec/models/custom_emoji_spec.rb b/spec/models/custom_emoji_spec.rb index 87367df500..320a258d34 100644 --- a/spec/models/custom_emoji_spec.rb +++ b/spec/models/custom_emoji_spec.rb @@ -4,7 +4,7 @@ RSpec.describe CustomEmoji, type: :model do describe '#search' do let(:custom_emoji) { Fabricate(:custom_emoji, shortcode: shortcode) } - subject { described_class.search(search_term) } + subject { described_class.search(search_term) } context 'shortcode is exact' do let(:shortcode) { 'blobpats' } diff --git a/spec/models/custom_filter_spec.rb b/spec/models/custom_filter_spec.rb index 1024542e7b..3943dd5f1a 100644 --- a/spec/models/custom_filter_spec.rb +++ b/spec/models/custom_filter_spec.rb @@ -1,5 +1,4 @@ require 'rails_helper' RSpec.describe CustomFilter, type: :model do - end diff --git a/spec/models/list_account_spec.rb b/spec/models/list_account_spec.rb index a132e09b0e..a0cf02efe2 100644 --- a/spec/models/list_account_spec.rb +++ b/spec/models/list_account_spec.rb @@ -1,5 +1,4 @@ require 'rails_helper' RSpec.describe ListAccount, type: :model do - end diff --git a/spec/models/list_spec.rb b/spec/models/list_spec.rb index c302482b43..b780bb1de0 100644 --- a/spec/models/list_spec.rb +++ b/spec/models/list_spec.rb @@ -1,5 +1,4 @@ require 'rails_helper' RSpec.describe List, type: :model do - end diff --git a/spec/models/media_attachment_spec.rb b/spec/models/media_attachment_spec.rb index cb1cee5186..266cd49203 100644 --- a/spec/models/media_attachment_spec.rb +++ b/spec/models/media_attachment_spec.rb @@ -131,7 +131,7 @@ RSpec.describe MediaAttachment, type: :model do expect(media.file.meta["original"]["aspect"]).to eq 1.5 expect(media.file.meta["small"]["width"]).to eq 490 expect(media.file.meta["small"]["height"]).to eq 327 - expect(media.file.meta["small"]["aspect"]).to eq 490.0/327 + expect(media.file.meta["small"]["aspect"]).to eq 490.0 / 327 end end diff --git a/spec/models/mute_spec.rb b/spec/models/mute_spec.rb index 83ba793b2b..38a87bdf4a 100644 --- a/spec/models/mute_spec.rb +++ b/spec/models/mute_spec.rb @@ -1,5 +1,4 @@ require 'rails_helper' RSpec.describe Mute, type: :model do - end diff --git a/spec/models/preview_card_spec.rb b/spec/models/preview_card_spec.rb index 14ef23923c..45233d1d4f 100644 --- a/spec/models/preview_card_spec.rb +++ b/spec/models/preview_card_spec.rb @@ -1,5 +1,4 @@ require 'rails_helper' RSpec.describe PreviewCard, type: :model do - end diff --git a/spec/models/remote_follow_spec.rb b/spec/models/remote_follow_spec.rb index 72c580f9f1..ed2667b28a 100644 --- a/spec/models/remote_follow_spec.rb +++ b/spec/models/remote_follow_spec.rb @@ -34,7 +34,7 @@ RSpec.describe RemoteFollow do subject { remote_follow.valid? } context 'attrs with acct' do - let(:attrs) { { acct: 'gargron@quitter.no' }} + let(:attrs) { { acct: 'gargron@quitter.no' } } it do is_expected.to be true @@ -42,7 +42,7 @@ RSpec.describe RemoteFollow do end context 'attrs without acct' do - let(:attrs) { { } } + let(:attrs) { {} } it do is_expected.to be false diff --git a/spec/models/web/setting_spec.rb b/spec/models/web/setting_spec.rb index 90e7695aa7..6657d4030f 100644 --- a/spec/models/web/setting_spec.rb +++ b/spec/models/web/setting_spec.rb @@ -1,5 +1,4 @@ require 'rails_helper' RSpec.describe Web::Setting, type: :model do - end diff --git a/spec/services/activitypub/process_collection_service_spec.rb b/spec/services/activitypub/process_collection_service_spec.rb index e46f0ae450..bbe97d2112 100644 --- a/spec/services/activitypub/process_collection_service_spec.rb +++ b/spec/services/activitypub/process_collection_service_spec.rb @@ -34,7 +34,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do end it 'processes payload with actor if valid signature exists' do - payload['signature'] = {'type' => 'RsaSignature2017'} + payload['signature'] = { 'type' => 'RsaSignature2017' } expect_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_account!).and_return(actor) expect(ActivityPub::Activity).to receive(:factory).with(instance_of(Hash), actor, instance_of(Hash)) @@ -43,7 +43,7 @@ RSpec.describe ActivityPub::ProcessCollectionService, type: :service do end it 'does not process payload if invalid signature exists' do - payload['signature'] = {'type' => 'RsaSignature2017'} + payload['signature'] = { 'type' => 'RsaSignature2017' } expect_any_instance_of(ActivityPub::LinkedDataSignature).to receive(:verify_account!).and_return(nil) expect(ActivityPub::Activity).not_to receive(:factory) diff --git a/spec/services/fetch_atom_service_spec.rb b/spec/services/fetch_atom_service_spec.rb index bb233c12d1..30e5b0935a 100644 --- a/spec/services/fetch_atom_service_spec.rb +++ b/spec/services/fetch_atom_service_spec.rb @@ -57,7 +57,7 @@ RSpec.describe FetchAtomService, type: :service do context 'content type is application/atom+xml' do let(:content_type) { 'application/atom+xml' } - it { is_expected.to eq [url, {:prefetched_body=>""}, :ostatus] } + it { is_expected.to eq [url, { :prefetched_body => "" }, :ostatus] } end context 'content_type is json' do diff --git a/spec/views/stream_entries/show.html.haml_spec.rb b/spec/views/stream_entries/show.html.haml_spec.rb index d06bb7abb5..e084195969 100644 --- a/spec/views/stream_entries/show.html.haml_spec.rb +++ b/spec/views/stream_entries/show.html.haml_spec.rb @@ -50,7 +50,7 @@ describe 'stream_entries/show.html.haml', without_verify_partial_doubles: true d assign(:account, alice) assign(:type, reply.stream_entry.activity_type.downcase) assign(:ancestors, reply.stream_entry.activity.ancestors(1, bob) ) - assign(:descendant_threads, [{ statuses: reply.stream_entry.activity.descendants(1)}]) + assign(:descendant_threads, [{ statuses: reply.stream_entry.activity.descendants(1) }]) render From da8abef56d5af3b3c706c939fc9f1595d6c215f2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Thu, 4 Oct 2018 15:35:18 +0200 Subject: [PATCH 21/28] Bump fog-openstack, rspec-rails and fog-core (#8877) Bumps [fog-openstack](https://github.com/fog/fog-openstack), [rspec-rails](https://github.com/rspec/rspec-rails) and [fog-core](https://github.com/fog/fog-core). These dependencies needed to be updated together. Updates `fog-openstack` from 0.3.6 to 1.0.3 - [Release notes](https://github.com/fog/fog-openstack/releases) - [Changelog](https://github.com/fog/fog-openstack/blob/master/CHANGELOG.md) - [Commits](https://github.com/fog/fog-openstack/compare/v0.3.6...v1.0.3) Updates `rspec-rails` from 3.7.2 to 3.8.0 - [Release notes](https://github.com/rspec/rspec-rails/releases) - [Changelog](https://github.com/rspec/rspec-rails/blob/master/Changelog.md) - [Commits](https://github.com/rspec/rspec-rails/compare/v3.7.2...v3.8.0) Updates `fog-core` from 1.45.0 to 2.1.2 - [Release notes](https://github.com/fog/fog-core/releases) - [Changelog](https://github.com/fog/fog-core/blob/master/changelog.md) - [Commits](https://github.com/fog/fog-core/compare/v1.45.0...v2.1.2) Signed-off-by: dependabot[bot] --- Gemfile | 6 +++--- Gemfile.lock | 37 +++++++++++++++++++------------------ 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/Gemfile b/Gemfile index 8b2f3d33d3..b9b6b4c243 100644 --- a/Gemfile +++ b/Gemfile @@ -16,8 +16,8 @@ gem 'pghero', '~> 2.2' gem 'dotenv-rails', '~> 2.2', '< 2.3' gem 'aws-sdk-s3', '~> 1.20', require: false -gem 'fog-core', '~> 1.45' -gem 'fog-openstack', '~> 0.3', require: false +gem 'fog-core', '~> 2.1' +gem 'fog-openstack', '~> 1.0', require: false gem 'paperclip', '~> 6.0' gem 'paperclip-av-transcoder', '~> 0.6' gem 'streamio-ffmpeg', '~> 3.0' @@ -100,7 +100,7 @@ group :development, :test do gem 'i18n-tasks', '~> 0.9', require: false gem 'pry-byebug', '~> 3.6' gem 'pry-rails', '~> 0.3' - gem 'rspec-rails', '~> 3.7' + gem 'rspec-rails', '~> 3.8' end group :production, :test do diff --git a/Gemfile.lock b/Gemfile.lock index 0f00a8003f..4c7bc0e66d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -215,15 +215,16 @@ GEM fast_blank (1.0.0) fastimage (2.1.4) ffi (1.9.25) - fog-core (1.45.0) + fog-core (2.1.2) builder excon (~> 0.58) formatador (~> 0.2) + mime-types fog-json (1.2.0) fog-core multi_json (~> 1.10) - fog-openstack (0.3.6) - fog-core (>= 1.45, <= 2.1.0) + fog-openstack (1.0.3) + fog-core (~> 2.1) fog-json (>= 1.0) ipaddress (>= 0.8) formatador (0.2.5) @@ -503,26 +504,26 @@ GEM rpam2 (4.0.2) rqrcode (0.10.1) chunky_png (~> 1.0) - rspec-core (3.7.1) - rspec-support (~> 3.7.0) - rspec-expectations (3.7.0) + rspec-core (3.8.0) + rspec-support (~> 3.8.0) + rspec-expectations (3.8.1) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.7.0) - rspec-mocks (3.7.0) + rspec-support (~> 3.8.0) + rspec-mocks (3.8.0) diff-lcs (>= 1.2.0, < 2.0) - rspec-support (~> 3.7.0) - rspec-rails (3.7.2) + rspec-support (~> 3.8.0) + rspec-rails (3.8.0) actionpack (>= 3.0) activesupport (>= 3.0) railties (>= 3.0) - rspec-core (~> 3.7.0) - rspec-expectations (~> 3.7.0) - rspec-mocks (~> 3.7.0) - rspec-support (~> 3.7.0) + rspec-core (~> 3.8.0) + rspec-expectations (~> 3.8.0) + rspec-mocks (~> 3.8.0) + rspec-support (~> 3.8.0) rspec-sidekiq (3.0.3) rspec-core (~> 3.0, >= 3.0.0) sidekiq (>= 2.4.0) - rspec-support (3.7.1) + rspec-support (3.8.0) rubocop (0.59.2) jaro_winkler (~> 1.5.1) parallel (~> 1.10) @@ -684,8 +685,8 @@ DEPENDENCIES faker (~> 1.8) fast_blank (~> 1.0) fastimage - fog-core (~> 1.45) - fog-openstack (~> 0.3) + fog-core (~> 2.1) + fog-openstack (~> 1.0) fuubar (~> 2.3) goldfinger (~> 2.1) hamlit-rails (~> 0.2) @@ -742,7 +743,7 @@ DEPENDENCIES redis-namespace (~> 1.5) redis-rails (~> 5.0) rqrcode (~> 0.10) - rspec-rails (~> 3.7) + rspec-rails (~> 3.8) rspec-sidekiq (~> 3.0) rubocop (~> 0.59) ruby-progressbar (~> 1.4) From 49b182cd5134f45ca825ae62d869bbb28d3c9266 Mon Sep 17 00:00:00 2001 From: Isatis <515462+Reverite@users.noreply.github.com> Date: Thu, 4 Oct 2018 06:37:31 -0700 Subject: [PATCH 22/28] Dockerfile: update Node to 8.12.0 and put Ruby on Alpine 3.7 for build system memory help (#8842) --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index b85d050476..6a1e8776cc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ -FROM node:8.11.3-alpine as node -FROM ruby:2.4.4-alpine3.6 +FROM node:8.12.0-alpine as node +FROM ruby:2.4.4-alpine3.7 LABEL maintainer="https://github.com/tootsuite/mastodon" \ description="Your self-hosted, globally interconnected microblogging community" From 7fe137d2f7792ed735be11eaca6d87fbc114043a Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 4 Oct 2018 15:47:03 +0200 Subject: [PATCH 23/28] Fix link verification for remote accounts (#8868) --- app/models/account.rb | 26 +++- app/serializers/rest/account_serializer.rb | 6 +- app/services/verify_link_service.rb | 2 +- spec/services/verify_link_service_spec.rb | 157 ++++++++++++--------- 4 files changed, 117 insertions(+), 74 deletions(-) diff --git a/app/models/account.rb b/app/models/account.rb index d8e5c73405..44963f3e63 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -312,8 +312,8 @@ class Account < ApplicationRecord def initialize(account, attributes) @account = account @attributes = attributes - @name = attributes['name'].strip[0, 255] - @value = attributes['value'].strip[0, 255] + @name = attributes['name'].strip[0, string_limit] + @value = attributes['value'].strip[0, string_limit] @verified_at = attributes['verified_at']&.to_datetime @errors = {} end @@ -322,8 +322,18 @@ class Account < ApplicationRecord verified_at.present? end + def value_for_verification + @value_for_verification ||= begin + if account.local? + value + else + ActionController::Base.helpers.strip_tags(value) + end + end + end + def verifiable? - value.present? && value.start_with?('http://', 'https://') + value_for_verification.present? && value_for_verification.start_with?('http://', 'https://') end def mark_verified! @@ -334,6 +344,16 @@ class Account < ApplicationRecord def to_h { name: @name, value: @value, verified_at: @verified_at } end + + private + + def string_limit + if account.local? + 255 + else + 2047 + end + end end class << self diff --git a/app/serializers/rest/account_serializer.rb b/app/serializers/rest/account_serializer.rb index d84b48afb1..12adc971cb 100644 --- a/app/serializers/rest/account_serializer.rb +++ b/app/serializers/rest/account_serializer.rb @@ -11,11 +11,7 @@ class REST::AccountSerializer < ActiveModel::Serializer has_many :emojis, serializer: REST::CustomEmojiSerializer class FieldSerializer < ActiveModel::Serializer - attributes :name, :value - - attribute :verified_at, if: :verifiable? - - delegate :verifiable?, to: :object + attributes :name, :value, :verified_at def value Formatter.instance.format_field(object.account, object.value) diff --git a/app/services/verify_link_service.rb b/app/services/verify_link_service.rb index 7d53bc255a..3453b54c5f 100644 --- a/app/services/verify_link_service.rb +++ b/app/services/verify_link_service.rb @@ -3,7 +3,7 @@ class VerifyLinkService < BaseService def call(field) @link_back = ActivityPub::TagManager.instance.url_for(field.account) - @url = field.value + @url = field.value_for_verification perform_request! diff --git a/spec/services/verify_link_service_spec.rb b/spec/services/verify_link_service_spec.rb index 9b04d61364..2edcdb75f1 100644 --- a/spec/services/verify_link_service_spec.rb +++ b/spec/services/verify_link_service_spec.rb @@ -3,80 +3,107 @@ require 'rails_helper' RSpec.describe VerifyLinkService, type: :service do subject { described_class.new } - let(:account) { Fabricate(:account, username: 'alice') } - let(:field) { Account::Field.new(account, 'name' => 'Website', 'value' => 'http://example.com') } + context 'given a local account' do + let(:account) { Fabricate(:account, username: 'alice') } + let(:field) { Account::Field.new(account, 'name' => 'Website', 'value' => 'http://example.com') } - before do - stub_request(:head, 'https://redirect.me/abc').to_return(status: 301, headers: { 'Location' => ActivityPub::TagManager.instance.url_for(account) }) - stub_request(:get, 'http://example.com').to_return(status: 200, body: html) - subject.call(field) - end - - context 'when a link contains an back' do - let(:html) do - <<-HTML - - - Follow me on Mastodon - - HTML + before do + stub_request(:head, 'https://redirect.me/abc').to_return(status: 301, headers: { 'Location' => ActivityPub::TagManager.instance.url_for(account) }) + stub_request(:get, 'http://example.com').to_return(status: 200, body: html) + subject.call(field) end - it 'marks the field as verified' do - expect(field.verified?).to be true + context 'when a link contains an back' do + let(:html) do + <<-HTML + + + Follow me on Mastodon + + HTML + end + + it 'marks the field as verified' do + expect(field.verified?).to be true + end + end + + context 'when a link contains an back' do + let(:html) do + <<-HTML + + + Follow me on Mastodon + + HTML + end + + it 'marks the field as verified' do + expect(field.verified?).to be true + end + end + + context 'when a link contains a back' do + let(:html) do + <<-HTML + + + + + HTML + end + + it 'marks the field as verified' do + expect(field.verified?).to be true + end + end + + context 'when a link goes through a redirect back' do + let(:html) do + <<-HTML + + + + + HTML + end + + it 'marks the field as verified' do + expect(field.verified?).to be true + end + end + + context 'when a link does not contain a link back' do + let(:html) { '' } + + it 'marks the field as verified' do + expect(field.verified?).to be false + end end end - context 'when a link contains an back' do - let(:html) do - <<-HTML - - - Follow me on Mastodon - - HTML + context 'given a remote account' do + let(:account) { Fabricate(:account, username: 'alice', domain: 'example.com', url: 'https://profile.example.com/alice') } + let(:field) { Account::Field.new(account, 'name' => 'Website', 'value' => 'example.com') } + + before do + stub_request(:get, 'http://example.com').to_return(status: 200, body: html) + subject.call(field) end - it 'marks the field as verified' do - expect(field.verified?).to be true - end - end + context 'when a link contains an back' do + let(:html) do + <<-HTML + + + Follow me on Mastodon + + HTML + end - context 'when a link contains a back' do - let(:html) do - <<-HTML - - - - - HTML - end - - it 'marks the field as verified' do - expect(field.verified?).to be true - end - end - - context 'when a link goes through a redirect back' do - let(:html) do - <<-HTML - - - - - HTML - end - - it 'marks the field as verified' do - expect(field.verified?).to be true - end - end - - context 'when a link does not contain a link back' do - let(:html) { '' } - - it 'marks the field as verified' do - expect(field.verified?).to be false + it 'marks the field as verified' do + expect(field.verified?).to be true + end end end end From e645ae95610fcb69d15366bc32ab60014d2ebdcf Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 4 Oct 2018 16:05:38 +0200 Subject: [PATCH 24/28] Change admin accounts default sort to most recent (#8813) --- app/controllers/admin/accounts_controller.rb | 2 +- app/helpers/admin/filter_helper.rb | 2 +- app/models/account_filter.rb | 6 +++--- app/views/admin/accounts/index.html.haml | 4 ++-- spec/controllers/admin/accounts_controller_spec.rb | 4 ++-- spec/models/account_filter_spec.rb | 6 +++--- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/controllers/admin/accounts_controller.rb b/app/controllers/admin/accounts_controller.rb index e7ca6b9074..5d57fe3618 100644 --- a/app/controllers/admin/accounts_controller.rb +++ b/app/controllers/admin/accounts_controller.rb @@ -95,7 +95,7 @@ module Admin :remote, :by_domain, :silenced, - :recent, + :alphabetic, :suspended, :username, :display_name, diff --git a/app/helpers/admin/filter_helper.rb b/app/helpers/admin/filter_helper.rb index 359c43d0e3..60e5142e33 100644 --- a/app/helpers/admin/filter_helper.rb +++ b/app/helpers/admin/filter_helper.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Admin::FilterHelper - ACCOUNT_FILTERS = %i(local remote by_domain silenced suspended recent username display_name email ip staff).freeze + ACCOUNT_FILTERS = %i(local remote by_domain silenced suspended alphabetic username display_name email ip staff).freeze REPORT_FILTERS = %i(resolved account_id target_account_id).freeze INVITE_FILTER = %i(available expired).freeze CUSTOM_EMOJI_FILTERS = %i(local remote by_domain shortcode).freeze diff --git a/app/models/account_filter.rb b/app/models/account_filter.rb index dc7a03039f..84364bf1b7 100644 --- a/app/models/account_filter.rb +++ b/app/models/account_filter.rb @@ -8,7 +8,7 @@ class AccountFilter end def results - scope = Account.alphabetic + scope = Account.recent params.each do |key, value| scope.merge!(scope_for(key, value)) if value.present? @@ -29,8 +29,8 @@ class AccountFilter Account.where(domain: value) when 'silenced' Account.silenced - when 'recent' - Account.recent + when 'alphabetic' + Account.reorder(nil).alphabetic when 'suspended' Account.suspended when 'username' diff --git a/app/views/admin/accounts/index.html.haml b/app/views/admin/accounts/index.html.haml index 6aa39a80a0..4bee73adca 100644 --- a/app/views/admin/accounts/index.html.haml +++ b/app/views/admin/accounts/index.html.haml @@ -38,8 +38,8 @@ .filter-subset %strong= t('admin.accounts.order.title') %ul - %li= filter_link_to t('admin.accounts.order.alphabetic'), recent: nil - %li= filter_link_to t('admin.accounts.order.most_recent'), recent: '1' + %li= filter_link_to t('admin.accounts.order.most_recent'), alphabetic: nil + %li= filter_link_to t('admin.accounts.order.alphabetic'), alphabetic: '1' = form_tag admin_accounts_url, method: 'GET', class: 'simple_form' do .fields-group diff --git a/spec/controllers/admin/accounts_controller_spec.rb b/spec/controllers/admin/accounts_controller_spec.rb index fa2786c9b1..ae9e058c86 100644 --- a/spec/controllers/admin/accounts_controller_spec.rb +++ b/spec/controllers/admin/accounts_controller_spec.rb @@ -25,7 +25,7 @@ RSpec.describe Admin::AccountsController, type: :controller do expect(h[:remote]).to eq '1' expect(h[:by_domain]).to eq 'domain' expect(h[:silenced]).to eq '1' - expect(h[:recent]).to eq '1' + expect(h[:alphabetic]).to eq '1' expect(h[:suspended]).to eq '1' expect(h[:username]).to eq 'username' expect(h[:display_name]).to eq 'display name' @@ -40,7 +40,7 @@ RSpec.describe Admin::AccountsController, type: :controller do remote: '1', by_domain: 'domain', silenced: '1', - recent: '1', + alphabetic: '1', suspended: '1', username: 'username', display_name: 'display name', diff --git a/spec/models/account_filter_spec.rb b/spec/models/account_filter_spec.rb index 8441939c5b..0a02526421 100644 --- a/spec/models/account_filter_spec.rb +++ b/spec/models/account_filter_spec.rb @@ -2,10 +2,10 @@ require 'rails_helper' describe AccountFilter do describe 'with empty params' do - it 'defaults to alphabetic account list' do + it 'defaults to recent account list' do filter = described_class.new({}) - expect(filter.results).to eq Account.alphabetic + expect(filter.results).to eq Account.recent end end @@ -60,7 +60,7 @@ describe AccountFilter do end describe 'that call account methods' do - %i(local remote silenced recent suspended).each do |option| + %i(local remote silenced alphabetic suspended).each do |option| it "delegates the #{option} option" do allow(Account).to receive(option).and_return(Account.none) filter = described_class.new({ option => true }) From 186024a058d4b8765a10d87ff3d7f3bdcd2fbb3c Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 4 Oct 2018 16:05:54 +0200 Subject: [PATCH 25/28] Add tootctl settings registrations open (#8829) --- lib/cli.rb | 4 ++++ lib/mastodon/settings_cli.rb | 26 ++++++++++++++++++++++++++ lib/tasks/mastodon.rake | 25 ------------------------- 3 files changed, 30 insertions(+), 25 deletions(-) create mode 100644 lib/mastodon/settings_cli.rb diff --git a/lib/cli.rb b/lib/cli.rb index 14a91c2db4..208df660f0 100644 --- a/lib/cli.rb +++ b/lib/cli.rb @@ -5,6 +5,7 @@ require_relative 'mastodon/media_cli' require_relative 'mastodon/emoji_cli' require_relative 'mastodon/accounts_cli' require_relative 'mastodon/feeds_cli' +require_relative 'mastodon/settings_cli' module Mastodon class CLI < Thor @@ -19,5 +20,8 @@ module Mastodon desc 'feeds SUBCOMMAND ...ARGS', 'Manage feeds' subcommand 'feeds', Mastodon::FeedsCLI + + desc 'settings SUBCOMMAND ...ARGS', 'Manage dynamic settings' + subcommand 'settings', Mastodon::SettingsCLI end end diff --git a/lib/mastodon/settings_cli.rb b/lib/mastodon/settings_cli.rb new file mode 100644 index 0000000000..87c321013b --- /dev/null +++ b/lib/mastodon/settings_cli.rb @@ -0,0 +1,26 @@ +# frozen_string_literal: true + +require_relative '../../config/boot' +require_relative '../../config/environment' +require_relative 'cli_helper' + +module Mastodon + class RegistrationsCLI < Thor + desc 'open', 'Open registrations' + def open + Setting.open_registrations = true + say('OK', :green) + end + + desc 'close', 'Close registrations' + def close + Setting.open_registrations = false + say('OK', :green) + end + end + + class SettingsCLI < Thor + desc 'registrations SUBCOMMAND ...ARGS', 'Manage state of registrations' + subcommand 'registrations', RegistrationsCLI + end +end diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake index ec88008194..ee9657b0ef 100644 --- a/lib/tasks/mastodon.rake +++ b/lib/tasks/mastodon.rake @@ -1,7 +1,5 @@ # frozen_string_literal: true -require 'optparse' -require 'colorize' require 'tty-command' require 'tty-prompt' @@ -390,25 +388,6 @@ namespace :mastodon do end end - namespace :push do - desc 'Unsubscribes from PuSH updates of feeds nobody follows locally' - task clear: :environment do - Pubsubhubbub::UnsubscribeWorker.push_bulk(Account.remote.without_followers.where.not(subscription_expires_at: nil).pluck(:id)) - end - end - - namespace :settings do - desc 'Open registrations on this instance' - task open_registrations: :environment do - Setting.open_registrations = true - end - - desc 'Close registrations on this instance' - task close_registrations: :environment do - Setting.open_registrations = false - end - end - namespace :webpush do desc 'Generate VAPID key' task generate_vapid_key: :environment do @@ -427,7 +406,3 @@ def disable_log_stdout! HttpLog.configuration.logger = dev_null Paperclip.options[:log] = false end - -def prepare_for_options! - 2.times { ARGV.shift } -end From a46ab86adfc9e4ea182af9a555237f17071e194c Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 4 Oct 2018 17:36:11 +0200 Subject: [PATCH 26/28] Limit the number of people that can be followed from one account (#8807) Configurable soft limit of 7,500, and above that, configurable ratio of 1.1 * followers, controlled by: - MAX_FOLLOWS_THRESHOLD - MAX_FOLLOWS_RATIO Fix #2311 --- app/models/follow.rb | 1 + app/models/follow_request.rb | 1 + app/validators/follow_limit_validator.rb | 27 ++++++++++++++++++++++++ app/workers/import_worker.rb | 4 +++- config/locales/en.yml | 1 + spec/models/follow_spec.rb | 14 ++++++++++++ 6 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 app/validators/follow_limit_validator.rb diff --git a/app/models/follow.rb b/app/models/follow.rb index 714f4e8981..7ad56eb78d 100644 --- a/app/models/follow.rb +++ b/app/models/follow.rb @@ -25,6 +25,7 @@ class Follow < ApplicationRecord has_one :notification, as: :activity, dependent: :destroy validates :account_id, uniqueness: { scope: :target_account_id } + validates_with FollowLimitValidator, on: :create scope :recent, -> { reorder(id: :desc) } diff --git a/app/models/follow_request.rb b/app/models/follow_request.rb index 9c4875564b..c5451a0507 100644 --- a/app/models/follow_request.rb +++ b/app/models/follow_request.rb @@ -22,6 +22,7 @@ class FollowRequest < ApplicationRecord has_one :notification, as: :activity, dependent: :destroy validates :account_id, uniqueness: { scope: :target_account_id } + validates_with FollowLimitValidator, on: :create def authorize! account.follow!(target_account, reblogs: show_reblogs, uri: uri) diff --git a/app/validators/follow_limit_validator.rb b/app/validators/follow_limit_validator.rb new file mode 100644 index 0000000000..eb083ed854 --- /dev/null +++ b/app/validators/follow_limit_validator.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class FollowLimitValidator < ActiveModel::Validator + LIMIT = ENV.fetch('MAX_FOLLOWS_THRESHOLD', 7_500).to_i + RATIO = ENV.fetch('MAX_FOLLOWS_RATIO', 1.1).to_f + + def validate(follow) + return if follow.account.nil? || !follow.account.local? + follow.errors.add(:base, I18n.t('users.follow_limit_reached', limit: self.class.limit_for_account(follow.account))) if limit_reached?(follow.account) + end + + class << self + def limit_for_account(account) + if account.following_count < LIMIT + LIMIT + else + account.followers_count * RATIO + end + end + end + + private + + def limit_reached?(account) + account.following_count >= self.class.limit_for_account(account) + end +end diff --git a/app/workers/import_worker.rb b/app/workers/import_worker.rb index d7c126f75b..aeb221cf68 100644 --- a/app/workers/import_worker.rb +++ b/app/workers/import_worker.rb @@ -37,6 +37,8 @@ class ImportWorker end def import_rows - CSV.new(import_contents).reject(&:blank?) + rows = CSV.new(import_contents).reject(&:blank?) + rows = rows.take(FollowLimitValidator.limit_for_account(@import.account)) if @import.type == 'following' + rows end end diff --git a/config/locales/en.yml b/config/locales/en.yml index f883b17a19..439c5627b8 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -917,6 +917,7 @@ en: tips: Tips title: Welcome aboard, %{name}! users: + follow_limit_reached: You cannot follow more than %{limit} people invalid_email: The e-mail address is invalid invalid_otp_token: Invalid two-factor code otp_lost_help_html: If you lost access to both, you may get in touch with %{email} diff --git a/spec/models/follow_spec.rb b/spec/models/follow_spec.rb index f221973b6d..0c84e5e7bf 100644 --- a/spec/models/follow_spec.rb +++ b/spec/models/follow_spec.rb @@ -23,6 +23,20 @@ RSpec.describe Follow, type: :model do follow.valid? expect(follow).to model_have_error_on_field(:target_account) end + + it 'is invalid if account already follows too many people' do + alice.update(following_count: FollowLimitValidator::LIMIT) + + expect(subject).to_not be_valid + expect(subject).to model_have_error_on_field(:base) + end + + it 'is valid if account is only on the brink of following too many people' do + alice.update(following_count: FollowLimitValidator::LIMIT - 1) + + expect(subject).to be_valid + expect(subject).to_not model_have_error_on_field(:base) + end end describe 'recent' do From 0a4739c7324a96cee148373ccc7b57b9c7097b42 Mon Sep 17 00:00:00 2001 From: aus-social <42644106+aus-social@users.noreply.github.com> Date: Fri, 5 Oct 2018 01:38:04 +1000 Subject: [PATCH 27/28] lint pass 2 (#8878) * Code quality pass * Typofix * Update applications_controller_spec.rb * Update applications_controller_spec.rb --- config/environments/production.rb | 2 +- config/initializers/http_client_proxy.rb | 2 +- config/initializers/omniauth.rb | 2 +- config/initializers/open_uri_redirection.rb | 2 +- config/initializers/rack_attack.rb | 2 +- config/initializers/sidekiq.rb | 2 +- config/puma.rb | 2 +- ...20160314164231_add_owner_to_application.rb | 2 +- ...4407_add_shortcode_to_media_attachments.rb | 4 +- .../admin/statuses_controller_spec.rb | 2 +- .../export_controller_concern_spec.rb | 1 + .../settings/applications_controller_spec.rb | 64 +++++++++---------- spec/models/account_spec.rb | 2 +- spec/models/user_spec.rb | 2 +- .../stream_entries/show.html.haml_spec.rb | 2 +- 15 files changed, 47 insertions(+), 46 deletions(-) diff --git a/config/environments/production.rb b/config/environments/production.rb index 30239671c0..ed2d885b06 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -42,7 +42,7 @@ Rails.application.configure do config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX # Allow to specify public IP of reverse proxy if it's needed - config.action_dispatch.trusted_proxies = ENV['TRUSTED_PROXY_IP'].split.map { |item| IPAddr.new(item) } unless ENV['TRUSTED_PROXY_IP'].blank? + config.action_dispatch.trusted_proxies = ENV['TRUSTED_PROXY_IP'].split.map { |item| IPAddr.new(item) } if ENV['TRUSTED_PROXY_IP'].present? # Use the lowest log level to ensure availability of diagnostic information # when problems arise. diff --git a/config/initializers/http_client_proxy.rb b/config/initializers/http_client_proxy.rb index e607aff3c4..9d7b16e69c 100644 --- a/config/initializers/http_client_proxy.rb +++ b/config/initializers/http_client_proxy.rb @@ -6,7 +6,7 @@ Rails.application.configure do raise "No proxy host" unless proxy.host host = proxy.host - host = host[1...-1] if host[0] == '[' #for IPv6 address + host = host[1...-1] if host[0] == '[' # for IPv6 address config.x.http_client_proxy[:proxy] = { proxy_address: host, proxy_port: proxy.port, proxy_username: proxy.user, proxy_password: proxy.password }.compact end diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index 21b58eb5b3..254e751d42 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -3,7 +3,7 @@ Rails.application.config.middleware.use OmniAuth::Builder do end Devise.setup do |config| - # Devise omniauth strategies + # Devise omniauth strategies options = {} options[:redirect_at_sign_in] = ENV['OAUTH_REDIRECT_AT_SIGN_IN'] == 'true' diff --git a/config/initializers/open_uri_redirection.rb b/config/initializers/open_uri_redirection.rb index e24fdecabc..ea2dcffea2 100644 --- a/config/initializers/open_uri_redirection.rb +++ b/config/initializers/open_uri_redirection.rb @@ -1,7 +1,7 @@ require 'open-uri' module OpenURI - def OpenURI.redirectable?(uri1, uri2) # :nodoc: + def self.redirectable?(uri1, uri2) # :nodoc: uri1.scheme.downcase == uri2.scheme.downcase || (/\A(?:http|https|ftp)\z/i =~ uri1.scheme && /\A(?:http|https|ftp)\z/i =~ uri2.scheme) end diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb index 0ca0a7e7fd..8756b8fbf0 100644 --- a/config/initializers/rack_attack.rb +++ b/config/initializers/rack_attack.rb @@ -42,7 +42,7 @@ class Rack::Attack # (blocklist & throttles are skipped) Rack::Attack.safelist('allow from localhost') do |req| # Requests are allowed if the return value is truthy - '127.0.0.1' == req.ip || '::1' == req.ip + req.ip == '127.0.0.1' || req.ip == '::1' end throttle('throttle_authenticated_api', limit: 300, period: 5.minutes) do |req| diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb index 05c8041005..7f8a40d7ba 100644 --- a/config/initializers/sidekiq.rb +++ b/config/initializers/sidekiq.rb @@ -19,4 +19,4 @@ Sidekiq.configure_client do |config| config.redis = redis_params end -Sidekiq::Logging.logger.level = ::Logger::const_get(ENV.fetch('RAILS_LOG_LEVEL', 'info').upcase.to_s) +Sidekiq::Logging.logger.level = ::Logger.const_get(ENV.fetch('RAILS_LOG_LEVEL', 'info').upcase.to_s) diff --git a/config/puma.rb b/config/puma.rb index 0397b89204..5ebf5ed192 100644 --- a/config/puma.rb +++ b/config/puma.rb @@ -1,7 +1,7 @@ threads_count = ENV.fetch('MAX_THREADS') { 5 }.to_i threads threads_count, threads_count -if ENV['SOCKET'] then +if ENV['SOCKET'] bind 'unix://' + ENV['SOCKET'] else port ENV.fetch('PORT') { 3000 } diff --git a/db/migrate/20160314164231_add_owner_to_application.rb b/db/migrate/20160314164231_add_owner_to_application.rb index 1919f09a17..553c18b5eb 100644 --- a/db/migrate/20160314164231_add_owner_to_application.rb +++ b/db/migrate/20160314164231_add_owner_to_application.rb @@ -4,4 +4,4 @@ class AddOwnerToApplication < ActiveRecord::Migration[4.2] add_column :oauth_applications, :owner_type, :string, null: true add_index :oauth_applications, [:owner_id, :owner_type] end -end \ No newline at end of file +end diff --git a/db/migrate/20170105224407_add_shortcode_to_media_attachments.rb b/db/migrate/20170105224407_add_shortcode_to_media_attachments.rb index 2685ae150e..fba46a4b63 100644 --- a/db/migrate/20170105224407_add_shortcode_to_media_attachments.rb +++ b/db/migrate/20170105224407_add_shortcode_to_media_attachments.rb @@ -8,7 +8,7 @@ class AddShortcodeToMediaAttachments < ActiveRecord::Migration[5.0] end def down - remove_index :media_attachments, :shortcode - remove_column :media_attachments, :shortcode + remove_index :media_attachments, :shortcode + remove_column :media_attachments, :shortcode end end diff --git a/spec/controllers/admin/statuses_controller_spec.rb b/spec/controllers/admin/statuses_controller_spec.rb index 6afcc14425..1a08c10b7e 100644 --- a/spec/controllers/admin/statuses_controller_spec.rb +++ b/spec/controllers/admin/statuses_controller_spec.rb @@ -24,7 +24,7 @@ describe Admin::StatusesController do end it 'returns http success with media' do - get :index, params: { account_id: account.id , media: true } + get :index, params: { account_id: account.id, media: true } statuses = assigns(:statuses).to_a expect(statuses.size).to eq 1 diff --git a/spec/controllers/concerns/export_controller_concern_spec.rb b/spec/controllers/concerns/export_controller_concern_spec.rb index 6a13db69d6..e5861c801f 100644 --- a/spec/controllers/concerns/export_controller_concern_spec.rb +++ b/spec/controllers/concerns/export_controller_concern_spec.rb @@ -8,6 +8,7 @@ describe ApplicationController, type: :controller do def index send_export_file end + def export_data @export.account.username end diff --git a/spec/controllers/settings/applications_controller_spec.rb b/spec/controllers/settings/applications_controller_spec.rb index fd4b100717..29c2781484 100644 --- a/spec/controllers/settings/applications_controller_spec.rb +++ b/spec/controllers/settings/applications_controller_spec.rb @@ -47,13 +47,13 @@ describe Settings::ApplicationsController do context 'success (passed scopes as a String)' do def call_create post :create, params: { - doorkeeper_application: { - name: 'My New App', - redirect_uri: 'urn:ietf:wg:oauth:2.0:oob', - website: 'http://google.com', - scopes: 'read write follow' - } - } + doorkeeper_application: { + name: 'My New App', + redirect_uri: 'urn:ietf:wg:oauth:2.0:oob', + website: 'http://google.com', + scopes: 'read write follow' + } + } response end @@ -69,13 +69,13 @@ describe Settings::ApplicationsController do context 'success (passed scopes as an Array)' do def call_create post :create, params: { - doorkeeper_application: { - name: 'My New App', - redirect_uri: 'urn:ietf:wg:oauth:2.0:oob', - website: 'http://google.com', - scopes: [ 'read', 'write', 'follow' ] - } - } + doorkeeper_application: { + name: 'My New App', + redirect_uri: 'urn:ietf:wg:oauth:2.0:oob', + website: 'http://google.com', + scopes: [ 'read', 'write', 'follow' ] + } + } response end @@ -91,13 +91,13 @@ describe Settings::ApplicationsController do context 'failure' do before do post :create, params: { - doorkeeper_application: { - name: '', - redirect_uri: '', - website: '', - scopes: [] - } - } + doorkeeper_application: { + name: '', + redirect_uri: '', + website: '', + scopes: [] + } + } end it 'returns http success' do @@ -120,9 +120,9 @@ describe Settings::ApplicationsController do def call_update patch :update, params: { - id: app.id, - doorkeeper_application: opts - } + id: app.id, + doorkeeper_application: opts + } response end @@ -139,14 +139,14 @@ describe Settings::ApplicationsController do context 'failure' do before do patch :update, params: { - id: app.id, - doorkeeper_application: { - name: '', - redirect_uri: '', - website: '', - scopes: [] - } - } + id: app.id, + doorkeeper_application: { + name: '', + redirect_uri: '', + website: '', + scopes: [] + } + } end it 'returns http success' do diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index ae19251ae9..60d13d32e9 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -275,7 +275,7 @@ RSpec.describe Account, type: :model do subject { Fabricate(:account) } - context 'when the status is a reblog of another status'do + context 'when the status is a reblog of another status' do let(:original_reblog) do author = Fabricate(:account, username: 'original_reblogger') Fabricate(:status, reblog: original_status, account: author) diff --git a/spec/models/user_spec.rb b/spec/models/user_spec.rb index 015e90edcd..42198cb4d6 100644 --- a/spec/models/user_spec.rb +++ b/spec/models/user_spec.rb @@ -254,7 +254,7 @@ RSpec.describe User, type: :model do it_behaves_like 'Settings-extended' do def create! - User.create!(account: Fabricate(:account), email: 'foo@mastodon.space', password: 'abcd1234' ) + User.create!(account: Fabricate(:account), email: 'foo@mastodon.space', password: 'abcd1234') end def fabricate diff --git a/spec/views/stream_entries/show.html.haml_spec.rb b/spec/views/stream_entries/show.html.haml_spec.rb index e084195969..93f0adb991 100644 --- a/spec/views/stream_entries/show.html.haml_spec.rb +++ b/spec/views/stream_entries/show.html.haml_spec.rb @@ -49,7 +49,7 @@ describe 'stream_entries/show.html.haml', without_verify_partial_doubles: true d assign(:stream_entry, reply.stream_entry) assign(:account, alice) assign(:type, reply.stream_entry.activity_type.downcase) - assign(:ancestors, reply.stream_entry.activity.ancestors(1, bob) ) + assign(:ancestors, reply.stream_entry.activity.ancestors(1, bob)) assign(:descendant_threads, [{ statuses: reply.stream_entry.activity.descendants(1) }]) render From 028ad4124cf1fdb28f5cf11bd7080e7a63f2f99e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" Date: Fri, 5 Oct 2018 04:07:44 +0200 Subject: [PATCH 28/28] [Security] Bump nokogiri from 1.8.4 to 1.8.5 (#8881) Bumps [nokogiri](https://github.com/sparklemotion/nokogiri) from 1.8.4 to 1.8.5. **This update includes security fixes.** - [Release notes](https://github.com/sparklemotion/nokogiri/releases) - [Changelog](https://github.com/sparklemotion/nokogiri/blob/master/CHANGELOG.md) - [Commits](https://github.com/sparklemotion/nokogiri/compare/v1.8.4...v1.8.5) Signed-off-by: dependabot[bot] --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 4c7bc0e66d..a74fd5c669 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -354,7 +354,7 @@ GEM net-ssh (>= 2.6.5) net-ssh (5.0.2) nio4r (2.3.1) - nokogiri (1.8.4) + nokogiri (1.8.5) mini_portile2 (~> 2.3.0) nokogumbo (1.5.0) nokogiri