summaryrefslogtreecommitdiff
path: root/plugins/Realtime/RealtimePlugin.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2010-08-03 16:04:54 -0700
committerEvan Prodromou <evan@status.net>2010-08-03 16:04:54 -0700
commit004e42e3e0606f0f9e5c8b6cd4512e5d870cd56e (patch)
treeab895f7609c8afeeadf3439c860b69d0cffcbb5e /plugins/Realtime/RealtimePlugin.php
parentd2234580357349a6887a2321e69d11de7bb29106 (diff)
parentfdd9aa58e3caf87096e1c1dcfa8b2f286b04e4b1 (diff)
Merge remote branch 'gitorious/1.0.x' into 1.0.x
Diffstat (limited to 'plugins/Realtime/RealtimePlugin.php')
-rw-r--r--plugins/Realtime/RealtimePlugin.php42
1 files changed, 30 insertions, 12 deletions
diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php
index b559d80c6..352afcf78 100644
--- a/plugins/Realtime/RealtimePlugin.php
+++ b/plugins/Realtime/RealtimePlugin.php
@@ -250,14 +250,7 @@ class RealtimePlugin extends Plugin
$arr['url'] = $notice->bestUrl();
$arr['html'] = htmlspecialchars($notice->rendered);
$arr['source'] = htmlspecialchars($arr['source']);
-
- if (!empty($notice->reply_to)) {
- $reply_to = Notice::staticGet('id', $notice->reply_to);
- if (!empty($reply_to)) {
- $arr['in_reply_to_status_url'] = $reply_to->bestUrl();
- }
- $reply_to = null;
- }
+ $arr['conversation_url'] = $this->getConversationUrl($notice);
$profile = $notice->getProfile();
$arr['user']['profile_url'] = $profile->profileurl;
@@ -272,10 +265,7 @@ class RealtimePlugin extends Plugin
$arr['retweeted_status']['source'] = htmlspecialchars($original->source);
$originalProfile = $original->getProfile();
$arr['retweeted_status']['user']['profile_url'] = $originalProfile->profileurl;
- if (!empty($original->reply_to)) {
- $originalReply = Notice::staticGet('id', $original->reply_to);
- $arr['retweeted_status']['in_reply_to_status_url'] = $originalReply->bestUrl();
- }
+ $arr['retweeted_status']['conversation_url'] = $this->getConversationUrl($original);
}
$original = null;
}
@@ -303,6 +293,34 @@ class RealtimePlugin extends Plugin
return $tags;
}
+ function getConversationUrl($notice)
+ {
+ $convurl = null;
+
+ if ($notice->hasConversation()) {
+ $conv = Conversation::staticGet(
+ 'id',
+ $notice->conversation
+ );
+ $convurl = $conv->uri;
+
+ if(empty($convurl)) {
+ $msg = sprintf(
+ "Couldn't find Conversation ID %d to make 'in context'"
+ . "link for Notice ID %d",
+ $notice->conversation,
+ $notice->id
+ );
+
+ common_log(LOG_WARNING, $msg);
+ } else {
+ $convurl .= '#notice-' . $notice->id;
+ }
+ }
+
+ return $convurl;
+ }
+
function _getScripts()
{
return array('plugins/Realtime/realtimeupdate.js');