mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-28 01:56:01 -05:00
TRIVIAL: code formatting
This commit is contained in:
parent
6907739a0b
commit
c0cd109e9d
4 changed files with 8 additions and 5 deletions
|
@ -48,9 +48,7 @@ class UserAvatarsController < ApplicationController
|
||||||
return render_dot unless user = User.find_by(username_lower: username.downcase)
|
return render_dot unless user = User.find_by(username_lower: username.downcase)
|
||||||
|
|
||||||
size = params[:size].to_i
|
size = params[:size].to_i
|
||||||
if size > 1000 || size < 1
|
return render_dot if size > 1000 || size < 1
|
||||||
return render_dot
|
|
||||||
end
|
|
||||||
|
|
||||||
image = nil
|
image = nil
|
||||||
version = params[:version].to_i
|
version = params[:version].to_i
|
||||||
|
|
|
@ -603,7 +603,7 @@ class User < ActiveRecord::Base
|
||||||
gravatar_downloaded = avatar.gravatar_upload_id
|
gravatar_downloaded = avatar.gravatar_upload_id
|
||||||
end
|
end
|
||||||
|
|
||||||
if (!self.uploaded_avatar_id && gravatar_downloaded)
|
if !self.uploaded_avatar_id && gravatar_downloaded
|
||||||
self.update_column(:uploaded_avatar_id, avatar.gravatar_upload_id)
|
self.update_column(:uploaded_avatar_id, avatar.gravatar_upload_id)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ class UserAvatar < ActiveRecord::Base
|
||||||
# skip saving, we are not connected to the net
|
# skip saving, we are not connected to the net
|
||||||
Rails.logger.warn "Failed to download gravatar, socket error - user id #{ user.id }"
|
Rails.logger.warn "Failed to download gravatar, socket error - user id #{ user.id }"
|
||||||
ensure
|
ensure
|
||||||
tempfile.unlink if tempfile
|
tempfile.close! if tempfile && tempfile.respond_to?(:close!)
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,19 +1,23 @@
|
||||||
desc "Refresh all avatars (download missing gravatars, refresh system)"
|
desc "Refresh all avatars (download missing gravatars, refresh system)"
|
||||||
task "avatars:refresh" => :environment do
|
task "avatars:refresh" => :environment do
|
||||||
i = 0
|
i = 0
|
||||||
|
|
||||||
puts "Refreshing avatars"
|
puts "Refreshing avatars"
|
||||||
puts
|
puts
|
||||||
|
|
||||||
User.find_each do |user|
|
User.find_each do |user|
|
||||||
user.refresh_avatar
|
user.refresh_avatar
|
||||||
user.user_avatar.update_gravatar!
|
user.user_avatar.update_gravatar!
|
||||||
putc "." if (i += 1) % 10 == 0
|
putc "." if (i += 1) % 10 == 0
|
||||||
end
|
end
|
||||||
|
|
||||||
puts
|
puts
|
||||||
end
|
end
|
||||||
|
|
||||||
desc "Clean up all avatar thumbnails (use this when the thumbnail algorithm changes)"
|
desc "Clean up all avatar thumbnails (use this when the thumbnail algorithm changes)"
|
||||||
task "avatars:clean" => :environment do
|
task "avatars:clean" => :environment do
|
||||||
i = 0
|
i = 0
|
||||||
|
|
||||||
puts "Cleaning up avatar thumbnails"
|
puts "Cleaning up avatar thumbnails"
|
||||||
puts
|
puts
|
||||||
|
|
||||||
|
@ -24,5 +28,6 @@ task "avatars:clean" => :environment do
|
||||||
optimized_image.destroy!
|
optimized_image.destroy!
|
||||||
putc "." if (i += 1) % 10 == 0
|
putc "." if (i += 1) % 10 == 0
|
||||||
end
|
end
|
||||||
|
|
||||||
puts
|
puts
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue