Rather than the answer node in isolation of the question.

This task likely involves updating the message template, changing the location of the permalink, and providing an upgrade path.

If we don't currently provide a permalink for answers when displayed on a Question page, we should add that here.

Comments

ezra-g’s picture

Component: Activity/status streams » Q+A (Commons Answers)
jpontani’s picture

Assigned: Unassigned » jpontani
jpontani’s picture

Assigned: jpontani » Unassigned
stupiddingo’s picture

Here's a hack to accomplish this for the time being. This is in no way meant as a real solution. I hope to revisit this and add some proper code once I grok all the parts. Leaving this here as a placemarker.

function mymodule_preprocess_page(&$vars, $hook) {
 if (isset($vars['node'])) {
  if ($vars['node']->type === 'answer' && !isset($vars['theme_hook_suggestions'][3])) {
   // Redirect to answer target on question page.
   drupal_goto('node/'. $vars['node']->field_related_question['und'][0]['target_id'], array('fragment' => 'node-'.$vars['node']->nid));
  }
 }
}
devin carlson’s picture

Assigned: Unassigned » devin carlson
Status: Active » Needs review
StatusFileSize
new9.32 KB

A patch to add a new message type which links to the answer node as displayed on the question. An update function is included to revert the appropriate parts of the Q+A feature.

ezra-g’s picture

Status: Needs review » Needs work

Thanks ! Looks great overall.

A few revisions:

A) The question answered anchor should use the nid of the newly created answer (accessible through field_target_nodes:0:nid or similar) rather than the nid of the question
B) Let's change the message test to add the phrase "with the answer". Eg, "Lisa Rex answered the question Where should we go to dinner? with the answer "Moes" in the Boston group"

devin carlson’s picture

Status: Needs work » Needs review
StatusFileSize
new10.67 KB

An updated patch to use the nid of the answer and the new phrasing.

I also noticed that the existing "Question Asked" message type includes some leftover formatting from a WYSIWYG editor (such as class="aloha-link-text" and encoded whitespace  ) which can be removed. I've included the removal the formatting in the patch.

ezra-g’s picture

StatusFileSize
new17.31 KB

This looks great from a technical perspective.

Uploading an example screenshot for a formatted message for design review.

Thanks!

Noyz’s picture

Don't think u need 'with the answer'. Instead... Site admin answered the question 'foo' with 'bar' in the Boston group

ezra-g’s picture

Status: Needs review » Needs work

Marking as "needs work" per #9.

devin carlson’s picture

Status: Needs work » Needs review
StatusFileSize
new10.62 KB
new18.25 KB

A reroll of #7 which uses the simplified text outlined in #9.

activity_stream_message.png

ezra-g’s picture

Status: Needs review » Reviewed & tested by the community

Looks great to me. Thanks!

devin carlson’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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