diff --git a/Gemfile b/Gemfile index 8d12733b45..8d626b9288 100644 --- a/Gemfile +++ b/Gemfile @@ -10,7 +10,7 @@ gem 'browser' gem 'coffee-rails' gem 'exception_notification' gem 'gon' -gem 'haml-rails', '~> 0.4.0' +gem 'haml-rails' gem 'httparty' gem "jquery-fileupload-rails" gem 'jquery-rails' @@ -20,7 +20,7 @@ gem 'nokogiri' gem 'pg' gem 'pg_search' gem 'protected_attributes' -gem 'rails', '4.0.13' +gem 'rails', '4.1.16' gem 'rack-pratchett' gem 'redis-rails' gem 'resque' @@ -33,7 +33,7 @@ gem 'select2-rails' gem 'test-unit', '~> 3.0' # required by Heroku for production console gem 'tinymce-rails' gem 'uglifier' -gem 'will_paginate', '~> 3.0.6' +gem 'will_paginate' group :production do gem 'puma' diff --git a/Gemfile.lock b/Gemfile.lock index 58524606ec..9d27338f67 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,52 +1,53 @@ GEM remote: https://rubygems.org/ specs: - actionmailer (4.0.13) - actionpack (= 4.0.13) + actionmailer (4.1.16) + actionpack (= 4.1.16) + actionview (= 4.1.16) mail (~> 2.5, >= 2.5.4) - actionpack (4.0.13) - activesupport (= 4.0.13) - builder (~> 3.1.0) - erubis (~> 2.7.0) + actionpack (4.1.16) + actionview (= 4.1.16) + activesupport (= 4.1.16) rack (~> 1.5.2) rack-test (~> 0.6.2) - activemodel (4.0.13) - activesupport (= 4.0.13) - builder (~> 3.1.0) - activerecord (4.0.13) - activemodel (= 4.0.13) - activerecord-deprecated_finders (~> 1.0.2) - activesupport (= 4.0.13) - arel (~> 4.0.0) - activerecord-deprecated_finders (1.0.4) - activesupport (4.0.13) + actionview (4.1.16) + activesupport (= 4.1.16) + builder (~> 3.1) + erubis (~> 2.7.0) + activemodel (4.1.16) + activesupport (= 4.1.16) + builder (~> 3.1) + activerecord (4.1.16) + activemodel (= 4.1.16) + activesupport (= 4.1.16) + arel (~> 5.0.0) + activesupport (4.1.16) i18n (~> 0.6, >= 0.6.9) - minitest (~> 4.2) - multi_json (~> 1.3) + json (~> 1.7, >= 1.7.7) + minitest (~> 5.1) thread_safe (~> 0.1) - tzinfo (~> 0.3.37) + tzinfo (~> 1.1) addressable (2.5.1) public_suffix (~> 2.0, >= 2.0.2) - api-pagination (4.5.2) - apipie-rails (0.4.0) - json - rails (>= 4.0) - arel (4.0.2) + api-pagination (4.6.1) + apipie-rails (0.5.1) + rails (>= 4.1) + arel (5.0.1.20140414130214) audited (4.2.2) rails-observers (~> 0.1.2) audited-activerecord (4.2.2) activerecord (~> 4.0) audited (= 4.2.2) - aws-sdk (2.9.21) - aws-sdk-resources (= 2.9.21) - aws-sdk-core (2.9.21) + aws-sdk (2.9.23) + aws-sdk-resources (= 2.9.23) + aws-sdk-core (2.9.23) aws-sigv4 (~> 1.0) jmespath (~> 1.0) - aws-sdk-resources (2.9.21) - aws-sdk-core (= 2.9.21) + aws-sdk-resources (2.9.23) + aws-sdk-core (= 2.9.23) aws-sigv4 (1.0.0) browser (2.4.0) - builder (3.1.4) + builder (3.2.3) byebug (9.0.6) capybara (2.14.0) addressable @@ -113,14 +114,21 @@ GEM json multi_json request_store (>= 1.0) - haml (4.0.7) + haml (5.0.1) + temple (>= 0.8.0) tilt - haml-rails (0.4) - actionpack (>= 3.1, < 4.1) - activesupport (>= 3.1, < 4.1) - haml (>= 3.1, < 4.1) - railties (>= 3.1, < 4.1) + haml-rails (1.0.0) + actionpack (>= 4.0.1) + activesupport (>= 4.0.1) + haml (>= 4.0.6, < 6.0) + html2haml (>= 1.0.1) + railties (>= 4.0.1) hashdiff (0.3.4) + html2haml (2.2.0) + erubis (~> 2.7.0) + haml (>= 4.0, < 6) + nokogiri (>= 1.6.0) + ruby_parser (~> 3.5) httparty (0.15.5) multi_xml (>= 0.5.2) i18n (0.8.1) @@ -146,7 +154,7 @@ GEM mime-types-data (~> 3.2015) mime-types-data (3.2016.0521) mini_portile2 (2.1.0) - minitest (4.7.5) + minitest (5.10.2) mono_logger (1.1.0) multi_json (1.12.1) multi_test (0.1.2) @@ -165,7 +173,7 @@ GEM activesupport (>= 3.1) arel power_assert (1.0.2) - protected_attributes (1.1.3) + protected_attributes (1.1.4) activemodel (>= 4.0.1, < 5.0) public_suffix (2.0.5) puma (3.8.2) @@ -177,13 +185,15 @@ GEM rack-test (0.6.3) rack (>= 1.0) rack-timeout (0.4.2) - rails (4.0.13) - actionmailer (= 4.0.13) - actionpack (= 4.0.13) - activerecord (= 4.0.13) - activesupport (= 4.0.13) + rails (4.1.16) + actionmailer (= 4.1.16) + actionpack (= 4.1.16) + actionview (= 4.1.16) + activemodel (= 4.1.16) + activerecord (= 4.1.16) + activesupport (= 4.1.16) bundler (>= 1.3.0, < 2.0) - railties (= 4.0.13) + railties (= 4.1.16) sprockets-rails (~> 2.0) rails-observers (0.1.2) activemodel (~> 4.0) @@ -192,9 +202,9 @@ GEM rails_stdout_logging rails_serve_static_assets (0.0.5) rails_stdout_logging (0.0.5) - railties (4.0.13) - actionpack (= 4.0.13) - activesupport (= 4.0.13) + railties (4.1.16) + actionpack (= 4.1.16) + activesupport (= 4.1.16) rake (>= 0.8.7) thor (>= 0.18.1, < 2.0) rake (10.4.2) @@ -262,7 +272,9 @@ GEM rspec-mocks (~> 3.6.0) rspec-support (~> 3.6.0) rspec-support (3.6.0) - rufus-scheduler (3.4.0) + ruby_parser (3.9.0) + sexp_processor (~> 4.1) + rufus-scheduler (3.4.2) et-orbi (~> 1.0) safe_yaml (1.0.4) sanitize (4.4.0) @@ -279,6 +291,7 @@ GEM seed_dump (0.5.3) select2-rails (4.0.3) thor (~> 0.14) + sexp_processor (4.9.0) simplecov (0.13.0) docile (~> 1.1.0) json (>= 1.8, < 3) @@ -295,7 +308,8 @@ GEM actionpack (>= 3.0) activesupport (>= 3.0) sprockets (>= 2.8, < 4.0) - test-unit (3.2.3) + temple (0.8.0) + test-unit (3.2.4) power_assert thin (1.7.0) daemons (~> 1.0, >= 1.0.9) @@ -305,7 +319,7 @@ GEM thread_safe (0.3.6) tilt (2.0.7) timecop (0.8.1) - tinymce-rails (4.6.1) + tinymce-rails (4.6.2) railties (>= 3.1.1) tunemygc (1.0.69) twitter-bootstrap-rails (3.2.2) @@ -313,7 +327,8 @@ GEM execjs (>= 2.2.2, >= 2.2) less-rails (>= 2.5.0) railties (>= 3.1) - tzinfo (0.3.53) + tzinfo (1.2.3) + thread_safe (~> 0.1) uglifier (3.2.0) execjs (>= 0.3.0, < 3) vegas (0.1.11) @@ -322,7 +337,7 @@ GEM addressable (>= 2.3.6) crack (>= 0.3.2) hashdiff - will_paginate (3.0.12) + will_paginate (3.1.5) xpath (2.0.0) nokogiri (~> 1.3) @@ -344,7 +359,7 @@ DEPENDENCIES exception_notification factory_girl_rails gon - haml-rails (~> 0.4.0) + haml-rails httparty jquery-fileupload-rails jquery-rails @@ -359,7 +374,7 @@ DEPENDENCIES rack-cors rack-pratchett rack-timeout - rails (= 4.0.13) + rails (= 4.1.16) rails_12factor rake (= 10.4.2) redis-rails @@ -381,7 +396,7 @@ DEPENDENCIES tunemygc uglifier webmock - will_paginate (~> 3.0.6) + will_paginate RUBY VERSION ruby 2.3.3p222 diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index ceeef90914..1f1a6826cf 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -107,7 +107,7 @@ def posts_from_relation(relation, no_tests=true, with_pagination=true) posts = posts.paginate(page: page, per_page: 25) if with_pagination posts = posts.no_tests if no_tests - if (with_pagination && posts.total_pages <= 1) || posts.count <= 25 + if (with_pagination && posts.total_pages <= 1) || posts.count(:all) <= 25 posts = posts.select {|post| post.visible_to?(current_user)} end diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index 0b10461a7e..0e3b443694 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -41,7 +41,7 @@ def unread def mark posts = Post.where(id: params[:marked_ids]) - posts.select! do |post| + posts = posts.select do |post| post.visible_to?(current_user) end if params[:commit] == "Mark Read" diff --git a/app/models/galleries_icon.rb b/app/models/galleries_icon.rb index dd22ceea09..ad4be7c212 100644 --- a/app/models/galleries_icon.rb +++ b/app/models/galleries_icon.rb @@ -3,8 +3,13 @@ class GalleriesIcon < ActiveRecord::Base belongs_to :gallery accepts_nested_attributes_for :icon, allow_destroy: true + after_create :set_has_gallery after_destroy :unset_has_gallery + def set_has_gallery + icon.update_attributes(has_gallery: true) + end + def unset_has_gallery return if icon.galleries.present? icon.update_attributes(has_gallery: false) diff --git a/app/models/gallery.rb b/app/models/gallery.rb index 2d61dc09bf..658ff7f5fa 100644 --- a/app/models/gallery.rb +++ b/app/models/gallery.rb @@ -1,8 +1,9 @@ class Gallery < ActiveRecord::Base belongs_to :user belongs_to :cover_icon, class_name: Icon + has_many :galleries_icons - has_and_belongs_to_many :icons, -> { order('LOWER(keyword)') }, after_add: :set_has_gallery, after_remove: :unset_has_gallery + has_many :icons, -> { order('LOWER(keyword)') }, through: :galleries_icons has_many :characters_galleries has_many :characters, through: :characters_galleries @@ -20,16 +21,4 @@ def default_icon def character_gallery_for(character) characters_galleries.where(character_id: character).first end - - private - - def set_has_gallery(icon) - return unless valid? # don't change icon status unless the gallery being saved is valid - icon.update_attributes(has_gallery: true) - end - - def unset_has_gallery(icon) - return if icon.galleries.present? - icon.update_attributes(has_gallery: false) - end end diff --git a/app/views/posts/_generate_flat.haml b/app/views/posts/_generate_flat.haml index 7fe43c7cf9..05f1ca93bb 100644 --- a/app/views/posts/_generate_flat.haml +++ b/app/views/posts/_generate_flat.haml @@ -1,4 +1,4 @@ -- 1.upto((replies.count / 250.0).ceil).each do |index| +- 1.upto((replies.count(:all) / 250.0).ceil).each do |index| - replies.paginate(per_page: 250, page: index).each do |reply| - klass = cycle('even'.freeze, 'odd'.freeze) .post-container{class: klass} diff --git a/config/initializers/cookies_serializer.rb b/config/initializers/cookies_serializer.rb index 7f70458dee..54516e3f23 100644 --- a/config/initializers/cookies_serializer.rb +++ b/config/initializers/cookies_serializer.rb @@ -1,3 +1,3 @@ # Be sure to restart your server when you modify this file. -Rails.application.config.action_dispatch.cookies_serializer = :json +Rails.application.config.action_dispatch.cookies_serializer = :hybrid