diff --git a/plugins/Realtime/RealtimePlugin.php b/plugins/Realtime/RealtimePlugin.php index d57438de2c..a810b71653 100644 --- a/plugins/Realtime/RealtimePlugin.php +++ b/plugins/Realtime/RealtimePlugin.php @@ -267,6 +267,24 @@ class RealtimePlugin extends Plugin $profile = $notice->getProfile(); $arr['user']['profile_url'] = $profile->profileurl; + // Add needed repeat data + + if (!empty($notice->repeat_of)) { + $original = Notice::staticGet('id', $notice->repeat_of); + if (!empty($original)) { + $arr['retweeted_status']['url'] = $original->bestUrl(); + $arr['retweeted_status']['html'] = htmlspecialchars($original->rendered); + $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(); + } + } + $original = null; + } + return $arr; } diff --git a/plugins/Realtime/realtimeupdate.js b/plugins/Realtime/realtimeupdate.js index 2844aa5804..18f00f22a9 100644 --- a/plugins/Realtime/realtimeupdate.js +++ b/plugins/Realtime/realtimeupdate.js @@ -116,11 +116,24 @@ RealtimeUpdate = { makeNoticeItem: function(data) { + if (data.hasOwnProperty('retweeted_status')) { + original = data['retweeted_status']; + repeat = data; + data = original; + unique = repeat['id']; + responsible = repeat['user']; + } else { + original = null; + repeat = null; + unique = data['id']; + responsible = data['user']; + } + user = data['user']; html = data['html'].replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"'); source = data['source'].replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"'); - ni = "