forked from GNUsocial/gnu-social
Skip enqueueing to outgoing bridges on incoming remote messages. Twitter, Facebook, RSSCloud, and OStatus checks were enqueued on these when they'd never do anything but churn the queue servers.
Notice::isLocal() can replace a number of manual checks for $notice->is_local being LOCAL_PUBLIC or LOCAL_NONPUBLIC.
This commit is contained in:
parent
791b98046d
commit
5f4c6ec626
@ -1861,4 +1861,16 @@ class Notice extends Memcached_DataObject
|
||||
return $ns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the notice was locally created
|
||||
*
|
||||
* @return boolean locality
|
||||
*/
|
||||
|
||||
public function isLocal()
|
||||
{
|
||||
return ($this->is_local == Notice::LOCAL_PUBLIC ||
|
||||
$this->is_local == Notice::LOCAL_NONPUBLIC);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1235,9 +1235,8 @@ function common_enqueue_notice($notice)
|
||||
$transports[] = 'jabber';
|
||||
}
|
||||
|
||||
// @fixme move these checks into QueueManager and/or individual handlers
|
||||
if ($notice->is_local == Notice::LOCAL_PUBLIC ||
|
||||
$notice->is_local == Notice::LOCAL_NONPUBLIC) {
|
||||
// We can skip these for gatewayed notices.
|
||||
if ($notice->isLocal()) {
|
||||
$transports = array_merge($transports, $localTransports);
|
||||
if ($xmpp) {
|
||||
$transports[] = 'public';
|
||||
|
@ -585,7 +585,7 @@ class FacebookPlugin extends Plugin
|
||||
|
||||
function onStartEnqueueNotice($notice, &$transports)
|
||||
{
|
||||
if (self::hasKeys()) {
|
||||
if (self::hasKeys() && $notice->isLocal()) {
|
||||
array_push($transports, 'facebook');
|
||||
}
|
||||
return true;
|
||||
|
@ -102,8 +102,10 @@ class OStatusPlugin extends Plugin
|
||||
*/
|
||||
function onStartEnqueueNotice($notice, &$transports)
|
||||
{
|
||||
if ($notice->isLocal()) {
|
||||
// put our transport first, in case there's any conflict (like OMB)
|
||||
array_unshift($transports, 'ostatus');
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -192,22 +192,10 @@ class RSSCloudPlugin extends Plugin
|
||||
|
||||
function onStartEnqueueNotice($notice, &$transports)
|
||||
{
|
||||
if ($notice->isLocal()) {
|
||||
array_push($transports, 'rsscloud');
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the notice was locally created
|
||||
*
|
||||
* @param Notice $notice the notice in question
|
||||
*
|
||||
* @return boolean locality
|
||||
*/
|
||||
|
||||
function _isLocal($notice)
|
||||
{
|
||||
return ($notice->is_local == Notice::LOCAL_PUBLIC ||
|
||||
$notice->is_local == Notice::LOCAL_NONPUBLIC);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -221,7 +221,7 @@ class TwitterBridgePlugin extends Plugin
|
||||
*/
|
||||
function onStartEnqueueNotice($notice, &$transports)
|
||||
{
|
||||
if (self::hasKeys()) {
|
||||
if (self::hasKeys() && $notice->isLocal()) {
|
||||
// Avoid a possible loop
|
||||
if ($notice->source != 'twitter') {
|
||||
array_push($transports, 'twitter');
|
||||
|
Loading…
Reference in New Issue
Block a user