Fix `has_reacted` and `is_subscribed` not being set
This commit is contained in:
parent
52e17d0f68
commit
539868173c
|
@ -44,9 +44,6 @@ class Ajax::AnswerController < AjaxController
|
|||
|
||||
return if inbox
|
||||
|
||||
# these assigns are needed because shared/_answerbox rely on them
|
||||
answer.has_reacted = false
|
||||
answer.is_subscribed = false
|
||||
@question = 1
|
||||
@response[:render] = render_to_string(partial: "answerbox", locals: { a: answer, show_question: false })
|
||||
end
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
class Answer < ApplicationRecord
|
||||
extend Answer::TimelineMethods
|
||||
|
||||
attr_accessor :has_reacted, :is_subscribed
|
||||
attr_writer :has_reacted, :is_subscribed
|
||||
|
||||
belongs_to :user, counter_cache: :answered_count
|
||||
belongs_to :question, counter_cache: :answer_count
|
||||
|
|
|
@ -122,7 +122,7 @@ class User < ApplicationRecord
|
|||
|
||||
Retrospring::Metrics::QUESTIONS_ANSWERED.increment
|
||||
|
||||
Answer.create!(content:, user: self, question:)
|
||||
Answer.create!(content:, user: self, question:, has_reacted: false, is_subscribed: true)
|
||||
end
|
||||
|
||||
# has the user answered +question+ yet?
|
||||
|
|
Loading…
Reference in New Issue