// Add to inbox timelines
// XXX: do a join
- $inbox = new Notice_inbox();
- $inbox->notice_id = $notice->id;
+ $ni = $notice->whoGets();
- if ($inbox->find()) {
- while ($inbox->fetch()) {
- $user = User::staticGet('id', $inbox->user_id);
- $paths[] = array('all', $user->nickname);
- }
+ foreach (array_keys($ni) as $user_id) {
+ $user = User::staticGet('id', $user_id);
+ $paths[] = array('all', $user->nickname);
}
// Add to the replies timeline
// of refactoring from within a plugin, so I'm just abusing
// the ApiAction method. Don't do this unless you're me!
- require_once(INSTALLDIR.'/lib/api.php');
-
$act = new ApiAction('/dev/null');
$arr = $act->twitterStatusArray($notice, true);
$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;
}
function _getScripts()
{
- return array('plugins/Realtime/realtimeupdate.js',
- 'plugins/Realtime/json2.js');
+ return array(common_path('plugins/Realtime/realtimeupdate.js'));
}
function _updateInitialize($timeline, $user_id)