From 9b597486798d40c6b016f6cbae4a3183893b66ee Mon Sep 17 00:00:00 2001 From: Claire Date: Sun, 7 May 2023 15:06:15 +0200 Subject: [PATCH] Fix rubocop warnings (#2206) --- .rubocop_todo.yml | 3 +++ app/services/post_status_service.rb | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 26c89ca780..9deba6642a 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -225,6 +225,8 @@ Lint/Void: # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes. Metrics/AbcSize: Max: 150 + Exclude: + - 'app/serializers/initial_state_serializer.rb' # Configuration parameters: CountBlocks, Max. Metrics/BlockNesting: @@ -247,6 +249,7 @@ Metrics/ModuleLength: - 'app/helpers/jsonld_helper.rb' - 'app/models/concerns/account_interactions.rb' - 'app/models/concerns/has_user_settings.rb' + - 'lib/sanitize_ext/sanitize_config.rb' # Configuration parameters: Max, CountKeywordArgs, MaxOptionalParameters. Metrics/ParameterLists: diff --git a/app/services/post_status_service.rb b/app/services/post_status_service.rb index 74ec47a33b..8f5f91ec78 100644 --- a/app/services/post_status_service.rb +++ b/app/services/post_status_service.rb @@ -64,14 +64,16 @@ class PostStatusService < BaseService 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 = '.' + @text = begin + if @media&.any?(&:video?) || @media&.any?(&:gifv?) + '📹' + elsif @media&.any?(&:audio?) + '🎵' + elsif @media&.any?(&:image?) + '🖼' + else + '.' + end end end