diff --git a/app/models/group.rb b/app/models/group.rb index 6f34d571ed7..a9027401da7 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -980,15 +980,19 @@ class Group < ActiveRecord::Base end def flair_type - return :icon if flair_icon.present? - return :image if flair_upload.present? + if flair_icon.present? + :icon + elsif flair_upload.present? + :image + end end def flair_url - return flair_icon if flair_type == :icon - return upload_cdn_path(flair_upload.url) if flair_type == :image - - nil + if flair_type == :icon + flair_icon + elsif flair_type == :image + upload_cdn_path(flair_upload.url) + end end %i[muted regular tracking watching watching_first_post].each do |level| diff --git a/app/models/user.rb b/app/models/user.rb index 997d64e48ca..30fffc2770e 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1251,7 +1251,7 @@ class User < ActiveRecord::Base end def full_suspend_reason - return suspend_record.try(:details) if suspended? + suspend_record.try(:details) if suspended? end def suspend_reason diff --git a/lib/external_upload_helpers.rb b/lib/external_upload_helpers.rb index 81cdfa5d91d..d1f9660b7a3 100644 --- a/lib/external_upload_helpers.rb +++ b/lib/external_upload_helpers.rb @@ -363,11 +363,11 @@ module ExternalUploadHelpers end def external_store_check - return render_404 if !Discourse.store.external? + render_404 if !Discourse.store.external? end def direct_s3_uploads_check - return render_404 if !SiteSetting.enable_direct_s3_uploads + render_404 if !SiteSetting.enable_direct_s3_uploads end def can_upload_external? diff --git a/lib/guardian.rb b/lib/guardian.rb index cfc9e345490..8e3add75cb2 100644 --- a/lib/guardian.rb +++ b/lib/guardian.rb @@ -646,7 +646,7 @@ class Guardian def method_name_for(action, obj) method_name = :"can_#{action}_#{obj.class.name.underscore}?" - return method_name if respond_to?(method_name) + method_name if respond_to?(method_name) end def can_do?(action, obj) diff --git a/lib/onebox/engine/allowlisted_generic_onebox.rb b/lib/onebox/engine/allowlisted_generic_onebox.rb index 8120c4ce877..9f30d923de9 100644 --- a/lib/onebox/engine/allowlisted_generic_onebox.rb +++ b/lib/onebox/engine/allowlisted_generic_onebox.rb @@ -191,7 +191,8 @@ module Onebox return image_html if is_image? return embedded_html if is_embedded? return card_html if is_card? - return article_html if (has_text? || is_image_article?) + + article_html if (has_text? || is_image_article?) end def is_card? diff --git a/lib/pretty_text.rb b/lib/pretty_text.rb index 12289d2a1b6..7ac60602a7c 100644 --- a/lib/pretty_text.rb +++ b/lib/pretty_text.rb @@ -41,7 +41,7 @@ module PrettyText return erb_name if File.file?("#{root}#{erb_name}") erb_name = "#{filename}.js.erb" - return erb_name if File.file?("#{root}#{erb_name}") + erb_name if File.file?("#{root}#{erb_name}") end def self.apply_es6_file(ctx, root_path, part_name) diff --git a/lib/quote_comparer.rb b/lib/quote_comparer.rb index 55b7a8ceab2..c5e67f4d462 100644 --- a/lib/quote_comparer.rb +++ b/lib/quote_comparer.rb @@ -16,7 +16,7 @@ class QuoteComparer # philosophy of "catch the obvious cases, leave moderation for the # complicated ones" def missing? - return true if @parent_post.blank? + @parent_post.blank? end def modified? diff --git a/lib/tasks/typepad.thor b/lib/tasks/typepad.thor index bbef98037e6..4341fb04dc8 100644 --- a/lib/tasks/typepad.thor +++ b/lib/tasks/typepad.thor @@ -138,7 +138,7 @@ class Typepad < Thor type = clean_type!(Regexp.last_match[1]) value = section.split("\n")[1..-1].join("\n") value.strip! - return [type.to_sym, value] if value.present? + [type.to_sym, value] if value.present? end end diff --git a/script/import_scripts/socialcast/create_title.rb b/script/import_scripts/socialcast/create_title.rb index ea656fadb7e..5ed6e6259fc 100644 --- a/script/import_scripts/socialcast/create_title.rb +++ b/script/import_scripts/socialcast/create_title.rb @@ -17,7 +17,7 @@ class CreateTitle title = complete_words title end - return title unless title.nil? || title.size < 20 + title unless title.nil? || title.size < 20 end private diff --git a/spec/lib/quote_comparer_spec.rb b/spec/lib/quote_comparer_spec.rb index ebc74d8d022..6f32ef7f3a7 100644 --- a/spec/lib/quote_comparer_spec.rb +++ b/spec/lib/quote_comparer_spec.rb @@ -18,12 +18,12 @@ RSpec.describe QuoteComparer do expect(QuoteComparer.new(post.topic_id, nil, "test")).to be_missing end - it "returns a falsey value for only missing text" do - expect(QuoteComparer.new(post.topic_id, post.post_number, nil).missing?).to be(nil) + it "returns false for only missing text" do + expect(QuoteComparer.new(post.topic_id, post.post_number, nil)).to_not be_missing end - it "returns a falsey value for no missing topic and post" do - expect(QuoteComparer.new(post.topic_id, post.post_number, "test").missing?).to be(nil) + it "returns false for no missing topic and post" do + expect(QuoteComparer.new(post.topic_id, post.post_number, "test")).to_not be_missing end end