Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

Bug: When we hide selected answer, selected class is applied on question list.

+3 votes
690 views
asked Sep 29, 2014 in Q2A Core by sama55
edited Sep 29, 2014 by sama55

When we hide selected answer, selected class (qa-a-count-selected) is applied on question list.

Solution example in view layer:

qa-include/qa-theme-base.php (L1587) *Recommended*

//@$post['answer_selected'] ? 'qa-a-count-selected' : (@$post['answers_raw'] ? null : 'qa-a-count-zero'));
@$post['acount'] && @$post['answer_selected'] ? 'qa-a-count-selected' : (@$post['answers_raw'] ? null : 'qa-a-count-zero'));

Solution example in application layer:

qa-include/qa-app-format.php (L325)

//$fields['answer_selected']=isset($post['selchildid']);
if($post['acount']==0)
  $fields['answer_selected']=false;
else
  $fields['answer_selected']=isset($post['selchildid']);
Is that we must consider (question page) when $post['acount'] does not exist ...?
commented Sep 29, 2014 by maxjtechno
Fyi, I think there is a relation with this issue :
https://github.com/q2a/question2answer/issues/79
commented Sep 29, 2014 by sama55
edited Sep 29, 2014 by sama55
Thanks max.
Because there is reshow feature, I think Scott thought is right.
https://github.com/q2a/question2answer/issues/79
=== quotation [start] ===
I think the solution, at least for now, is to keep hidden answers selected but not make the box green when the selected answer is hidden. From the outside, it appears there is no selected answer. If User B hides then reshows their answer it's still selected, as A intended.
=== quotation [end] ===

Please log in or register to answer this question.

...