1
0

Upgrade to Rails 5.0.0.1

This commit is contained in:
Eugen Rochko 2016-08-17 17:56:23 +02:00
parent ff2cbc0753
commit 10ba09f546
47 changed files with 398 additions and 291 deletions

11
Gemfile
View File

@ -1,6 +1,6 @@
source 'https://rubygems.org' source 'https://rubygems.org'
gem 'rails', '4.2.5.2' gem 'rails', '5.0.0.1'
gem 'sass-rails', '~> 5.0' gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0' gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0' gem 'coffee-rails', '~> 4.1.0'
@ -15,7 +15,6 @@ gem 'pg'
gem 'dotenv-rails' gem 'dotenv-rails'
gem 'font-awesome-rails' gem 'font-awesome-rails'
gem 'paranoia', '~> 2.0'
gem 'paperclip', '~> 4.3' gem 'paperclip', '~> 4.3'
gem 'http' gem 'http'
@ -34,15 +33,14 @@ gem 'fast_blank'
gem 'htmlentities' gem 'htmlentities'
gem 'onebox' gem 'onebox'
gem 'simple_form' gem 'simple_form'
gem 'will_paginate', '~> 3.0.6' gem 'will_paginate'
gem 'rack-attack' gem 'rack-attack'
gem 'turbolinks', '~> 5.0.0.beta' gem 'turbolinks'
gem 'sidekiq' gem 'sidekiq'
gem 'sinatra', :require => nil gem 'sinatra', require: nil, github: 'sinatra'
group :development, :test do group :development, :test do
gem 'rspec-rails' gem 'rspec-rails'
gem 'quiet_assets'
gem 'pry-rails' gem 'pry-rails'
gem 'fuubar' gem 'fuubar'
gem 'fabrication' gem 'fabrication'
@ -55,7 +53,6 @@ group :test do
end end
group :development do group :development do
gem 'web-console', '~> 2.0'
gem 'rubocop', require: false gem 'rubocop', require: false
gem 'better_errors' gem 'better_errors'
gem 'binding_of_caller' gem 'binding_of_caller'

View File

