Merge pull request #1529 from Retrospring/fix/has-reacted

This commit is contained in:
Karina J. Kwiatek 2023-12-19 22:52:19 +00:00 committed by GitHub
commit 727b82daf5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 5 deletions

View File

@ -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

View File

@ -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

View File

@ -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?