about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorJenkins <jenkins@jenkins.ninjawedding.org>2018-03-09 00:17:17 +0000
committerJenkins <jenkins@jenkins.ninjawedding.org>2018-03-09 00:17:17 +0000
commit447d7e612753d69f043e08ebb228b21e411c8b4a (patch)
tree80caebcff2b131898f620f89ad0858d44530d30f /lib
parent43a9a781a443a6b9296431fbcc4285b3ca6a1a57 (diff)
parentff44b2e92d496c6027b20157fea6ebd885906bea (diff)
Merge remote-tracking branch 'tootsuite/master' into glitchsoc/master
Diffstat (limited to 'lib')
-rw-r--r--lib/mastodon/version.rb2
-rw-r--r--lib/paperclip/lazy_thumbnail.rb4
-rw-r--r--lib/tasks/assets.rake6
-rw-r--r--lib/tasks/mastodon.rake8
4 files changed, 11 insertions, 9 deletions
diff --git a/lib/mastodon/version.rb b/lib/mastodon/version.rb
index 4150b39b6..9155702ac 100644
--- a/lib/mastodon/version.rb
+++ b/lib/mastodon/version.rb
@@ -21,7 +21,7 @@ module Mastodon
     end
 
     def flags
-      'rc1'
+      'rc3'
     end
 
     def to_a
diff --git a/lib/paperclip/lazy_thumbnail.rb b/lib/paperclip/lazy_thumbnail.rb
index 42f9a557a..aafa21343 100644
--- a/lib/paperclip/lazy_thumbnail.rb
+++ b/lib/paperclip/lazy_thumbnail.rb
@@ -4,6 +4,10 @@ module Paperclip
   class LazyThumbnail < Paperclip::Thumbnail
     def make
       return File.open(@file.path) unless needs_convert?
+
+      min_side = [@current_geometry.width, @current_geometry.height].min
+      options[:geometry] = "#{min_side.to_i}x#{min_side.to_i}#" if @target_geometry.square? && min_side < @target_geometry.width
+
       Paperclip::Thumbnail.make(file, options, attachment)
     end
 
diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake
index 0826f0186..b642510a1 100644
--- a/lib/tasks/assets.rake
+++ b/lib/tasks/assets.rake
@@ -1,10 +1,8 @@
 # frozen_string_literal: true
 
 def render_static_page(action, dest:, **opts)
-  I18n.with_locale(ENV['DEFAULT_LOCALE'] || I18n.default_locale) do
-    html = ApplicationController.render(action, opts)
-    File.write(dest, html)
-  end
+  html = ApplicationController.render(action, opts)
+  File.write(dest, html)
 end
 
 namespace :assets do
diff --git a/lib/tasks/mastodon.rake b/lib/tasks/mastodon.rake
index 9202b4839..0b011bf57 100644
--- a/lib/tasks/mastodon.rake
+++ b/lib/tasks/mastodon.rake
@@ -476,10 +476,10 @@ namespace :mastodon do
       time_ago = ENV.fetch('NUM_DAYS') { 7 }.to_i.days.ago
 
       MediaAttachment.where.not(remote_url: '').where.not(file_file_name: nil).where('created_at < ?', time_ago).find_each do |media|
-        if media.file.exists?
-          media.file.destroy
-          media.save
-        end
+        next unless media.file.exists?
+
+        media.file.destroy
+        media.save
       end
     end