Show answers with attachments in additional info

We weren't showing the details of answers without a description, even if
they had images, videos or documents. Some users found that behavior
unexpected since the description isn't a mandatory field and so they
left it blank, but they added images to that answer and they didn't
appear on the poll page.

Note we had a condition not to show the title of an answer when it had
no description. I think that condition was redundant because answers
without a description weren't loaded in the first place. Anyway, that
condition doesn't make sense anymore because we're displaying answers
with images but no description.
This commit is contained in:
Javi Martín
2021-09-05 02:14:22 +02:00
parent 25465e71ea
commit 6d26ce57cb
6 changed files with 67 additions and 4 deletions

View File

@@ -22,7 +22,7 @@ class PollsController < ApplicationController
@questions = @poll.questions.for_render.sort_for_list
@token = poll_voter_token(@poll, current_user)
@poll_questions_answers = Poll::Question::Answer.where(question: @poll.questions)
.where.not(description: "").order(:given_order)
.with_content.order(:given_order)
@answers_by_question_id = {}
poll_answers = ::Poll::Answer.by_question(@poll.question_ids).by_author(current_user&.id)