@ -1,44 +1,58 @@
GIT
remote: git://github.com/sinatra/sinatra.git
revision: 6b5a0ef3a4598366138fefe3f2b696ddeb371f3c
specs:
rack-protection (2.0.0)
rack
sinatra (2.0.0.pre.alpha)
mustermann (~> 0.4)
rack (~> 2.0)
rack-protection (~> 2.0)
tilt (~> 2.0)
GEM GEM
remote: https://rubygems.org/ remote: https://rubygems.org/
specs: specs:
actionmailer (4.2.5.2) actioncable (5.0.0.1)
actionpack (= 4.2.5.2) actionpack (= 5.0.0.1)
actionview (= 4.2.5.2) nio4r (~> 1.2)
activejob (= 4.2.5.2) websocket-driver (~> 0.6.1)
actionmailer (5.0.0.1)
actionpack (= 5.0.0.1)
actionview (= 5.0.0.1)
activejob (= 5.0.0.1)
mail (~> 2.5, >= 2.5.4) mail (~> 2.5, >= 2.5.4)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 2.0)
actionpack (4.2.5.2) actionpack (5.0.0.1)
actionview (= 4.2.5.2) actionview (= 5.0.0.1)
activesupport (= 4.2.5.2) activesupport (= 5.0.0.1)
rack (~> 1.6) rack (~> 2.0)
rack-test (~> 0.6.2) rack-test (~> 0.6.3)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.2)
actionview (4.2.5.2) actionview (5.0.0.1)
activesupport (= 4.2.5.2) activesupport (= 5.0.0.1)
builder (~> 3.1) builder (~> 3.1)
erubis (~> 2.7.0) erubis (~> 2.7.0)
rails-dom-testing (~> 1.0, >= 1.0.5) rails-dom-testing (~> 2.0)
rails-html-sanitizer (~> 1.0, >= 1.0.2) rails-html-sanitizer (~> 1.0, >= 1.0.2)
activejob (4.2.5.2) activejob (5.0.0.1)
activesupport (= 4.2.5.2) activesupport (= 5.0.0.1)
globalid (>= 0.3.0) globalid (>= 0.3.6)
activemodel (4.2.5.2) activemodel (5.0.0.1)
activesupport (= 4.2.5.2) activesupport (= 5.0.0.1)
builder (~> 3.1) activerecord (5.0.0.1)
activerecord (4.2.5.2) activemodel (= 5.0.0.1)
activemodel (= 4.2.5.2) activesupport (= 5.0.0.1)
activesupport (= 4.2.5.2) arel (~> 7.0)
arel (~> 6.0) activesupport (5.0.0.1)
activesupport (4.2.5.2) concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (~> 0.7) i18n (~> 0.7)
json (~> 1.7, >= 1.7.7)
minitest (~> 5.1) minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1) tzinfo (~> 1.1)
addressable (2.4.0) addressable (2.4.0)
arel (6.0.3) arel (7.1.1)
ast (2.2.0) ast (2.3.0)
bcrypt (3.1.11) bcrypt (3.1.11)
better_errors (2.1.1) better_errors (2.1.1)
coderay (>= 1.0.0) coderay (>= 1.0.0)
@ -47,9 +61,9 @@ GEM
binding_of_caller (0.7.2) binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1) debug_inspector (>= 0.0.1)
builder (3.2.2) builder (3.2.2)
bullet (5.0.0) bullet (5.3.0)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
uniform_notifier (~> 1.9.0) uniform_notifier (~> 1.10.0)
climate_control (0.0.3) climate_control (0.0.3)
activesupport (>= 3.0) activesupport (>= 3.0)
cocaine (0.5.8) cocaine (0.5.8)
@ -62,38 +76,37 @@ GEM
coffee-script-source coffee-script-source
execjs execjs
coffee-script-source (1.10.0) coffee-script-source (1.10.0)
concurrent-ruby (1.0.1) concurrent-ruby (1.0.2)
connection_pool (2.2.0) connection_pool (2.2.0)
crack (0.4.3) crack (0.4.3)
safe_yaml (~> 1.0.0) safe_yaml (~> 1.0.0)
debug_inspector (0.0.2) debug_inspector (0.0.2)
devise (3.5.6) devise (4.2.0)
bcrypt (~> 3.0) bcrypt (~> 3.0)
orm_adapter (~> 0.1) orm_adapter (~> 0.1)
railties (>= 3.2.6, < 5) railties (>= 4.1.0, < 5.1)
responders responders
thread_safe (~> 0.1)
warden (~> 1.2.3) warden (~> 1.2.3)
diff-lcs (1.2.5) diff-lcs (1.2.5)
docile (1.1.5) docile (1.1.5)
domain_name (0.5.20160310) domain_name (0.5.20160615)
unf (>= 0.0.5, < 1.0.0) unf (>= 0.0.5, < 1.0.0)
doorkeeper (3.1.0) doorkeeper (4.1.0)
railties (>= 3.2) railties (>= 4.2)
dotenv (2.1.0) dotenv (2.1.1)
dotenv-rails (2.1.0) dotenv-rails (2.1.1)
dotenv (= 2.1.0) dotenv (= 2.1.1)
railties (>= 4.0, < 5.1) railties (>= 4.0, < 5.1)
erubis (2.7.0) erubis (2.7.0)
execjs (2.6.0) execjs (2.7.0)
fabrication (2.15.0) fabrication (2.15.2)
fast_blank (1.0.0) fast_blank (1.0.0)
font-awesome-rails (4.5.0.1) font-awesome-rails (4.6.3.1)
railties (>= 3.2, < 5.1) railties (>= 3.2, < 5.1)
fuubar (2.0.0) fuubar (2.1.1)
rspec (~> 3.0) rspec (~> 3.0)
ruby-progressbar (~> 1.4) ruby-progressbar (~> 1.4)
globalid (0.3.6) globalid (0.3.7)
activesupport (>= 4.1.0) activesupport (>= 4.1.0)
goldfinger (1.0.2) goldfinger (1.0.2)
addressable (~> 2.4) addressable (~> 2.4)
@ -125,7 +138,7 @@ GEM
http-form_data (1.0.1) http-form_data (1.0.1)
http_parser.rb (0.6.0) http_parser.rb (0.6.0)
i18n (0.7.0) i18n (0.7.0)
jbuilder (2.4.1) jbuilder (2.6.0)
activesupport (>= 3.0.0, < 5.1) activesupport (>= 3.0.0, < 5.1)
multi_json (~> 1.2) multi_json (~> 1.2)
jquery-rails (4.1.1) jquery-rails (4.1.1)
@ -137,24 +150,30 @@ GEM
addressable (~> 2.3) addressable (~> 2.3)
letter_opener (1.4.1) letter_opener (1.4.1)
launchy (~> 2.2) launchy (~> 2.2)
libv8 (3.16.14.13) libv8 (3.16.14.15)
loofah (2.0.3) loofah (2.0.3)
nokogiri (>= 1.5.9) nokogiri (>= 1.5.9)
mail (2.6.3) mail (2.6.4)
mime-types (>= 1.16, < 3) mime-types (>= 1.16, < 4)
memory_profiler (0.9.6) memory_profiler (0.9.6)
method_source (0.8.2) method_source (0.8.2)
mime-types (2.99.1) mime-types (3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2016.0521)
mimemagic (0.3.0) mimemagic (0.3.0)
mini_portile2 (2.0.0) mini_portile2 (2.1.0)
minitest (5.8.4) minitest (5.9.0)
moneta (0.8.0) moneta (0.8.0)
multi_json (1.11.2) multi_json (1.12.1)
mustache (1.0.2) mustache (1.0.3)
nokogiri (1.6.7.2) mustermann (0.4.0)
mini_portile2 (~> 2.0.0.rc2) tool (~> 0.2)
oj (2.14.6) nio4r (1.2.1)
onebox (1.5.35) nokogiri (1.6.8)
mini_portile2 (~> 2.1.0)
pkg-config (~> 1.1.7)
oj (2.17.3)
onebox (1.5.48)
htmlentities (~> 4.3.4) htmlentities (~> 4.3.4)
moneta (~> 0.8) moneta (~> 0.8)
multi_json (~> 1.11) multi_json (~> 1.11)
@ -165,55 +184,48 @@ GEM
addressable (~> 2.4) addressable (~> 2.4)
http (~> 1.0) http (~> 1.0)
nokogiri (~> 1.6) nokogiri (~> 1.6)
paperclip (4.3.6) paperclip (4.3.7)
activemodel (>= 3.2.0) activemodel (>= 3.2.0)
activesupport (>= 3.2.0) activesupport (>= 3.2.0)
cocaine (~> 0.5.5) cocaine (~> 0.5.5)
mime-types mime-types
mimemagic (= 0.3.0) mimemagic (= 0.3.0)
paranoia (2.1.5) parser (2.3.1.2)
activerecord (~> 4.0)
parser (2.3.0.6)
ast (~> 2.2) ast (~> 2.2)
pg (0.18.4) pg (0.18.4)
pkg-config (1.1.7)
powerpack (0.1.1) powerpack (0.1.1)
pry (0.10.3) pry (0.10.4)
coderay (~> 1.1.0) coderay (~> 1.1.0)
method_source (~> 0.8.1) method_source (~> 0.8.1)
slop (~> 3.4) slop (~> 3.4)
pry-rails (0.3.4) pry-rails (0.3.4)
pry (>= 0.9.10) pry (>= 0.9.10)
puma (3.2.0) puma (3.6.0)
quiet_assets (1.1.0) rabl (0.13.0)
railties (>= 3.1, < 5.0)
rabl (0.12.0)
activesupport (>= 2.3.14) activesupport (>= 2.3.14)
rack (1.6.4) rack (2.0.1)
rack-attack (4.4.1) rack-attack (5.0.1)
rack rack
rack-mini-profiler (0.9.9.2) rack-mini-profiler (0.10.1)
rack (>= 1.2.0) rack (>= 1.2.0)
rack-protection (1.5.3)
rack
rack-test (0.6.3) rack-test (0.6.3)
rack (>= 1.0) rack (>= 1.0)
rails (4.2.5.2) rails (5.0.0.1)
actionmailer (= 4.2.5.2) actioncable (= 5.0.0.1)
actionpack (= 4.2.5.2) actionmailer (= 5.0.0.1)
actionview (= 4.2.5.2) actionpack (= 5.0.0.1)
activejob (= 4.2.5.2) actionview (= 5.0.0.1)
activemodel (= 4.2.5.2) activejob (= 5.0.0.1)
activerecord (= 4.2.5.2) activemodel (= 5.0.0.1)
activesupport (= 4.2.5.2) activerecord (= 5.0.0.1)
activesupport (= 5.0.0.1)
bundler (>= 1.3.0, < 2.0) bundler (>= 1.3.0, < 2.0)
railties (= 4.2.5.2) railties (= 5.0.0.1)
sprockets-rails sprockets-rails (>= 2.0.0)
rails-deprecated_sanitizer (1.0.3) rails-dom-testing (2.0.1)
activesupport (>= 4.2.0.alpha) activesupport (>= 4.2.0, < 6.0)
rails-dom-testing (1.0.7)
activesupport (>= 4.2.0.beta, < 5.0)
nokogiri (~> 1.6.0) nokogiri (~> 1.6.0)
rails-deprecated_sanitizer (>= 1.0.1)
rails-html-sanitizer (1.0.3) rails-html-sanitizer (1.0.3)
loofah (~> 2.0) loofah (~> 2.0)
rails_12factor (0.0.3) rails_12factor (0.0.3)
@ -222,57 +234,58 @@ GEM
rails_autolink (1.1.6) rails_autolink (1.1.6)
rails (> 3.1) rails (> 3.1)
rails_serve_static_assets (0.0.5) rails_serve_static_assets (0.0.5)
rails_stdout_logging (0.0.4) rails_stdout_logging (0.0.5)
railties (4.2.5.2) railties (5.0.0.1)
actionpack (= 4.2.5.2) actionpack (= 5.0.0.1)
activesupport (= 4.2.5.2) activesupport (= 5.0.0.1)
method_source
rake (>= 0.8.7) rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
rainbow (2.1.0) rainbow (2.1.0)
rake (11.1.1) rake (11.2.2)
rdoc (4.2.2) rdoc (4.2.2)
json (~> 1.4) json (~> 1.4)
redis (3.2.2) redis (3.3.1)
ref (2.0.0) ref (2.0.0)
responders (2.1.1) responders (2.3.0)
railties (>= 4.2.0, < 5.1) railties (>= 4.2.0, < 5.1)
rspec (3.4.0) rspec (3.5.0)
rspec-core (~> 3.4.0) rspec-core (~> 3.5.0)
rspec-expectations (~> 3.4.0) rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.4.0) rspec-mocks (~> 3.5.0)
rspec-core (3.4.4) rspec-core (3.5.2)
rspec-support (~> 3.4.0) rspec-support (~> 3.5.0)
rspec-expectations (3.4.0) rspec-expectations (3.5.0)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0) rspec-support (~> 3.5.0)
rspec-mocks (3.4.1) rspec-mocks (3.5.0)
diff-lcs (>= 1.2.0, < 2.0) diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.4.0) rspec-support (~> 3.5.0)
rspec-rails (3.4.2) rspec-rails (3.5.1)
actionpack (>= 3.0, < 4.3) actionpack (>= 3.0)
activesupport (>= 3.0, < 4.3) activesupport (>= 3.0)
railties (>= 3.0, < 4.3) railties (>= 3.0)
rspec-core (~> 3.4.0) rspec-core (~> 3.5.0)
rspec-expectations (~> 3.4.0) rspec-expectations (~> 3.5.0)
rspec-mocks (~> 3.4.0) rspec-mocks (~> 3.5.0)
rspec-support (~> 3.4.0) rspec-support (~> 3.5.0)
rspec-sidekiq (2.2.0) rspec-sidekiq (2.2.0)
rspec (~> 3.0, >= 3.0.0) rspec (~> 3.0, >= 3.0.0)
sidekiq (>= 2.4.0) sidekiq (>= 2.4.0)
rspec-support (3.4.1) rspec-support (3.5.0)
rubocop (0.38.0) rubocop (0.42.0)
parser (>= 2.3.0.6, < 3.0) parser (>= 2.3.1.1, < 3.0)
powerpack (~> 0.1) powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0) rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7) ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1) unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.7.5) ruby-progressbar (1.8.1)
ruby_parser (3.8.1) ruby_parser (3.8.2)
sexp_processor (~> 4.1) sexp_processor (~> 4.1)
safe_yaml (1.0.4) safe_yaml (1.0.4)
sass (3.4.21) sass (3.4.22)
sass-rails (5.0.4) sass-rails (5.0.6)
railties (>= 4.0.0, < 5.0) railties (>= 4.0.0, < 6)
sass (~> 3.1) sass (~> 3.1)
sprockets (>= 2.8, < 4.0) sprockets (>= 2.8, < 4.0)
sprockets-rails (>= 2.0, < 4.0) sprockets-rails (>= 2.0, < 4.0)
@ -281,27 +294,23 @@ GEM
json (~> 1.7, >= 1.7.7) json (~> 1.7, >= 1.7.7)
rdoc (~> 4.0) rdoc (~> 4.0)
sexp_processor (4.7.0) sexp_processor (4.7.0)
sidekiq (4.1.1) sidekiq (4.1.2)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
connection_pool (~> 2.2, >= 2.2.0) connection_pool (~> 2.2, >= 2.2.0)
redis (~> 3.2, >= 3.2.1) redis (~> 3.2, >= 3.2.1)
simple_form (3.2.1) simple_form (3.2.1)
actionpack (> 4, < 5.1) actionpack (> 4, < 5.1)
activemodel (> 4, < 5.1) activemodel (> 4, < 5.1)
simplecov (0.11.2) simplecov (0.12.0)
docile (~> 1.1.0) docile (~> 1.1.0)
json (~> 1.8) json (>= 1.8, < 3)
simplecov-html (~> 0.10.0) simplecov-html (~> 0.10.0)
simplecov-html (0.10.0) simplecov-html (0.10.0)
sinatra (1.4.7)
rack (~> 1.5)
rack-protection (~> 1.4)
tilt (>= 1.3, < 3)
slop (3.6.0) slop (3.6.0)
sprockets (3.5.2) sprockets (3.7.0)
concurrent-ruby (~> 1.0) concurrent-ruby (~> 1.0)
rack (> 1, < 3) rack (> 1, < 3)
sprockets-rails (3.0.4) sprockets-rails (3.1.1)
actionpack (>= 4.0) actionpack (>= 4.0)
activesupport (>= 4.0) activesupport (>= 4.0)
sprockets (>= 3.0.0) sprockets (>= 3.0.0)
@ -310,32 +319,30 @@ GEM
ref ref
thor (0.19.1) thor (0.19.1)
thread_safe (0.3.5) thread_safe (0.3.5)
tilt (2.0.2) tilt (2.0.5)
turbolinks (5.0.0.beta2) tool (0.2.3)
turbolinks-source turbolinks (5.0.1)
turbolinks-source (5.0.0.beta3) turbolinks-source (~> 5)
turbolinks-source (5.0.0)
tzinfo (1.2.2) tzinfo (1.2.2)
thread_safe (~> 0.1) thread_safe (~> 0.1)
uglifier (2.7.2) uglifier (3.0.1)
execjs (>= 0.3.0) execjs (>= 0.3.0, < 3)
json (>= 1.8.0)
unf (0.1.4) unf (0.1.4)
unf_ext unf_ext
unf_ext (0.0.7.2) unf_ext (0.0.7.2)
unicode-display_width (1.0.2) unicode-display_width (1.1.0)
uniform_notifier (1.9.0) uniform_notifier (1.10.0)
warden (1.2.6) warden (1.2.6)
rack (>= 1.0) rack (>= 1.0)
web-console (2.3.0) webmock (2.1.0)
activemodel (>= 4.0)
binding_of_caller (>= 0.7.2)
railties (>= 4.0)
sprockets-rails (>= 2.0, < 4.0)
webmock (1.24.2)
addressable (>= 2.3.6) addressable (>= 2.3.6)
crack (>= 0.3.2) crack (>= 0.3.2)
hashdiff hashdiff
will_paginate (3.0.7) websocket-driver (0.6.4)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.2)
will_paginate (3.1.0)
PLATFORMS PLATFORMS
ruby ruby
@ -367,15 +374,13 @@ DEPENDENCIES
onebox onebox
ostatus2 ostatus2
paperclip (~> 4.3) paperclip (~> 4.3)
paranoia (~> 2.0)
pg pg
pry-rails pry-rails
puma puma
quiet_assets
rabl rabl
rack-attack rack-attack
rack-mini-profiler rack-mini-profiler
rails (= 4.2.5.2) rails (= 5.0.0.1)
rails_12factor rails_12factor
rails_autolink rails_autolink
redis (~> 3.2) redis (~> 3.2)
@ -387,13 +392,12 @@ DEPENDENCIES
sidekiq sidekiq
simple_form simple_form
simplecov simplecov
sinatra sinatra!
therubyracer therubyracer
turbolinks (~> 5.0.0.beta) turbolinks
uglifier (>= 1.3.0) uglifier (>= 1.3.0)
web-console (~> 2.0)
webmock webmock
will_paginate (~> 3.0.6) will_paginate
BUNDLED WITH BUNDLED WITH
1.11.2 1.12.5

