provide visual feedback when deleting a like by liking it again.

This commit is contained in:
friendica 2015-03-22 12:55:13 -07:00
parent 1b17b0193e
commit 6631540d20
5 changed files with 15 additions and 8 deletions

View File

@ -158,13 +158,11 @@ function channel_content(&$a, $update = 0, $load = false) {
$simple_update = (($update) ? " AND item_unseen = 1 " : ''); $simple_update = (($update) ? " AND item_unseen = 1 " : '');
if($update && $_SESSION['loadtime']) if($update && $_SESSION['loadtime'])
$simple_update .= " and item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' "; $simple_update = " AND ( item_unseen = 1 or item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) ";
if($load) if($load)
$simple_update = ''; $simple_update = '';
if(($update) && (! $load)) { if(($update) && (! $load)) {
if ($mid) { if ($mid) {
$r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d AND item_restrict = 0 $r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d AND item_restrict = 0
@ -185,6 +183,7 @@ function channel_content(&$a, $update = 0, $load = false) {
intval(ITEM_WALL), intval(ITEM_WALL),
intval(ABOOK_FLAG_BLOCKED) intval(ABOOK_FLAG_BLOCKED)
); );
$_SESSION['loadtime'] = datetime_convert();
} }
} }

View File

@ -185,7 +185,7 @@ function home_content(&$a, $update = 0, $load = false) {
$simple_update = (($update) ? " and item.item_unseen = 1 " : ''); $simple_update = (($update) ? " and item.item_unseen = 1 " : '');
if($update && $_SESSION['loadtime']) if($update && $_SESSION['loadtime'])
$simple_update .= " and item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' "; $simple_update = " AND ( item_unseen = 1 or item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) ";
if($load) if($load)
$simple_update = ''; $simple_update = '';
@ -221,6 +221,7 @@ function home_content(&$a, $update = 0, $load = false) {
$sql_extra3 $sql_extra $sql_nets", $sql_extra3 $sql_extra $sql_nets",
intval(ABOOK_FLAG_BLOCKED) intval(ABOOK_FLAG_BLOCKED)
); );
$_SESSION['loadtime'] = datetime_convert();
} }
// Then fetch all the children of the parents that are on this page // Then fetch all the children of the parents that are on this page
$parents_str = ''; $parents_str = '';

View File

@ -303,7 +303,7 @@ function like_content(&$a) {
$multi_undo = 1; $multi_undo = 1;
} }
$r = q("SELECT id FROM item WHERE verb in ( $verbs ) AND item_restrict = 0 $r = q("SELECT id, parent, uid FROM item WHERE verb in ( $verbs ) AND item_restrict = 0
AND author_xchan = '%s' AND ( parent = %d OR thr_parent = '%s') and uid = %d ", AND author_xchan = '%s' AND ( parent = %d OR thr_parent = '%s') and uid = %d ",
dbesc($observer['xchan_hash']), dbesc($observer['xchan_hash']),
intval($item_id), intval($item_id),
@ -316,6 +316,12 @@ function like_content(&$a) {
require_once('include/items.php'); require_once('include/items.php');
foreach($r as $rr) { foreach($r as $rr) {
drop_item($rr['id'],false,DROPITEM_PHASE1); drop_item($rr['id'],false,DROPITEM_PHASE1);
// set the changed timestamp on the parent so we'll see the update without a page reload
$z = q("update item set changed = '%s' where id = %d and uid = %d",
dbesc(datetime_convert()),
intval($rr['parent']),
intval($rr['uid'])
);
} }
if($interactive) if($interactive)

View File

@ -396,7 +396,7 @@ function network_content(&$a, $update = 0, $load = false) {
// which are both ITEM_UNSEEN and have "changed" since that time. Cross fingers... // which are both ITEM_UNSEEN and have "changed" since that time. Cross fingers...
if($update && $_SESSION['loadtime']) if($update && $_SESSION['loadtime'])
$simple_update .= " and item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' "; $simple_update = " AND ( item_unseen = 1 or item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ) ";
if($load) if($load)
$simple_update = ''; $simple_update = '';
@ -445,7 +445,7 @@ function network_content(&$a, $update = 0, $load = false) {
} }
else { else {
if(! $firehose) { if(! $firehose) {
// update // this is an update
$r = q("SELECT item.parent AS item_id FROM item $r = q("SELECT item.parent AS item_id FROM item
left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids ) left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
WHERE true $uids AND item.item_restrict = 0 $simple_update WHERE true $uids AND item.item_restrict = 0 $simple_update
@ -453,6 +453,7 @@ function network_content(&$a, $update = 0, $load = false) {
$sql_extra3 $sql_extra $sql_nets ", $sql_extra3 $sql_extra $sql_nets ",
intval(ABOOK_FLAG_BLOCKED) intval(ABOOK_FLAG_BLOCKED)
); );
$_SESSION['loadtime'] = datetime_convert();
} }
} }

View File

@ -1 +1 @@
2015-03-21.978 2015-03-22.979