Fix most rubocop issues (#2165)

* Run rubocop --autocorrect on app/, config/ and lib/, also manually fix some remaining style issues

* Run rubocop --autocorrect-all on db/

* Run rubocop --autocorrect-all on `spec/` and fix remaining issues
This commit is contained in:
Claire
2023-04-09 11:25:30 +02:00
committed by GitHub
parent 29a91b871e
commit ff168ef202
45 changed files with 211 additions and 216 deletions
+15 -10
View File
@@ -61,17 +61,22 @@ class PostStatusService < BaseService
private
def preprocess_attributes!
if @text.blank? && @options[:spoiler_text].present?
@text = '.'
if @media&.find(&:video?) || @media&.find(&:gifv?)
@text = '📹'
elsif @media&.find(&:audio?)
@text = '🎵'
elsif @media&.find(&:image?)
@text = '🖼'
end
def fill_blank_text!
return unless @text.blank? && @options[:spoiler_text].present?
if @media&.any?(&:video?) || @media&.any?(&:gifv?)
@text = '📹'
elsif @media&.any?(&:audio?)
@text = '🎵'
elsif @media&.any?(&:image?)
@text = '🖼'
else
@text = '.'
end
end
def preprocess_attributes!
fill_blank_text!
@sensitive = (@options[:sensitive].nil? ? @account.user&.setting_default_sensitive : @options[:sensitive]) || @options[:spoiler_text].present?
@visibility = @options[:visibility] || @account.user&.setting_default_privacy
@visibility = :unlisted if @visibility&.to_sym == :public && @account.silenced?