From 20c4f4cfc48df90645ef0b01d64b1324a59dd564 Mon Sep 17 00:00:00 2001 From: Luke Barratt Date: Sat, 10 May 2014 02:26:18 +0100 Subject: [PATCH] Bump to Rails 3.2.18 Reduce aggressive topic reply/view count caching Improve shout box spacing Pass broken tests --- Gemfile | 2 +- Gemfile.lock | 107 ++++++++---------- .../stylesheets/components/_shoutbox.scss | 20 ++-- app/models/topic.rb | 4 +- app/views/shoutmsgs/_shoutmsg.html.erb | 8 +- config/application.rb | 3 + .../users/case_insensitive_login_spec.rb | 8 +- spec/features/users/user_signs_up_spec.rb | 2 +- 8 files changed, 80 insertions(+), 74 deletions(-) diff --git a/Gemfile b/Gemfile index 91caf20..565cbfd 100644 --- a/Gemfile +++ b/Gemfile @@ -3,7 +3,7 @@ source 'http://rubygems.org' ruby '2.1.1' gem 'dotenv-rails', '~> 0.10.0' -gem 'rails', '~> 3.2.17' +gem 'rails', '~> 3.2.18' gem 'mysql2', '~> 0.3.15' gem 'dalli', '~> 2.7.0' gem 'puma', '~> 2.8.2' diff --git a/Gemfile.lock b/Gemfile.lock index 39f6e75..960f152 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,12 +1,12 @@ GEM remote: http://rubygems.org/ specs: - actionmailer (3.2.17) - actionpack (= 3.2.17) + actionmailer (3.2.18) + actionpack (= 3.2.18) mail (~> 2.5.4) - actionpack (3.2.17) - activemodel (= 3.2.17) - activesupport (= 3.2.17) + actionpack (3.2.18) + activemodel (= 3.2.18) + activesupport (= 3.2.18) builder (~> 3.0.0) erubis (~> 2.7.0) journey (~> 1.0.4) @@ -16,21 +16,21 @@ GEM sprockets (~> 2.2.1) active_link_to (1.0.2) actionpack - activemodel (3.2.17) - activesupport (= 3.2.17) + activemodel (3.2.18) + activesupport (= 3.2.18) builder (~> 3.0.0) - activerecord (3.2.17) - activemodel (= 3.2.17) - activesupport (= 3.2.17) + activerecord (3.2.18) + activemodel (= 3.2.18) + activesupport (= 3.2.18) arel (~> 3.0.2) tzinfo (~> 0.3.29) - activeresource (3.2.17) - activemodel (= 3.2.17) - activesupport (= 3.2.17) - activesupport (3.2.17) + activeresource (3.2.18) + activemodel (= 3.2.18) + activesupport (= 3.2.18) + activesupport (3.2.18) i18n (~> 0.6, >= 0.6.4) multi_json (~> 1.0) - annotate (2.6.2) + annotate (2.6.3) activerecord (>= 2.3.0) rake (>= 0.8.7) arel (3.0.3) @@ -69,7 +69,7 @@ GEM activesupport (>= 3.2.0) json (>= 1.7) mime-types (>= 1.16) - childprocess (0.5.2) + childprocess (0.5.3) ffi (~> 1.0, >= 1.0.11) cliver (0.3.2) codeclimate-test-reporter (0.3.0) @@ -81,11 +81,11 @@ GEM coffee-script (2.2.0) coffee-script-source execjs - coffee-script-source (1.3.3) - columnize (0.3.6) + coffee-script-source (1.7.0) + columnize (0.8.9) country_code_select (1.0.1) activesupport (>= 3.0) - dalli (2.7.0) + dalli (2.7.1) database_cleaner (1.2.0) debug_inspector (0.0.2) debugger (1.6.6) @@ -93,7 +93,7 @@ GEM debugger-linecache (~> 1.2.0) debugger-ruby_core_source (~> 1.3.2) debugger-linecache (1.2.0) - debugger-ruby_core_source (1.3.2) + debugger-ruby_core_source (1.3.4) diff-lcs (1.2.5) dotenv (0.10.0) dotenv-rails (0.10.0) @@ -102,8 +102,7 @@ GEM erubis (2.7.0) exceptional (2.0.33) rack - execjs (1.4.0) - multi_json (~> 1.0) + execjs (2.0.2) factory_girl (4.4.0) activesupport (>= 3.0.0) factory_girl_rails (4.4.1) @@ -112,15 +111,14 @@ GEM faraday (0.9.0) multipart-post (>= 1.2, < 3) ffi (1.9.3) - ffi (1.9.3-x86-mingw32) font-awesome-sass (4.0.3.1) sass (~> 3.2) - gruff (0.3.6) + gruff (0.3.7) hike (1.2.3) i18n (0.6.9) journey (1.0.4) - jquery-rails (2.0.2) - railties (>= 3.2.0, < 5.0) + jquery-rails (2.0.3) + railties (>= 3.1.0, < 5.0) thor (~> 0.14) json (1.8.1) libv8 (3.16.14.3) @@ -130,20 +128,18 @@ GEM method_source (0.8.2) mime-types (1.25.1) mini_portile (0.5.3) - multi_json (1.8.4) + multi_json (1.10.0) multipart-post (2.0.0) mysql2 (0.3.15) neat (1.6.0) bourbon (>= 3.1) sass (>= 3.3) - net-scp (1.1.2) + net-scp (1.2.1) net-ssh (>= 2.6.5) - net-ssh (2.8.0) + net-ssh (2.9.0) newrelic_rpm (3.7.2.195) nokogiri (1.6.1) mini_portile (~> 0.5.0) - nokogiri (1.6.1-x86-mingw32) - mini_portile (~> 0.5.0) oj (2.5.5) poltergeist (1.5.0) capybara (~> 2.1) @@ -155,11 +151,6 @@ GEM coderay (~> 1.0) method_source (~> 0.8) slop (~> 3.4) - pry (0.9.12.6-x86-mingw32) - coderay (~> 1.0) - method_source (~> 0.8) - slop (~> 3.4) - win32console (~> 1.3) pry-debugger (0.2.2) debugger (~> 1.3) pry (~> 0.9.10) @@ -170,26 +161,26 @@ GEM rack (1.4.5) rack-cache (1.2) rack (>= 0.4) - rack-ssl (1.3.3) + rack-ssl (1.3.4) rack rack-test (0.6.2) rack (>= 1.0) - rails (3.2.17) - actionmailer (= 3.2.17) - actionpack (= 3.2.17) - activerecord (= 3.2.17) - activeresource (= 3.2.17) - activesupport (= 3.2.17) + rails (3.2.18) + actionmailer (= 3.2.18) + actionpack (= 3.2.18) + activerecord (= 3.2.18) + activeresource (= 3.2.18) + activesupport (= 3.2.18) bundler (~> 1.0) - railties (= 3.2.17) - railties (3.2.17) - actionpack (= 3.2.17) - activesupport (= 3.2.17) + railties (= 3.2.18) + railties (3.2.18) + actionpack (= 3.2.18) + activesupport (= 3.2.18) rack-ssl (~> 1.3.2) rake (>= 0.8.7) rdoc (~> 3.4) thor (>= 0.14.6, < 2.0) - rake (10.1.1) + rake (10.3.1) rdoc (3.12.2) json (~> 1.4) ref (1.0.5) @@ -198,7 +189,7 @@ GEM rspec-expectations (2.14.5) diff-lcs (>= 1.1.3, < 2.0) rspec-mocks (2.14.6) - rspec-rails (2.14.1) + rspec-rails (2.14.2) actionpack (>= 3.0) activemodel (>= 3.0) activesupport (>= 3.0) @@ -206,10 +197,10 @@ GEM rspec-core (~> 2.14.0) rspec-expectations (~> 2.14.0) rspec-mocks (~> 2.14.0) - rubyzip (1.1.2) + rubyzip (1.1.3) sanitize (2.1.0) nokogiri (>= 1.4.4) - sass (3.3.4) + sass (3.3.7) sass-rails (3.2.6) railties (~> 3.2.0) sass (>= 3.1.10) @@ -229,9 +220,9 @@ GEM multi_json (~> 1.0) rack (~> 1.0) tilt (~> 1.1, != 1.3.0) - sshkit (1.3.0) + sshkit (1.4.0) net-scp (>= 1.1.2) - net-ssh + net-ssh (>= 2.8.0) term-ansicolor term-ansicolor (1.3.0) tins (~> 1.0) @@ -241,26 +232,24 @@ GEM thor (0.19.1) tilt (1.4.1) timecop (0.7.1) - tins (1.0.1) + tins (1.1.0) tinymce-rails (3.5.9) railties (>= 3.1.1) treetop (1.4.15) polyglot polyglot (>= 0.3.1) - tzinfo (0.3.38) + tzinfo (0.3.39) uglifier (2.5.0) execjs (>= 0.3.0) json (>= 1.8.0) websocket (1.0.7) - websocket-driver (0.3.2) + websocket-driver (0.3.3) will_paginate (3.0.5) - win32console (1.3.2-x86-mingw32) xpath (2.0.0) nokogiri (~> 1.3) PLATFORMS ruby - x86-mingw32 DEPENDENCIES active_link_to (~> 1.0.2) @@ -298,7 +287,7 @@ DEPENDENCIES pry-debugger (~> 0.2.2) puma (~> 2.8.2) quiet_assets (~> 1.0.2) - rails (~> 3.2.17) + rails (~> 3.2.18) rmagick (~> 2.13.2) rspec-rails (~> 2.14.1) sanitize (~> 2.1.0) diff --git a/app/assets/stylesheets/components/_shoutbox.scss b/app/assets/stylesheets/components/_shoutbox.scss index c36cd33..6d62865 100644 --- a/app/assets/stylesheets/components/_shoutbox.scss +++ b/app/assets/stylesheets/components/_shoutbox.scss @@ -2,9 +2,13 @@ Shoutbox Messages */ +#shoutbox { + display: table; +} + .shoutmsg { + display: table-row; margin-bottom: 5px; - display: block; clear: both; .timestamp { @@ -12,12 +16,8 @@ } .user { - float: left; - padding: 0 5px 5px 0; - - .delete { - float: left; - } + display: table-cell; + min-width: 30%; .username { clear: right; @@ -30,4 +30,10 @@ color: #5a5a5a; } } + + .message { + max-width: 66%; + display: table-cell; + padding-left: 10px; + } } diff --git a/app/models/topic.rb b/app/models/topic.rb index b13001f..d57af77 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -65,13 +65,13 @@ class Topic < ActiveRecord::Base end def cached_view_count - Rails.cache.fetch(cache_key('view_count'), expires_in: 24.hours) do + Rails.cache.fetch(cache_key('view_count'), expires_in: 1.hours) do view_count end end def cached_posts_count - Rails.cache.fetch(cache_key('posts'), expires_in: 12.hours) do + Rails.cache.fetch(cache_key('posts'), expires_in: 10.minutes) do posts.count - 1 end end diff --git a/app/views/shoutmsgs/_shoutmsg.html.erb b/app/views/shoutmsgs/_shoutmsg.html.erb index ee41bd4..297f828 100644 --- a/app/views/shoutmsgs/_shoutmsg.html.erb +++ b/app/views/shoutmsgs/_shoutmsg.html.erb @@ -1,12 +1,16 @@
+ <% if shoutmsg.can_destroy? cuser %> + <%= link_to icon('times'), shoutmsg, method: :delete %> + <% end %> <%= namelink shoutmsg.user %> <%= shoutmsg.created_at ? shoutmsg.created_at.strftime("%H:%M") : Time.now.strftime("%H:%M") %>
- - <%= shoutmsg.text %> +
+ <%= shoutmsg.text %> +
diff --git a/config/application.rb b/config/application.rb index 40a9a44..8f8caf2 100644 --- a/config/application.rb +++ b/config/application.rb @@ -8,6 +8,9 @@ module Ensl # Custom error pages config.exceptions_app = self.routes + # Additional assets + config.assets.precompile += %w{errors.css} + # Custom directories with classes and modules you want to be autoloadable. config.autoload_paths += Dir["#{config.root}/app/services/**/", "#{config.root}/app/models/concerns/"] diff --git a/spec/features/users/case_insensitive_login_spec.rb b/spec/features/users/case_insensitive_login_spec.rb index 388a3e3..60806ae 100644 --- a/spec/features/users/case_insensitive_login_spec.rb +++ b/spec/features/users/case_insensitive_login_spec.rb @@ -17,7 +17,7 @@ feature 'Case insensitive login' do expect(page).to have_content(I18n.t('login_successful')) within user_status do - expect(page).to have_content(username) + expect(page).to have_content(account_link) end end @@ -28,7 +28,7 @@ feature 'Case insensitive login' do expect(page).to have_content(I18n.t('login_successful')) within user_status do - expect(page).to have_content(username) + expect(page).to have_content(account_link) end end end @@ -37,4 +37,8 @@ feature 'Case insensitive login' do fill_in "login_username", with: username fill_in "login_password", with: password end + + def account_link + 'ACCOUNT' + end end diff --git a/spec/features/users/user_signs_up_spec.rb b/spec/features/users/user_signs_up_spec.rb index 88d2eab..e871888 100644 --- a/spec/features/users/user_signs_up_spec.rb +++ b/spec/features/users/user_signs_up_spec.rb @@ -13,7 +13,7 @@ feature 'Visitor signs up' do click_button submit(:user, :create) end - expect(user_status).to have_content(user[:username]) + expect(user_status).to have_content('ACCOUNT') end scenario 'with invalid Email' do