View File

@ -4,7 +4,7 @@ class Api::SalmonController < ApiController
def update def update
ProcessInteractionService.new.(request.body.read, @account) ProcessInteractionService.new.(request.body.read, @account)
render nothing: true, status: 201 head 201
end end
private private

View File

@ -4,9 +4,9 @@ class Api::SubscriptionsController < ApiController
def show def show
if @account.subscription(api_subscription_url(@account.id)).valid?(params['hub.topic'], params['hub.verify_token']) if @account.subscription(api_subscription_url(@account.id)).valid?(params['hub.topic'], params['hub.verify_token'])
render text: HTMLEntities.new.encode(params['hub.challenge']), status: 200 render plain: HTMLEntities.new.encode(params['hub.challenge']), status: 200
else else
render nothing: true, status: 404 head 404
end end
end end
@ -15,9 +15,9 @@ class Api::SubscriptionsController < ApiController
if @account.subscription(api_subscription_url(@account.id)).verify(body, request.headers['HTTP_X_HUB_SIGNATURE']) if @account.subscription(api_subscription_url(@account.id)).verify(body, request.headers['HTTP_X_HUB_SIGNATURE'])
ProcessFeedService.new.(body, @account) ProcessFeedService.new.(body, @account)
render nothing: true, status: 201 head 201
else else
render nothing: true, status: 202 head 202
end end
end end

View File

@ -1,6 +1,6 @@
class ApiController < ApplicationController class ApiController < ApplicationController
protect_from_forgery with: :null_session protect_from_forgery with: :null_session
skip_before_filter :verify_authenticity_token skip_before_action :verify_authenticity_token
protected protected

View File

@ -11,8 +11,8 @@ class Auth::RegistrationsController < Devise::RegistrationsController
end end
def configure_sign_up_params def configure_sign_up_params
devise_parameter_sanitizer.for(:sign_up) do |u| devise_parameter_sanitizer.permit(:sign_up) do |u|
u.permit(:email, :password, :password_confirmation, account_attributes: [:username]) u.permit({ account_attributes: [:username] }, :email, :password, :password_confirmation)
end end
end end

View File

@ -1,5 +1,5 @@
class Oauth::ApplicationsController < Doorkeeper::ApplicationsController class Oauth::ApplicationsController < Doorkeeper::ApplicationsController
before_filter :authenticate_user! before_action :authenticate_user!
def index def index
@applications = current_user.oauth_applications @applications = current_user.oauth_applications

View File

@ -1,5 +1,5 @@
class XrdController < ApplicationController class XrdController < ApplicationController
before_filter :set_format before_action :set_format
def host_meta def host_meta
@webfinger_template = "#{webfinger_url}?resource={uri}" @webfinger_template = "#{webfinger_url}?resource={uri}"
@ -10,7 +10,7 @@ class XrdController < ApplicationController
@canonical_account_uri = "acct:#{@account.username}@#{Rails.configuration.x.local_domain}" @canonical_account_uri = "acct:#{@account.username}@#{Rails.configuration.x.local_domain}"
@magic_key = pem_to_magic_key(@account.keypair.public_key) @magic_key = pem_to_magic_key(@account.keypair.public_key)
rescue ActiveRecord::RecordNotFound rescue ActiveRecord::RecordNotFound
render nothing: true, status: 404 head 404
end end
private private

View File

@ -1,10 +1,10 @@
class Account < ActiveRecord::Base class Account < ApplicationRecord
include Targetable include Targetable
# Local users # Local users
has_one :user, inverse_of: :account has_one :user, inverse_of: :account
validates :username, uniqueness: { scope: :domain, case_sensitive: false }, if: 'local?' validates :username, presence: true, uniqueness: { scope: :domain, case_sensitive: false }, if: 'local?'
validates :username, uniqueness: { scope: :domain, case_sensitive: true }, unless: 'local?' validates :username, presence: true, uniqueness: { scope: :domain, case_sensitive: true }, unless: 'local?'
# Avatar upload # Avatar upload
has_attached_file :avatar, styles: { large: '300x300#', medium: '96x96#', small: '48x48#' }, default_url: 'avatars/missing.png' has_attached_file :avatar, styles: { large: '300x300#', medium: '96x96#', small: '48x48#' }, default_url: 'avatars/missing.png'

View File

@ -0,0 +1,3 @@
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
end

View File

@ -1,4 +1,4 @@
class Favourite < ActiveRecord::Base class Favourite < ApplicationRecord
include Streamable include Streamable
belongs_to :account, inverse_of: :favourites belongs_to :account, inverse_of: :favourites

View File

@ -1,4 +1,4 @@
class Follow < ActiveRecord::Base class Follow < ApplicationRecord
include Streamable include Streamable
belongs_to :account belongs_to :account

View File

@ -1,4 +1,4 @@
class Mention < ActiveRecord::Base class Mention < ApplicationRecord
belongs_to :account, inverse_of: :mentions belongs_to :account, inverse_of: :mentions
belongs_to :status belongs_to :status

View File

@ -1,4 +1,4 @@
class Status < ActiveRecord::Base class Status < ApplicationRecord
include Paginable include Paginable
include Streamable include Streamable

View File

@ -1,4 +1,4 @@
class StreamEntry < ActiveRecord::Base class StreamEntry < ApplicationRecord
include Paginable include Paginable
belongs_to :account, inverse_of: :stream_entries belongs_to :account, inverse_of: :stream_entries

View File

@ -1,4 +1,4 @@
class User < ActiveRecord::Base class User < ApplicationRecord
devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable
belongs_to :account, inverse_of: :user belongs_to :account, inverse_of: :user

View File

@ -1,4 +1,4 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
APP_PATH = File.expand_path('../../config/application', __FILE__) APP_PATH = File.expand_path('../config/application', __dir__)
require_relative '../config/boot' require_relative '../config/boot'
require 'rails/commands' require 'rails/commands'

View File

@ -1,29 +1,34 @@
#!/usr/bin/env ruby #!/usr/bin/env ruby
require 'pathname' require 'pathname'
require 'fileutils'
include FileUtils
# path to your application root. # path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__) APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
Dir.chdir APP_ROOT do def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end
chdir APP_ROOT do
# This script is a starting point to setup your application. # This script is a starting point to setup your application.
# Add necessary setup steps to this file: # Add necessary setup steps to this file.
puts "== Installing dependencies ==" puts '== Installing dependencies =='
system "gem install bundler --conservative" system! 'gem install bundler --conservative'
system "bundle check || bundle install" system('bundle check') || system!('bundle install')
# puts "\n== Copying sample files ==" # puts "\n== Copying sample files =="
# unless File.exist?("config/database.yml") # unless File.exist?('config/database.yml')
# system "cp config/database.yml.sample config/database.yml" # cp 'config/database.yml.sample', 'config/database.yml'
# end # end
puts "\n== Preparing database ==" puts "\n== Preparing database =="
system "bin/rake db:setup" system! 'bin/rails db:setup'
puts "\n== Removing old logs and tempfiles ==" puts "\n== Removing old logs and tempfiles =="
system "rm -f log/*" system! 'bin/rails log:clear tmp:clear'
system "rm -rf tmp/cache"
puts "\n== Restarting application server ==" puts "\n== Restarting application server =="
system "touch tmp/restart.txt" system! 'bin/rails restart'
end end

29
bin/update Executable file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env ruby
require 'pathname'
require 'fileutils'
include FileUtils
# path to your application root.
APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
def system!(*args)
system(*args) || abort("\n== Command #{args} failed ==")
end
chdir APP_ROOT do
# This script is a way to update your development environment automatically.
# Add necessary update steps to this file.
puts '== Installing dependencies =='
system! 'gem install bundler --conservative'
system('bundle check') || system!('bundle install')
puts "\n== Updating database =="
system! 'bin/rails db:migrate'
puts "\n== Removing old logs and tempfiles =="
system! 'bin/rails log:clear tmp:clear'
puts "\n== Restarting application server =="
system! 'bin/rails restart'
end

View File

@ -1,4 +1,4 @@
require File.expand_path('../boot', __FILE__) require_relative 'boot'
require 'rails/all' require 'rails/all'
@ -22,9 +22,6 @@ module Mastodon
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s] # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de # config.i18n.default_locale = :de
# Do not swallow errors in after_commit/after_rollback callbacks.
config.active_record.raise_in_transactional_callbacks = true
config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb') config.paths.add File.join('app', 'api'), glob: File.join('**', '*.rb')
config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')] config.autoload_paths += Dir[Rails.root.join('app', 'api', '*')]

View File

@ -1,3 +1,3 @@
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__) 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.

9
config/cable.yml Normal file
View File

@ -0,0 +1,9 @@
development:
adapter: async
test:
adapter: async
production:
adapter: redis
url: redis://<%= ENV['REDIS_HOST'] || 'localhost' %>:<%= ENV['REDIS_PORT'] || 6379 %>/1

View File

@ -1,5 +1,5 @@
# Load the Rails application. # Load the Rails application.
require File.expand_path('../application', __FILE__) require_relative 'application'
# Initialize the Rails application. # Initialize the Rails application.
Rails.application.initialize! Rails.application.initialize!

View File

@ -9,12 +9,26 @@ Rails.application.configure do
# Do not eager load code on boot. # Do not eager load code on boot.
config.eager_load = false config.eager_load = false
# Show full error reports and disable caching. # Show full error reports.
config.consider_all_requests_local = true config.consider_all_requests_local= true
config.action_controller.perform_caching = false
# Enable/disable caching. By default caching is disabled.
if Rails.root.join('tmp/caching-dev.txt').exist?
config.action_controller.perform_caching = true
config.cache_store = :memory_store
config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=172800'
}
else
config.action_controller.perform_caching = false
config.cache_store = :null_store
end
# Don't care if the mailer can't send. # Don't care if the mailer can't send.
config.action_mailer.raise_delivery_errors = false config.action_mailer.raise_delivery_errors = false
config.action_mailer.perform_caching = false
# Print deprecation notices to the Rails logger. # Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log config.active_support.deprecation = :log
@ -27,9 +41,8 @@ Rails.application.configure do
# number of complex assets. # number of complex assets.
config.assets.debug = true config.assets.debug = true
# Asset digests allow you to set far-future HTTP expiration dates on all assets, # Suppress logger output for asset requests.
# yet still be able to expire them through the digest params. config.assets.quiet = true
config.assets.digest = true
# Adds additional error checking when serving assets at runtime. # Adds additional error checking when serving assets at runtime.
# Checks for improperly declared sprockets dependencies. # Checks for improperly declared sprockets dependencies.
@ -39,6 +52,10 @@ Rails.application.configure do
# Raises error for missing translations # Raises error for missing translations
# config.action_view.raise_on_missing_translations = true # config.action_view.raise_on_missing_translations = true
# Use an evented file watcher to asynchronously detect changes in source code,
# routes, locales, etc. This feature depends on the listen gem.
# config.file_watcher = ActiveSupport::EventedFileUpdateChecker
config.action_mailer.delivery_method = :letter_opener config.action_mailer.delivery_method = :letter_opener
config.after_initialize do config.after_initialize do

View File

