From a2b26948d8e472cecd3be6be524b92d86e8f3c4f Mon Sep 17 00:00:00 2001 From: Friendika Date: Fri, 27 May 2011 15:33:01 -0700 Subject: [PATCH] duplicate likes if we posted it locally and it also comes back from FB --- addon/facebook/facebook.php | 10 ++++++++-- boot.php | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/addon/facebook/facebook.php b/addon/facebook/facebook.php index d5544601aa..cd1ae4aa33 100644 --- a/addon/facebook/facebook.php +++ b/addon/facebook/facebook.php @@ -733,11 +733,17 @@ function fb_consume_stream($uid,$j,$wall = false) { if(! $orig_post) continue; - $r = q("SELECT * FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d AND `verb` = '%s' AND `author-link` = '%s' LIMIT 1", + // If we posted the like locally, it will be found with our url, not the FB url. + + $second_url = (($likes->id == $self_id) ? $self[0]['url'] : 'http://facebook.com/profile.php?id=' . $likes->id); + + $r = q("SELECT * FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d AND `verb` = '%s' + AND ( `author-link` = '%s' OR `author-link` = '%s' ) LIMIT 1", dbesc($orig_post['uri']), intval($uid), dbesc(ACTIVITY_LIKE), - dbesc('http://facebook.com/profile.php?id=' . $likes->id) + dbesc('http://facebook.com/profile.php?id=' . $likes->id), + dbesc($second_url) ); if(count($r)) diff --git a/boot.php b/boot.php index 104e20f56d..af16e8cbbf 100644 --- a/boot.php +++ b/boot.php @@ -4,7 +4,7 @@ set_time_limit(0); ini_set('pcre.backtrack_limit', 250000); -define ( 'FRIENDIKA_VERSION', '2.2.992' ); +define ( 'FRIENDIKA_VERSION', '2.2.993' ); define ( 'DFRN_PROTOCOL_VERSION', '2.21' ); define ( 'DB_UPDATE_VERSION', 1058 );