Fix new Rubocop violations (#10808)
* Fix new Rubocop violations * Use the latest minor version of 0.93
This commit is contained in:
parent
1ca6f56cce
commit
1f562783fc
9 changed files with 12 additions and 10 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# This configuration was generated by
|
||||
# `rubocop --auto-gen-config --no-auto-gen-timestamp`
|
||||
# using RuboCop version 0.92.0.
|
||||
# using RuboCop version 0.93.0.
|
||||
# The point is for the user to remove these configuration records
|
||||
# one by one as the offenses are removed from the code base.
|
||||
# Note that changes in the inspected code, or installation of new
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ class ModerationsController < ApplicationController
|
|||
@tag_moderator_tags = Tag.with_role(:tag_moderator, current_user)
|
||||
@adjustments = TagAdjustment.where(article_id: @moderatable.id)
|
||||
@already_adjusted_tags = @adjustments.map(&:tag_name).join(", ")
|
||||
@allowed_to_adjust = @moderatable.class.name == "Article" && (
|
||||
@allowed_to_adjust = @moderatable.instance_of?(Article) && (
|
||||
current_user.has_role?(:super_admin) || @tag_moderator_tags.any?)
|
||||
@hidden_comments = @moderatable.comments.where(hidden_by_commentable_user: true)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ class OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
|||
username: @user.username,
|
||||
user_id: @user.id,
|
||||
auth_data: request.env["omniauth.auth"],
|
||||
auth_error: request.env["omniauth.error"]&.inspect,
|
||||
auth_error: request.env["omniauth.error"].inspect,
|
||||
user_errors: user_errors
|
||||
})
|
||||
Honeybadger.notify("Omniauth log in error")
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class TagAdjustmentsController < ApplicationController
|
|||
@tag_moderator_tags = Tag.with_role(:tag_moderator, current_user)
|
||||
@adjustments = TagAdjustment.where(article_id: article.id)
|
||||
@already_adjusted_tags = @adjustments.map(&:tag_name).join(", ")
|
||||
@allowed_to_adjust = @moderatable.class.name == "Article" && (current_user.any_admin? || @tag_moderator_tags.any?)
|
||||
@allowed_to_adjust = @moderatable.instance_of?(Article) && (current_user.any_admin? || @tag_moderator_tags.any?)
|
||||
respond_to do |format|
|
||||
format.json { render json: { error: "Failure: #{tag_adjustment.errors.full_messages.to_sentence}" } }
|
||||
format.html { render template: "moderations/mod" }
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ class GeneratedImage
|
|||
def social_image
|
||||
if resource.class.name.include?("Article")
|
||||
article_image
|
||||
elsif resource.class.name == "User"
|
||||
elsif resource.instance_of?(User)
|
||||
optimize_image "/user/#{resource.id}?bust=#{resource.profile_image_url}"
|
||||
elsif resource.class.name == "Organization"
|
||||
elsif resource.instance_of?(Organization)
|
||||
optimize_image "/organization/#{resource.id}?bust=#{resource.profile_image_url}"
|
||||
elsif resource.class.name.include?("Tag")
|
||||
optimize_image "/tag/#{@resource.id}?bust=#{@resource.pretty_name}"
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class Follow < ApplicationRecord
|
|||
end
|
||||
|
||||
def send_email_notification
|
||||
return unless followable.class.name == "User" && followable.email?
|
||||
return unless followable.instance_of?(User) && followable.email?
|
||||
|
||||
Follows::SendEmailNotificationWorker.perform_async(id)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class Reaction < ApplicationRecord
|
|||
end
|
||||
|
||||
def cached_any_reactions_for?(reactable, user, category)
|
||||
class_name = reactable.class.name == "ArticleDecorator" ? "Article" : reactable.class.name
|
||||
class_name = reactable.instance_of?(ArticleDecorator) ? "Article" : reactable.class.name
|
||||
cache_name = "any_reactions_for-#{class_name}-#{reactable.id}-" \
|
||||
"#{user.reactions_count}-#{user.public_reactions_count}-#{category}"
|
||||
Rails.cache.fetch(cache_name, expires_in: 24.hours) do
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ xml.rss version: "2.0" do
|
|||
articles.each do |article|
|
||||
xml.item do
|
||||
xml.title article.title
|
||||
xml.author(user && user.class.name == "User" ? user.name : article.user.name)
|
||||
xml.author(user.instance_of?(User) ? user.name : article.user.name)
|
||||
xml.pubDate article.published_at.to_s(:rfc822) if article.published_at
|
||||
xml.link app_url(article.path)
|
||||
xml.guid app_url(article.path)
|
||||
|
|
|
|||
|
|
@ -779,7 +779,9 @@ RSpec.describe Article, type: :model do
|
|||
describe "spam" do
|
||||
before do
|
||||
allow(SiteConfig).to receive(:mascot_user_id).and_return(user.id)
|
||||
allow(SiteConfig).to receive(:spam_trigger_terms).and_return(["yahoomagoo gogo", "testtestetest", "magoo.+magee"])
|
||||
allow(SiteConfig).to receive(:spam_trigger_terms).and_return(
|
||||
["yahoomagoo gogo", "testtestetest", "magoo.+magee"],
|
||||
)
|
||||
end
|
||||
|
||||
it "creates vomit reaction if possible spam" do
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue