From b5347decb41a96e0131971af7ace7444b1c3c91e Mon Sep 17 00:00:00 2001 From: Andreas Nedbal Date: Sun, 22 Oct 2023 21:00:25 +0200 Subject: [PATCH] Fix rubocop nits --- app/components/application_component.rb | 7 ++----- app/components/question_component.rb | 3 +-- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/app/components/application_component.rb b/app/components/application_component.rb index d9b18556..0be055fa 100644 --- a/app/components/application_component.rb +++ b/app/components/application_component.rb @@ -2,9 +2,6 @@ class ApplicationComponent < ViewComponent::Base include ApplicationHelper - - def current_user = helpers.current_user - - def user_signed_in? = helpers.user_signed_in? - + delegate :current_user, to: :helpers + delegate :user_signed_in?, to: :helpers end diff --git a/app/components/question_component.rb b/app/components/question_component.rb index afebfdda..f14a1de3 100644 --- a/app/components/question_component.rb +++ b/app/components/question_component.rb @@ -17,8 +17,7 @@ class QuestionComponent < ApplicationComponent def author_identifier = @question.author_is_anonymous ? @question.author_identifier : nil - def follower_question? = !@question.author_is_anonymous && !@question.direct && @question.answer_count > 0 + def follower_question? = !@question.author_is_anonymous && !@question.direct && @question.answer_count.positive? def hide_avatar? = @hide_avatar || @question.author_is_anonymous - end