The original functionality of the 'answer' button is to provide an anchor link down to the answer form. But what if you are not logged in, or if you don't have access to post an answer? We should not be displaying the answer button.

Also, if you are logged in, but no one has answered the question, the answer form will be at the top. Its not intuitive to someone not familiar to commons to know that the answer button means (show me this answer form)

Comments

WebSinPat’s picture

I agree. Ran into the 2nd issue mentioned and felt it was confusing to have a button to click "answer" right above the answer form that I would be filling out if I wanted to provide an answer.

ezra-g’s picture

Issue summary:View changes
Issue tags:+commons 7.x-3.9 radar

Hopefully we can triage this in Commons 3.9. Thank for the bug report and feedback, japerry & WebSinPat!

japerry’s picture

Status:Active» Needs review
StatusFileSize
new2.99 KB

Here is a patch that cleans up that link a little and adds node_access. In theory, anon users could still answer the question, but only if a site owner allowed anonymous users to post answer content (not default, and definitely not recommended!)

japerry’s picture

StatusFileSize
new8.52 KB

This patch is a little more indepth with the button and answer text.

WebSinPat’s picture

Patch in #4 is looking good so far.

However it doesnt seem to address the 2nd issue in the OP that the Answer button appears even when there are no answer yet and it's right on top of the answer form itself. Think we need a check to see if any answers already exist in commons_q_a_node_view, before displaying the answer link.

<?php
 
function commons_q_a_node_view($node, $view_mode) {
   if (
$node->type == 'question' && $view_mode == 'full') {
    
// Remove add comment link.
    
unset($node->content['links']['comment']);
    
// Add the answer link below.
    
if (commons_q_a_check_answer_access($node)) {
// ADD A CHECK HERE TO SEE IF THIS QUESTION HAS BEEN ANSWERED ALREADY
// BEFORE DISPLAYING THE ANSWER LINK
?>

Also, perchance is this a good time for a fresh request to have the answer link and answer summary info appear in the browsing-widget when viewing the teaser for a question?

japerry’s picture

Status:Needs review» Fixed

After looking at the display, I don't think we need to worry about the second use case here. Committing the changes we have and we'll probably re-visit this if we start re-designing the Q/A module.

Fixed here! http://drupalcode.org/project/commons.git/commit/71cf918

Status:Fixed» Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.