Make imported Twitter notices show up via real time plugins.
This commit is contained in:
parent
2c07d4a530
commit
cff12603cf
@ -127,7 +127,12 @@ class TwitterBridgePlugin extends Plugin
|
|||||||
*/
|
*/
|
||||||
function onStartEnqueueNotice($notice, &$transports)
|
function onStartEnqueueNotice($notice, &$transports)
|
||||||
{
|
{
|
||||||
array_push($transports, 'twitter');
|
// Avoid a possible loop
|
||||||
|
|
||||||
|
if ($notice->source != 'twitter') {
|
||||||
|
array_push($transports, 'twitter');
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,7 +209,11 @@ class TwitterStatusFetcher extends ParallelizingDaemon
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->saveStatus($status, $flink);
|
$notice = null;
|
||||||
|
|
||||||
|
$notice = $this->saveStatus($status, $flink);
|
||||||
|
|
||||||
|
common_broadcast_notice($notice);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Okay, record the time we synced with Twitter for posterity
|
// Okay, record the time we synced with Twitter for posterity
|
||||||
@ -235,12 +239,14 @@ class TwitterStatusFetcher extends ParallelizingDaemon
|
|||||||
$uri = 'http://twitter.com/' . $status->user->screen_name .
|
$uri = 'http://twitter.com/' . $status->user->screen_name .
|
||||||
'/status/' . $status->id;
|
'/status/' . $status->id;
|
||||||
|
|
||||||
$notice = Notice::staticGet('uri', $uri);
|
|
||||||
|
|
||||||
// check to see if we've already imported the status
|
// check to see if we've already imported the status
|
||||||
|
|
||||||
|
$notice = Notice::staticGet('uri', $uri);
|
||||||
|
|
||||||
if (empty($notice)) {
|
if (empty($notice)) {
|
||||||
|
|
||||||
|
// XXX: transaction here?
|
||||||
|
|
||||||
$notice = new Notice();
|
$notice = new Notice();
|
||||||
|
|
||||||
$notice->profile_id = $id;
|
$notice->profile_id = $id;
|
||||||
@ -257,6 +263,7 @@ class TwitterStatusFetcher extends ParallelizingDaemon
|
|||||||
$id = $notice->insert();
|
$id = $notice->insert();
|
||||||
Event::handle('EndNoticeSave', array($notice));
|
Event::handle('EndNoticeSave', array($notice));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Notice_inbox::pkeyGet(array('notice_id' => $notice->id,
|
if (!Notice_inbox::pkeyGet(array('notice_id' => $notice->id,
|
||||||
@ -270,7 +277,12 @@ class TwitterStatusFetcher extends ParallelizingDaemon
|
|||||||
$inbox->source = NOTICE_INBOX_SOURCE_GATEWAY; // From a private source
|
$inbox->source = NOTICE_INBOX_SOURCE_GATEWAY; // From a private source
|
||||||
|
|
||||||
$inbox->insert();
|
$inbox->insert();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$notice->blowCaches();
|
||||||
|
|
||||||
|
return $notice;
|
||||||
}
|
}
|
||||||
|
|
||||||
function ensureProfile($user)
|
function ensureProfile($user)
|
||||||
|
Loading…
Reference in New Issue
Block a user