summaryrefslogtreecommitdiff
path: root/plugins/TwitterBridge/twitterauthorization.php
diff options
context:
space:
mode:
authorZach Copley <zach@status.net>2010-02-15 21:10:45 +0000
committerZach Copley <zach@status.net>2010-02-15 21:13:42 +0000
commit5cc1f8b001057e9c4301b173391a7f0a5415f153 (patch)
tree33023ef57ed0a1ae7149608d618e734db81a7fcc /plugins/TwitterBridge/twitterauthorization.php
parent6b10c269b54d452b0a5f55ab5722297f4b889653 (diff)
Fix for regression introduced with my last update to the
TwitterStatusFetcher: the Twitter bridge was not saving a foreign user record when making a foreign link.
Diffstat (limited to 'plugins/TwitterBridge/twitterauthorization.php')
-rw-r--r--plugins/TwitterBridge/twitterauthorization.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/plugins/TwitterBridge/twitterauthorization.php b/plugins/TwitterBridge/twitterauthorization.php
index dbef438a4..6822d33dd 100644
--- a/plugins/TwitterBridge/twitterauthorization.php
+++ b/plugins/TwitterBridge/twitterauthorization.php
@@ -89,11 +89,15 @@ class TwitterauthorizationAction extends Action
$user = common_current_user();
$flink = Foreign_link::getByUserID($user->id, TWITTER_SERVICE);
- // If there's already a foreign link record, it means we already
- // have an access token, and this is unecessary. So go back.
+ // If there's already a foreign link record and a foreign user
+ // it means the accounts are already linked, and this is unecessary.
+ // So go back.
if (isset($flink)) {
- common_redirect(common_local_url('twittersettings'));
+ $fuser = $flink->getForeignUser();
+ if (!empty($fuser)) {
+ common_redirect(common_local_url('twittersettings'));
+ }
}
}
@@ -254,6 +258,10 @@ class TwitterauthorizationAction extends Action
{
$flink = new Foreign_link();
+ $flink->user_id = $user_id;
+ $flink->service = TWITTER_SERVICE;
+ $flink->delete(); // delete stale flink, if any
+
$flink->user_id = $user_id;
$flink->foreign_id = $twuid;
$flink->service = TWITTER_SERVICE;