From 88711deceb1f3c1187c6aa649adcfdeed45a9016 Mon Sep 17 00:00:00 2001 From: Zach Prezkuta Date: Fri, 13 Jul 2012 09:09:01 -0600 Subject: [PATCH] allow live updates for unlikes and undislikes --- js/main.js | 6 +++--- mod/like.php | 2 +- mod/network.php | 3 ++- mod/profile.php | 2 ++ 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/js/main.js b/js/main.js index 885e042aa3..a5ce894601 100644 --- a/js/main.js +++ b/js/main.js @@ -357,9 +357,9 @@ function dolike(ident,verb) { unpause(); $('#like-rotator-' + ident.toString()).show(); - $.get('like/' + ident.toString() + '?verb=' + verb ); - if(timer) clearTimeout(timer); - timer = setTimeout(NavUpdate,3000); + $.get('like/' + ident.toString() + '?verb=' + verb, NavUpdate ); +// if(timer) clearTimeout(timer); +// timer = setTimeout(NavUpdate,3000); liking = 1; } diff --git a/mod/like.php b/mod/like.php index 8fe0cf7353..aaa85928c7 100755 --- a/mod/like.php +++ b/mod/like.php @@ -117,7 +117,7 @@ function like_content(&$a) { $like_item = $r[0]; // Already voted, undo it - $r = q("UPDATE `item` SET `deleted` = 1, `changed` = '%s' WHERE `id` = %d LIMIT 1", + $r = q("UPDATE `item` SET `deleted` = 1, `unseen` = 1, `changed` = '%s' WHERE `id` = %d LIMIT 1", dbesc(datetime_convert()), intval($like_item['id']) ); diff --git a/mod/network.php b/mod/network.php index 5f009dacd1..3d8fa7c144 100644 --- a/mod/network.php +++ b/mod/network.php @@ -616,7 +616,8 @@ function network_content(&$a, $update = 0) { if($update) { $r = q("SELECT `parent` AS `item_id`, `contact`.`uid` AS `contact_uid` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` - WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 + WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND + (`item`.`deleted` = 0 OR item.verb = '" . ACTIVITY_LIKE ."' OR item.verb = '" . ACTIVITY_DISLIKE . "') and `item`.`moderated` = 0 and `item`.`unseen` = 1 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0 $sql_extra3 $sql_extra $sql_nets ", diff --git a/mod/profile.php b/mod/profile.php index 24e03d6eac..b142943c1e 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -204,6 +204,8 @@ function profile_content(&$a, $update = 0) { $r = q("SELECT distinct(parent) AS `item_id`, `contact`.`uid` AS `contact-uid` FROM `item` LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id` + WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND + (`item`.`deleted` = 0 OR item.verb = '" . ACTIVITY_LIKE ."' OR item.verb = '" . ACTIVITY_DISLIKE . "') WHERE `item`.`uid` = %d AND `item`.`visible` = 1 AND `item`.`deleted` = 0 and `item`.`moderated` = 0 and `item`.`unseen` = 1 AND `contact`.`blocked` = 0 AND `contact`.`pending` = 0