@ -14,15 +14,9 @@ Rails.application.configure do
config.consider_all_requests_local = false config.consider_all_requests_local = false
config.action_controller.perform_caching = true config.action_controller.perform_caching = true
# Enable Rack::Cache to put a simple HTTP cache in front of your application
# Add `rack-cache` to your Gemfile before enabling this.
# For large-scale production use, consider using a caching reverse proxy like
# NGINX, varnish or squid.
# config.action_dispatch.rack_cache = true
# Disable serving static files from the `/public` folder by default since # Disable serving static files from the `/public` folder by default since
# Apache or NGINX already handles this. # Apache or NGINX already handles this.
config.serve_static_files = true config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
# Compress JavaScripts and CSS. # Compress JavaScripts and CSS.
config.assets.js_compressor = :uglifier config.assets.js_compressor = :uglifier
@ -31,10 +25,6 @@ Rails.application.configure do
# Do not fallback to assets pipeline if a precompiled asset is missed. # Do not fallback to assets pipeline if a precompiled asset is missed.
config.assets.compile = false config.assets.compile = false
# Asset digests allow you to set far-future HTTP expiration dates on all assets,
# yet still be able to expire them through the digest params.
config.assets.digest = true
# `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
# Specifies the header that your server uses for sending files. # Specifies the header that your server uses for sending files.
@ -49,7 +39,7 @@ Rails.application.configure do
config.log_level = :debug config.log_level = :debug
# Prepend all log lines with the following tags. # Prepend all log lines with the following tags.
# config.log_tags = [ :subdomain, :uuid ] config.log_tags = [ :request_id ]
# Use a different logger for distributed setups. # Use a different logger for distributed setups.
# config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new) # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
@ -77,6 +67,8 @@ Rails.application.configure do
# Do not dump schema after migrations. # Do not dump schema after migrations.
config.active_record.dump_schema_after_migration = false config.active_record.dump_schema_after_migration = false
config.action_mailer.perform_caching = false
# E-mails # E-mails
config.action_mailer.smtp_settings = { config.action_mailer.smtp_settings = {
:port => ENV['SMTP_PORT'], :port => ENV['SMTP_PORT'],

View File

@ -13,8 +13,10 @@ Rails.application.configure do
config.eager_load = false config.eager_load = false
# Configure static file server for tests with Cache-Control for performance. # Configure static file server for tests with Cache-Control for performance.
config.serve_static_files = true config.public_file_server.enabled = true
config.static_cache_control = 'public, max-age=3600' config.public_file_server.headers = {
'Cache-Control' => 'public, max-age=3600'
}
config.assets.digest = false config.assets.digest = false
# Show full error reports and disable caching. # Show full error reports and disable caching.
@ -31,9 +33,7 @@ Rails.application.configure do
# The :test delivery method accumulates sent emails in the # The :test delivery method accumulates sent emails in the
# ActionMailer::Base.deliveries array. # ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test config.action_mailer.delivery_method = :test
config.action_mailer.perform_caching = false
# Randomize the order test cases are executed.
config.active_support.test_order = :random
# Print deprecation notices to the stderr. # Print deprecation notices to the stderr.
config.active_support.deprecation = :stderr config.active_support.deprecation = :stderr

View File

@ -0,0 +1,6 @@
# Be sure to restart your server when you modify this file.
# ApplicationController.renderer.defaults.merge!(
# http_host: 'example.org',
# https: false
# )

View File

@ -1,3 +1,5 @@
# Be sure to restart your server when you modify this file. # Be sure to restart your server when you modify this file.
# Specify a serializer for the signed and encrypted cookie jars.
# Valid options are :json, :marshal, and :hybrid.
Rails.application.config.action_dispatch.cookies_serializer = :json Rails.application.config.action_dispatch.cookies_serializer = :json

View File

@ -0,0 +1,23 @@
# Be sure to restart your server when you modify this file.
#
# This file contains migration options to ease your Rails 5.0 upgrade.
#
# Once upgraded flip defaults one by one to migrate to the new default.
#
# Read the Rails 5.0 release notes for more info on each option.
# Enable per-form CSRF tokens. Previous versions had false.
Rails.application.config.action_controller.per_form_csrf_tokens = false
# Enable origin-checking CSRF mitigation. Previous versions had false.
Rails.application.config.action_controller.forgery_protection_origin_check = false
# Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
# Previous versions had false.
ActiveSupport.to_time_preserves_timezone = false
# Require `belongs_to` associations by default. Previous versions had false.
Rails.application.config.active_record.belongs_to_required_by_default = false
# Do not halt callback chains when a callback returns false. Previous versions had true.
ActiveSupport.halt_callback_chains_on_return_false = true

View File

@ -5,10 +5,10 @@
# Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
ActiveSupport.on_load(:action_controller) do ActiveSupport.on_load(:action_controller) do
wrap_parameters format: [:json] if respond_to?(:wrap_parameters) wrap_parameters format: [:json]
end end
# To enable root element in JSON for ActiveRecord objects. # To enable root element in JSON for ActiveRecord objects.
# ActiveSupport.on_load(:active_record) do # ActiveSupport.on_load(:active_record) do
# self.include_root_in_json = true # self.include_root_in_json = true
# end # end

View File

@ -1,13 +1,47 @@
workers Integer(ENV['WEB_CONCURRENCY'] || 2) # Puma can serve each request in a thread from an internal thread pool.
threads_count = Integer(ENV['MAX_THREADS'] || 5) # The `threads` method setting takes two numbers a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum, this matches the default thread size of Active Record.
#
threads_count = ENV.fetch("MAX_THREADS") { 5 }.to_i
threads threads_count, threads_count threads threads_count, threads_count
preload_app! # Specifies the `port` that Puma will listen on to receive requests, default is 3000.
#
port ENV.fetch("PORT") { 3000 }
rackup DefaultRackup # Specifies the `environment` that Puma will run in.
port ENV['PORT'] || 3000 #
environment ENV['RACK_ENV'] || 'development' environment ENV.fetch("RAILS_ENV") { "development" }
on_worker_boot do # Specifies the number of `workers` to boot in clustered mode.
ActiveRecord::Base.establish_connection # Workers are forked webserver processes. If using threads and workers together
end # the concurrency of the application would be max `threads` * `workers`.
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
workers ENV.fetch("WEB_CONCURRENCY") { 2 }
# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory. If you use this option
# you need to make sure to reconnect any threads in the `on_worker_boot`
# block.
#
# preload_app!
# The code in the `on_worker_boot` will be called if you are using
# clustered mode by specifying a number of `workers`. After each worker
# process is booted this block will be run, if you are using `preload_app!`
# option you will want to use this block to reconnect to any threads
# or connections that may have been created at application boot, Ruby
# cannot share connections between processes.
#
# on_worker_boot do
# ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
# end
# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart

View File

@ -5,7 +5,7 @@
# Make sure the secret is at least 30 characters and all random, # Make sure the secret is at least 30 characters and all random,
# no regular words or you'll be exposed to dictionary attacks. # no regular words or you'll be exposed to dictionary attacks.
# You can use `rake secret` to generate a secure secret key. # You can use `rails secret` to generate a secure secret key.
# Make sure the secrets in this file are kept private # Make sure the secrets in this file are kept private
# if you're sharing your code publicly. # if you're sharing your code publicly.

View File

@ -1,4 +1,3 @@
# encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead # This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to # of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition. # incrementally modify your database, and then regenerate this schema definition.
@ -41,37 +40,33 @@ ActiveRecord::Schema.define(version: 20160325130944) do
t.integer "header_file_size" t.integer "header_file_size"
t.datetime "header_updated_at" t.datetime "header_updated_at"
t.string "avatar_remote_url" t.string "avatar_remote_url"
t.index ["username", "domain"], name: "index_accounts_on_username_and_domain", unique: true, using: :btree
end end
add_index "accounts", ["username", "domain"], name: "index_accounts_on_username_and_domain", unique: true, using: :btree
create_table "favourites", force: :cascade do |t| create_table "favourites", force: :cascade do |t|
t.integer "account_id", null: false t.integer "account_id", null: false
t.integer "status_id", null: false t.integer "status_id", null: false
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["account_id", "status_id"], name: "index_favourites_on_account_id_and_status_id", unique: true, using: :btree
end end
add_index "favourites", ["account_id", "status_id"], name: "index_favourites_on_account_id_and_status_id", unique: true, using: :btree
create_table "follows", force: :cascade do |t| create_table "follows", force: :cascade do |t|
t.integer "account_id", null: false t.integer "account_id", null: false
t.integer "target_account_id", null: false t.integer "target_account_id", null: false
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["account_id", "target_account_id"], name: "index_follows_on_account_id_and_target_account_id", unique: true, using: :btree
end end
add_index "follows", ["account_id", "target_account_id"], name: "index_follows_on_account_id_and_target_account_id", unique: true, using: :btree
create_table "mentions", force: :cascade do |t| create_table "mentions", force: :cascade do |t|
t.integer "account_id" t.integer "account_id"
t.integer "status_id" t.integer "status_id"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["account_id", "status_id"], name: "index_mentions_on_account_id_and_status_id", unique: true, using: :btree
end end
add_index "mentions", ["account_id", "status_id"], name: "index_mentions_on_account_id_and_status_id", unique: true, using: :btree
create_table "oauth_access_grants", force: :cascade do |t| create_table "oauth_access_grants", force: :cascade do |t|
t.integer "resource_owner_id", null: false t.integer "resource_owner_id", null: false
t.integer "application_id", null: false t.integer "application_id", null: false
@ -81,10 +76,9 @@ ActiveRecord::Schema.define(version: 20160325130944) do
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "revoked_at" t.datetime "revoked_at"
t.string "scopes" t.string "scopes"
t.index ["token"], name: "index_oauth_access_grants_on_token", unique: true, using: :btree
end end
add_index "oauth_access_grants", ["token"], name: "index_oauth_access_grants_on_token", unique: true, using: :btree
create_table "oauth_access_tokens", force: :cascade do |t| create_table "oauth_access_tokens", force: :cascade do |t|
t.integer "resource_owner_id" t.integer "resource_owner_id"
t.integer "application_id" t.integer "application_id"
@ -94,12 +88,11 @@ ActiveRecord::Schema.define(version: 20160325130944) do
t.datetime "revoked_at" t.datetime "revoked_at"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.string "scopes" t.string "scopes"
t.index ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true, using: :btree
t.index ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id", using: :btree
t.index ["token"], name: "index_oauth_access_tokens_on_token", unique: true, using: :btree
end end
add_index "oauth_access_tokens", ["refresh_token"], name: "index_oauth_access_tokens_on_refresh_token", unique: true, using: :btree
add_index "oauth_access_tokens", ["resource_owner_id"], name: "index_oauth_access_tokens_on_resource_owner_id", using: :btree
add_index "oauth_access_tokens", ["token"], name: "index_oauth_access_tokens_on_token", unique: true, using: :btree
create_table "oauth_applications", force: :cascade do |t| create_table "oauth_applications", force: :cascade do |t|
t.string "name", null: false t.string "name", null: false
t.string "uid", null: false t.string "uid", null: false
@ -110,11 +103,10 @@ ActiveRecord::Schema.define(version: 20160325130944) do
t.datetime "updated_at" t.datetime "updated_at"
t.integer "owner_id" t.integer "owner_id"
t.string "owner_type" t.string "owner_type"
t.index ["owner_id", "owner_type"], name: "index_oauth_applications_on_owner_id_and_owner_type", using: :btree
t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true, using: :btree
end end
add_index "oauth_applications", ["owner_id", "owner_type"], name: "index_oauth_applications_on_owner_id_and_owner_type", using: :btree
add_index "oauth_applications", ["uid"], name: "index_oauth_applications_on_uid", unique: true, using: :btree
create_table "statuses", force: :cascade do |t| create_table "statuses", force: :cascade do |t|
t.string "uri" t.string "uri"
t.integer "account_id", null: false t.integer "account_id", null: false
@ -124,24 +116,22 @@ ActiveRecord::Schema.define(version: 20160325130944) do
t.integer "in_reply_to_id" t.integer "in_reply_to_id"
t.integer "reblog_of_id" t.integer "reblog_of_id"
t.string "url" t.string "url"
t.index ["account_id"], name: "index_statuses_on_account_id", using: :btree
t.index ["in_reply_to_id"], name: "index_statuses_on_in_reply_to_id", using: :btree
t.index ["reblog_of_id"], name: "index_statuses_on_reblog_of_id", using: :btree
t.index ["uri"], name: "index_statuses_on_uri", unique: true, using: :btree
end end
add_index "statuses", ["account_id"], name: "index_statuses_on_account_id", using: :btree
add_index "statuses", ["in_reply_to_id"], name: "index_statuses_on_in_reply_to_id", using: :btree
add_index "statuses", ["reblog_of_id"], name: "index_statuses_on_reblog_of_id", using: :btree
add_index "statuses", ["uri"], name: "index_statuses_on_uri", unique: true, using: :btree
create_table "stream_entries", force: :cascade do |t| create_table "stream_entries", force: :cascade do |t|
t.integer "account_id" t.integer "account_id"
t.integer "activity_id" t.integer "activity_id"
t.string "activity_type" t.string "activity_type"
t.datetime "created_at", null: false t.datetime "created_at", null: false
t.datetime "updated_at", null: false t.datetime "updated_at", null: false
t.index ["account_id"], name: "index_stream_entries_on_account_id", using: :btree
t.index ["activity_id", "activity_type"], name: "index_stream_entries_on_activity_id_and_activity_type", using: :btree
end end
add_index "stream_entries", ["account_id"], name: "index_stream_entries_on_account_id", using: :btree
add_index "stream_entries", ["activity_id", "activity_type"], name: "index_stream_entries_on_activity_id_and_activity_type", using: :btree
create_table "users", force: :cascade do |t| create_table "users", force: :cascade do |t|
t.string "email", default: "", null: false t.string "email", default: "", null: false
t.integer "account_id", null: false t.integer "account_id", null: false
@ -157,10 +147,9 @@ ActiveRecord::Schema.define(version: 20160325130944) do
t.inet "current_sign_in_ip" t.inet "current_sign_in_ip"
t.inet "last_sign_in_ip" t.inet "last_sign_in_ip"
t.boolean "admin", default: false t.boolean "admin", default: false
t.index ["account_id"], name: "index_users_on_account_id", using: :btree
t.index ["email"], name: "index_users_on_email", unique: true, using: :btree
t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
end end
add_index "users", ["account_id"], name: "index_users_on_account_id", using: :btree
add_index "users", ["email"], name: "index_users_on_email", unique: true, using: :btree
add_index "users", ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
end end

View File

@ -5,26 +5,26 @@ RSpec.describe AccountsController, type: :controller do
describe 'GET #show' do describe 'GET #show' do
it 'returns http success' do it 'returns http success' do
get :show, username: alice.username get :show, params: { username: alice.username }
expect(response).to have_http_status(:success) expect(response).to have_http_status(:success)
end end
it 'returns http success with Atom' do it 'returns http success with Atom' do
get :show, username: alice.username, format: 'atom' get :show, params: { username: alice.username }, format: 'atom'
expect(response).to have_http_status(:success) expect(response).to have_http_status(:success)
end end
end end
describe 'GET #followers' do describe 'GET #followers' do
it 'returns http success' do it 'returns http success' do
get :followers, username: alice.username get :followers, params: { username: alice.username }
expect(response).to have_http_status(:success) expect(response).to have_http_status(:success)
end end
end end
describe 'GET #following' do describe 'GET #following' do
it 'returns http success' do it 'returns http success' do
get :following, username: alice.username get :following, params: { username: alice.username }
expect(response).to have_http_status(:success) expect(response).to have_http_status(:success)
end end
end end

View File

@ -12,7 +12,7 @@ RSpec.describe Api::Accounts::LookupController, type: :controller do
before do before do
Fabricate(:account, username: 'bob') Fabricate(:account, username: 'bob')
Fabricate(:account, username: 'mcbeth') Fabricate(:account, username: 'mcbeth')
get :index, usernames: 'alice,bob,mcbeth' get :index, params: { usernames: 'alice,bob,mcbeth' }
end end
it 'returns http success' do it 'returns http success' do

View File

@ -10,28 +10,28 @@ RSpec.describe Api::AccountsController, type: :controller do
describe 'GET #show' do describe 'GET #show' do
it 'returns http success' do it 'returns http success' do
get :show, id: user.account.id get :show, params: { id: user.account.id }
expect(response).to have_http_status(:success) expect(response).to have_http_status(:success)
end end
end end
describe 'GET #statuses' do describe 'GET #statuses' do
it 'returns http success' do it 'returns http success' do
get :statuses, id: user.account.id get :statuses, params: { id: user.account.id }
expect(response).to have_http_status(:success) expect(response).to have_http_status(:success)
end end
end end
describe 'GET #followers' do describe 'GET #followers' do
it 'returns http success' do it 'returns http success' do
get :followers, id: user.account.id get :followers, params: { id: user.account.id }
expect(response).to have_http_status(:success) expect(response).to have_http_status(:success)
end end
end end
describe 'GET #following' do describe 'GET #following' do
it 'returns http success' do it 'returns http success' do
get :following, id: user.account.id get :following, params: { id: user.account.id }
expect(response).to have_http_status(:success) expect(response).to have_http_status(:success)
end end
end end
@ -40,7 +40,7 @@ RSpec.describe Api::AccountsController, type: :controller do
let(:other_account) { Fabricate(:account, username: 'bob') } let(:other_account) { Fabricate(:account, username: 'bob') }
before do before do
post :follow, id: other_account.id post :follow, params: { id: other_account.id }
end end
it 'returns http success' do it 'returns http success' do
@ -57,7 +57,7 @@ RSpec.describe Api::AccountsController, type: :controller do
before do before do
user.account.follow!(other_account) user.account.follow!(other_account)
post :unfollow, id: other_account.id post :unfollow, params: { id: other_account.id }
end end
it 'returns http success' do it 'returns http success' do

View File

@ -18,7 +18,7 @@ RSpec.describe Api::FollowsController, type: :controller do
stub_request(:post, "https://quitter.no/main/salmon/user/7477").to_return(:status => 200, :body => "", :headers => {}) stub_request(:post, "https://quitter.no/main/salmon/user/7477").to_return(:status => 200, :body => "", :headers => {})
stub_request(:post, "https://pubsubhubbub.superfeedr.com/").to_return(:status => 200, :body => "", :headers => {}) stub_request(:post, "https://pubsubhubbub.superfeedr.com/").to_return(:status => 200, :body => "", :headers => {})
post :create, uri: 'gargron@quitter.no' post :create, params: { uri: 'gargron@quitter.no' }
end end
it 'returns http success' do it 'returns http success' do

View File

@ -13,7 +13,7 @@ RSpec.describe Api::SalmonController, type: :controller do
describe 'POST #update' do describe 'POST #update' do
before do before do
request.env['RAW_POST_DATA'] = File.read(File.join(Rails.root, 'spec', 'fixtures', 'salmon', 'mention.xml')) request.env['RAW_POST_DATA'] = File.read(File.join(Rails.root, 'spec', 'fixtures', 'salmon', 'mention.xml'))
post :update, id: account.id post :update, params: { id: account.id }
end end
it 'returns http success' do it 'returns http success' do

View File

@ -12,7 +12,7 @@ RSpec.describe Api::StatusesController, type: :controller do
let(:status) { Fabricate(:status, account: user.account) } let(:status) { Fabricate(:status, account: user.account) }
it 'returns http success' do it 'returns http success' do
get :show, id: status.id get :show, params: { id: status.id }
expect(response).to have_http_status(:success) expect(response).to have_http_status(:success)
end end
end end

View File

@ -5,7 +5,7 @@ RSpec.describe Api::SubscriptionsController, type: :controller do
describe 'GET #show' do describe 'GET #show' do
before do before do
get :show, :id => account.id, 'hub.topic' => 'topic_url', 'hub.verify_token' => 123, 'hub.challenge' => '456' get :show, params: { :id => account.id, 'hub.topic' => 'topic_url', 'hub.verify_token' => 123, 'hub.challenge' => '456' }
end end
it 'returns http success' do it 'returns http success' do
@ -26,7 +26,7 @@ RSpec.describe Api::SubscriptionsController, type: :controller do
request.env['HTTP_X_HUB_SIGNATURE'] = "sha1=#{OpenSSL::HMAC.hexdigest('sha1', 'abc', feed)}" request.env['HTTP_X_HUB_SIGNATURE'] = "sha1=#{OpenSSL::HMAC.hexdigest('sha1', 'abc', feed)}"
request.env['RAW_POST_DATA'] = feed request.env['RAW_POST_DATA'] = feed
post :update, id: account.id post :update, params: { id: account.id }
end end
it 'returns http created' do it 'returns http created' do

View File

@ -17,7 +17,7 @@ RSpec.describe Auth::SessionsController, type: :controller do
before do before do
request.env["devise.mapping"] = Devise.mappings[:user] request.env["devise.mapping"] = Devise.mappings[:user]
post :create, user: { email: user.email, password: user.password } post :create, params: { user: { email: user.email, password: user.password } }
end end
it 'redirects to home page' do it 'redirects to home page' do

View File

@ -3,7 +3,7 @@ require 'rails_helper'
RSpec.describe SettingsController, type: :controller do RSpec.describe SettingsController, type: :controller do
before do before do
sign_in :user, Fabricate(:user) sign_in Fabricate(:user), scope: :user
end end
describe "GET #show" do describe "GET #show" do

View File

@ -4,13 +4,13 @@ RSpec.describe StatusesController, type: :controller do
let(:user) { Fabricate(:user) } let(:user) { Fabricate(:user) }
before do before do
sign_in :user, user sign_in user, scope: :user
end end
describe 'POST #create' do describe 'POST #create' do
before do before do
stub_request(:post, "https://pubsubhubbub.superfeedr.com/").to_return(:status => 200, :body => "", :headers => {}) stub_request(:post, "https://pubsubhubbub.superfeedr.com/").to_return(:status => 200, :body => "", :headers => {})
post :create, status: { text: 'Hello world' } post :create, params: { status: { text: 'Hello world' } }
end end
it 'redirects back to homepage' do it 'redirects back to homepage' do

View File

@ -6,12 +6,12 @@ RSpec.describe StreamEntriesController, type: :controller do
describe 'GET #show' do describe 'GET #show' do
it 'returns http success with HTML' do it 'returns http success with HTML' do
get :show, account_username: alice.username, id: status.stream_entry.id get :show, params: { account_username: alice.username, id: status.stream_entry.id }
expect(response).to have_http_status(:success) expect(response).to have_http_status(:success)
end end
it 'returns http success with Atom' do it 'returns http success with Atom' do
get :show, account_username: alice.username, id: status.stream_entry.id, format: 'atom' get :show, params: { account_username: alice.username, id: status.stream_entry.id }, format: 'atom'
expect(response).to have_http_status(:success) expect(response).to have_http_status(:success)
end end
end end

View File

@ -12,12 +12,12 @@ RSpec.describe XrdController, type: :controller do
let(:alice) { Fabricate(:account, username: 'alice') } let(:alice) { Fabricate(:account, username: 'alice') }
it 'returns http success when account can be found' do it 'returns http success when account can be found' do
get :webfinger, resource: "acct:#{alice.username}@anything.com" get :webfinger, params: { resource: "acct:#{alice.username}@anything.com" }
expect(response).to have_http_status(:success) expect(response).to have_http_status(:success)
end end
it 'returns http not found when account cannot be found' do it 'returns http not found when account cannot be found' do
get :webfinger, resource: 'acct:not@existing.com' get :webfinger, params: { resource: 'acct:not@existing.com' }
expect(response).to have_http_status(:not_found) expect(response).to have_http_status(:not_found)
end end
end end

View File

@ -1,3 +1,3 @@
Fabricator(:account) do Fabricator(:account) do
username "alice"
end end

View File

@ -17,7 +17,7 @@ RSpec.configure do |config|
config.infer_spec_type_from_file_location! config.infer_spec_type_from_file_location!
config.filter_rails_from_backtrace! config.filter_rails_from_backtrace!
config.include Devise::TestHelpers, type: :controller config.include Devise::Test::ControllerHelpers, type: :controller
config.include Devise::TestHelpers, type: :view config.include Devise::TestHelpers, type: :view
end end