rubocop: fix various style issues.

This commit is contained in:
evazion
2019-12-22 16:21:58 -06:00
parent 09f6a84660
commit 309821bf73
288 changed files with 912 additions and 962 deletions

View File

@@ -31,7 +31,7 @@ class FavoriteGroup < ApplicationRecord
where("name ilike ? escape E'\\\\'", name.to_escaped_for_sql_like)
end
def hide_private(user,params)
def hide_private(user, params)
if user.hide_favorites?
where("is_public = true")
elsif params[:is_public].present?
@@ -51,14 +51,14 @@ class FavoriteGroup < ApplicationRecord
if params[:creator_id].present?
user = User.find(params[:creator_id])
q = q.hide_private(user,params)
q = q.hide_private(user, params)
q = q.where("creator_id = ?", user.id)
elsif params[:creator_name].present?
user = User.find_by_name(params[:creator_name])
q = q.hide_private(user,params)
q = q.hide_private(user, params)
q = q.where("creator_id = ?", user.id)
else
q = q.hide_private(CurrentUser.user,params)
q = q.hide_private(CurrentUser.user, params)
q = q.where("creator_id = ?", CurrentUser.user.id)
end
@@ -130,13 +130,11 @@ class FavoriteGroup < ApplicationRecord
offset = options[:offset] || 0
limit = options[:limit] || Danbooru.config.posts_per_page
slice = post_id_array.slice(offset, limit)
if slice && slice.any?
if slice&.any?
slice.map do |id|
begin
Post.find(id)
rescue ActiveRecord::RecordNotFound
# swallow
end
Post.find(id)
rescue ActiveRecord::RecordNotFound
# swallow
end.compact
else
[]