$flink->update();
}
- function saveStatus($status, $flink)
+ function saveStatus($status, $flink=null)
{
$profile = $this->ensureProfile($status->user);
if (empty($profile)) {
common_log(LOG_ERR, $this->name() .
' - Problem saving notice. No associated Profile.');
- return;
+ return null;
}
$statusUri = $this->makeStatusURI($status->user->screen_name, $status->id);
$this->name() .
" - Ignoring duplicate import: $statusUri"
);
- return;
+ return $dupe;
+ }
+
+ // If it's a retweet, save it as a repeat!
+
+ if (!empty($status->retweeted_status)) {
+ $original = $this->saveStatus($status->retweeted_status);
+ return $original->repeat($profile->id, 'twitter');
}
$notice = new Notice();
Event::handle('EndNoticeSave', array($notice));
}
- Inbox::insertNotice($flink->user_id, $notice->id);
+ if (!empty($flink)) {
+ Inbox::insertNotice($flink->user_id, $notice->id);
+ }
$notice->blowOnInsert();
return $notice;