From f5f194c92bf0992b3a24e7b62cf6f9556a6335c4 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 22 Mar 2015 14:55:41 -0700 Subject: allow complete undo of a vote, not just a change of vote --- mod/like.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mod/like.php b/mod/like.php index cfd848636..d3b6f3ecf 100755 --- a/mod/like.php +++ b/mod/like.php @@ -303,7 +303,7 @@ function like_content(&$a) { $multi_undo = 1; } - $r = q("SELECT id, parent, uid FROM item WHERE verb in ( $verbs ) AND item_restrict = 0 + $r = q("SELECT id, parent, uid, verb FROM item WHERE verb in ( $verbs ) AND item_restrict = 0 AND author_xchan = '%s' AND ( parent = %d OR thr_parent = '%s') and uid = %d ", dbesc($observer['xchan_hash']), intval($item_id), @@ -322,6 +322,10 @@ function like_content(&$a) { intval($rr['parent']), intval($rr['uid']) ); + // Prior activity was a duplicate of the one we're submitting, just undo it; + // don't fall through and create another + if(activity_match($rr['verb'],$activity)) + $multi_undo = false; } if($interactive) -- cgit v1.2.3