Some missed exception throwing since fixing Foreign_link and Foreign_user
This commit is contained in:
parent
6f62adedfc
commit
b609a3610f
@ -387,9 +387,9 @@ class TwitterBridgePlugin extends Plugin
|
|||||||
|
|
||||||
if ($n2s instanceof Notice_to_status) {
|
if ($n2s instanceof Notice_to_status) {
|
||||||
|
|
||||||
$flink = Foreign_link::getByUserID($notice->profile_id, TWITTER_SERVICE); // twitter service
|
try {
|
||||||
|
$flink = Foreign_link::getByUserID($notice->profile_id, TWITTER_SERVICE); // twitter service
|
||||||
if (!$flink instanceof Foreign_link) {
|
} catch (NoResultException $e) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -421,9 +421,9 @@ class TwitterBridgePlugin extends Plugin
|
|||||||
*/
|
*/
|
||||||
function onEndFavorNotice(Profile $profile, Notice $notice)
|
function onEndFavorNotice(Profile $profile, Notice $notice)
|
||||||
{
|
{
|
||||||
$flink = Foreign_link::getByUserID($profile->getID(), TWITTER_SERVICE); // twitter service
|
try {
|
||||||
|
$flink = Foreign_link::getByUserID($profile->getID(), TWITTER_SERVICE); // twitter service
|
||||||
if (!$flink instanceof Foreign_link) {
|
} catch (NoResultException $e) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -460,10 +460,9 @@ class TwitterBridgePlugin extends Plugin
|
|||||||
*/
|
*/
|
||||||
function onEndDisfavorNotice(Profile $profile, Notice $notice)
|
function onEndDisfavorNotice(Profile $profile, Notice $notice)
|
||||||
{
|
{
|
||||||
$flink = Foreign_link::getByUserID($profile->id,
|
try {
|
||||||
TWITTER_SERVICE); // twitter service
|
$flink = Foreign_link::getByUserID($profile->getID(), TWITTER_SERVICE); // twitter service
|
||||||
|
} catch (NoResultException $e) {
|
||||||
if (empty($flink)) {
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -520,7 +519,7 @@ class TwitterBridgePlugin extends Plugin
|
|||||||
"text" => sprintf(_("@%s on Twitter"), $fuser->nickname),
|
"text" => sprintf(_("@%s on Twitter"), $fuser->nickname),
|
||||||
"image" => $this->path("icons/twitter-bird-white-on-blue.png"));
|
"image" => $this->path("icons/twitter-bird-white-on-blue.png"));
|
||||||
} catch (NoResultException $e) {
|
} catch (NoResultException $e) {
|
||||||
// no foreign link for Twitter on this profile ID
|
// no foreign link and/or user for Twitter on this profile ID
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@ -564,16 +563,17 @@ class TwitterBridgePlugin extends Plugin
|
|||||||
if( count($noticeArray) != 1 ) { break; }
|
if( count($noticeArray) != 1 ) { break; }
|
||||||
$post = $noticeArray[0];
|
$post = $noticeArray[0];
|
||||||
|
|
||||||
$flink = Foreign_link::getByUserID($post->profile_id, TWITTER_SERVICE);
|
try {
|
||||||
if( $flink ) { // Our local user has registered Twitter Gateway
|
$flink = Foreign_link::getByUserID($post->profile_id, TWITTER_SERVICE);
|
||||||
$fuser = Foreign_user::getForeignUser($flink->foreign_id, TWITTER_SERVICE);
|
$fuser = Foreign_user::getForeignUser($flink->foreign_id, TWITTER_SERVICE);
|
||||||
if( $fuser ) { // Got nickname for local user's Twitter account
|
$action->element('meta', array('name' => 'twitter:creator',
|
||||||
$action->element('meta', array('name' => 'twitter:creator',
|
'content' => '@'.$fuser->nickname));
|
||||||
'content' => '@'.$fuser->nickname));
|
} catch (NoResultException $e) {
|
||||||
}
|
// no foreign link and/or user for Twitter on this profile ID
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default: break;
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user