Pull conversation URL from Conversation instead of assuming it's local

This commit is contained in:
Zach Copley 2010-02-26 14:47:38 -08:00
parent dced92d6fd
commit d3fc8e2219

View File

@ -541,18 +541,39 @@ class NoticeListItem extends Widget
{ {
$hasConversation = false; $hasConversation = false;
if (!empty($this->notice->conversation)) { if (!empty($this->notice->conversation)) {
$conversation = Notice::conversationStream($this->notice->conversation, 1, 1); $conversation = Notice::conversationStream(
$this->notice->conversation,
1,
1
);
if ($conversation->N > 0) { if ($conversation->N > 0) {
$hasConversation = true; $hasConversation = true;
} }
} }
if ($hasConversation) { if ($hasConversation) {
$this->out->text(' '); $conv = Conversation::staticGet(
$convurl = common_local_url('conversation', 'id',
array('id' => $this->notice->conversation)); $this->notice->conversation
$this->out->element('a', array('href' => $convurl.'#notice-'.$this->notice->id, );
'class' => 'response'), $convurl = $conv->uri;
_('in context')); if (!empty($convurl)) {
$this->out->text(' ');
$this->out->element(
'a',
array(
'href' => $convurl.'#notice-'.$this->notice->id,
'class' => 'response'),
_('in context')
);
} else {
$msg = sprintf(
"Couldn't find Conversation ID %d to make 'in context'"
. "link for Notice ID %d",
$this->notice->conversation,
$this->notice->id
);
common_log(LOG_WARNING, $msg);
}
} }
} }