2023-10-20 15:25:08 -07:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class QuestionComponent < ApplicationComponent
|
|
|
|
include ApplicationHelper
|
|
|
|
include BootstrapHelper
|
|
|
|
include UserHelper
|
|
|
|
|
|
|
|
def initialize(question:, context_user: nil, collapse: true, hide_avatar: false, profile_question: false)
|
|
|
|
@question = question
|
|
|
|
@context_user = context_user
|
2023-10-22 08:42:56 -07:00
|
|
|
@collapse = collapse
|
2023-10-20 15:25:08 -07:00
|
|
|
@hide_avatar = hide_avatar
|
|
|
|
@profile_question = profile_question
|
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
|
|
|
def author_identifier = @question.author_is_anonymous ? @question.author_identifier : nil
|
|
|
|
|
2023-10-22 12:00:25 -07:00
|
|
|
def follower_question? = !@question.author_is_anonymous && !@question.direct && @question.answer_count.positive?
|
2023-10-20 15:25:08 -07:00
|
|
|
|
|
|
|
def hide_avatar? = @hide_avatar || @question.author_is_anonymous
|
|
|
|
end
|