From ec0280bcdea1836b04b97f68a4914162f07c74cc Mon Sep 17 00:00:00 2001 From: r888888888 Date: Wed, 26 Feb 2014 13:16:34 -0800 Subject: [PATCH 1/5] upgrade to ruby 2.0.0 --- .rbenv-version | 2 +- Gemfile | 5 +++-- app/models/upload.rb | 4 ++-- config/application.rb | 2 ++ 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.rbenv-version b/.rbenv-version index 546d4d8a9..5d0b60ca6 100644 --- a/.rbenv-version +++ b/.rbenv-version @@ -1 +1 @@ -1.9.3-p327 \ No newline at end of file +2.0.0-p451 \ No newline at end of file diff --git a/Gemfile b/Gemfile index d1e76aad5..606e60ba4 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,6 @@ group :test do gem "mocha", :require => "mocha/setup" gem "ffaker" gem "simplecov", :require => false - gem "pry" gem "vcr" gem "webmock" gem "timecop" @@ -49,6 +48,8 @@ end group :development do gem 'ruby-prof' - gem 'pry' end +group :development, :test do + gem 'pry' +end \ No newline at end of file diff --git a/app/models/upload.rb b/app/models/upload.rb index 2ac39c06d..e1db311cf 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -204,13 +204,13 @@ class Upload < ActiveRecord::Base def file_header_to_content_type(source_path) case File.read(source_path, 10) - when /^\xff\xd8/ + when /^\xff\xd8/n "image/jpeg" when /^GIF87a/, /^GIF89a/ "image/gif" - when /^\x89PNG\r\n\x1a\n/ + when /^\x89PNG\r\n\x1a\n/n "image/png" when /^CWS/, /^FWS/, /^ZWS/ diff --git a/config/application.rb b/config/application.rb index 7cb210549..dab89ed4e 100644 --- a/config/application.rb +++ b/config/application.rb @@ -24,4 +24,6 @@ module Danbooru config.action_mailer.perform_deliveries = true config.log_tags = [lambda {|req| "PID:#{Process.pid}"}] end + + I18n.enforce_available_locales = false end From c23ac6b69f5b228c372fb1db6d3eda668acd8a03 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Wed, 26 Feb 2014 15:03:51 -0800 Subject: [PATCH 2/5] update ruby version --- .rbenv-version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.rbenv-version b/.rbenv-version index 5d0b60ca6..7c3272873 100644 --- a/.rbenv-version +++ b/.rbenv-version @@ -1 +1 @@ -2.0.0-p451 \ No newline at end of file +2.1.1 \ No newline at end of file From 99e7e5c0c2461933bbcfe98a5afc4767d41f0d59 Mon Sep 17 00:00:00 2001 From: Toks Date: Wed, 26 Feb 2014 00:19:19 -0500 Subject: [PATCH 3/5] Display tag sub update info on delayed jobs page --- app/helpers/delayed_jobs_helper.rb | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/helpers/delayed_jobs_helper.rb b/app/helpers/delayed_jobs_helper.rb index 382f37e28..63292372b 100644 --- a/app/helpers/delayed_jobs_helper.rb +++ b/app/helpers/delayed_jobs_helper.rb @@ -25,6 +25,9 @@ module DelayedJobsHelper when "Tag#update_category_post_counts" "update category post counts" + when "Class#process" + "update tag subscription" + else h(job.name) end @@ -56,6 +59,9 @@ module DelayedJobsHelper when "Tag#update_category_post_counts" h(job.payload_object.name) + when "Class#process" + h(job.payload_object.args.flatten.join(" ")) + else h(job.handler) end From 4b56f4d91bff36031032762a2e431b4b925a7d88 Mon Sep 17 00:00:00 2001 From: r888888888 Date: Thu, 27 Feb 2014 13:41:36 -0800 Subject: [PATCH 4/5] fixes #530 --- app/assets/javascripts/comments.js | 13 ++++++++++++- app/logical/d_text.rb | 22 ++++++++++++++++++++++ app/models/forum_post.rb | 2 +- app/models/post.rb | 2 +- 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/comments.js b/app/assets/javascripts/comments.js index de354e25e..0b2366d07 100644 --- a/app/assets/javascripts/comments.js +++ b/app/assets/javascripts/comments.js @@ -19,7 +19,18 @@ } Danbooru.Comment.quote_message = function(data) { - var stripped_body = data["body"].replace(/\[quote\](?:.|\n|\r)+?\[\/quote\](?:\r\n|\r|\n)*/gm, ""); + var blocks = data["body"].match(/\[\/?quote\]|./gm); + var n = 0; + var stripped_body = ""; + $.each(blocks, function(i, block) { + if (block === "[quote]") { + n += 1; + } else if (block == "[/quote]") { + n -= 1; + } else if (n === 0) { + stripped_body += block; + } + }); return "[quote]\n" + data["creator_name"] + " said:\n\n" + stripped_body + "\n[/quote]\n\n"; } diff --git a/app/logical/d_text.rb b/app/logical/d_text.rb index 0123c3791..b1cb7a5bc 100644 --- a/app/logical/d_text.rb +++ b/app/logical/d_text.rb @@ -10,6 +10,28 @@ class DText CGI.escapeHTML(string) end + def self.strip_blocks(string, tag) + blocks = string.scan(/\[\/?#{tag}\]|.+?(?=\[\/?#{tag}\]|$)/m) + n = 0 + stripped = "" + blocks.each do |block| + case block + when "[#{tag}]" + n += 1 + + when "[/#{tag}]" + n -= 1 + + else + if n == 0 + stripped += block + end + end + end + + stripped.strip + end + def self.parse_inline(str, options = {}) str.gsub!(/&/, "&") str.gsub!(/ Date: Thu, 27 Feb 2014 14:52:30 -0800 Subject: [PATCH 5/5] fixes #1124 --- app/views/tag_aliases/new.html.erb | 3 +++ app/views/tag_implications/new.html.erb | 3 +++ 2 files changed, 6 insertions(+) diff --git a/app/views/tag_aliases/new.html.erb b/app/views/tag_aliases/new.html.erb index e72e8fb9e..7c48afc0a 100644 --- a/app/views/tag_aliases/new.html.erb +++ b/app/views/tag_aliases/new.html.erb @@ -1,6 +1,9 @@

New Tag Alias

+ + <%= error_messages_for :tag_alias %> + <%= simple_form_for(@tag_alias) do |f| %> <%= f.input :status, :value => "pending", :as => :hidden %> <%= f.input :antecedent_name, :as => :string, :label => "From" %> diff --git a/app/views/tag_implications/new.html.erb b/app/views/tag_implications/new.html.erb index 67c4f6d92..5e4d1952e 100644 --- a/app/views/tag_implications/new.html.erb +++ b/app/views/tag_implications/new.html.erb @@ -1,6 +1,9 @@

New Tag Implication

+ + <%= error_messages_for :tag_implication %> + <%= simple_form_for(@tag_implication) do |f| %> <%= f.input :status, :value => "pending", :as => :hidden %> <%= f.input :antecedent_name, :label => "From" %>