aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-03-22 12:55:13 -0700
committerfriendica <info@friendica.com>2015-03-22 12:55:13 -0700
commit6631540d20068d3c4ee221518e8f430507662e27 (patch)
tree4a8430ae2063d1e9397cce6315dd5b3fa691366a /mod
parent1b17b0193ec08936b5485216ba6bbe9a46ede187 (diff)
downloadvolse-hubzilla-6631540d20068d3c4ee221518e8f430507662e27.tar.gz
volse-hubzilla-6631540d20068d3c4ee221518e8f430507662e27.tar.bz2
volse-hubzilla-6631540d20068d3c4ee221518e8f430507662e27.zip
provide visual feedback when deleting a like by liking it again.
Diffstat (limited to 'mod')
-rw-r--r--mod/channel.php5
-rw-r--r--mod/home.php3
-rwxr-xr-xmod/like.php8
-rw-r--r--mod/network.php5
4 files changed, 14 insertions, 7 deletions
diff --git a/mod/channel.php b/mod/channel.php
index 3fc4a9269..16aac2e51 100644
--- a/mod/channel.php
+++ b/mod/channel.php
@@ -158,13 +158,11 @@ function channel_content(&$a, $update = 0, $load = false) {
$simple_update = (($update) ? " AND item_unseen = 1 " : '');
-
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)
$simple_update = '';
-
if(($update) && (! $load)) {
if ($mid) {
$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(ABOOK_FLAG_BLOCKED)
);
+ $_SESSION['loadtime'] = datetime_convert();
}
}
diff --git a/mod/home.php b/mod/home.php
index c449a0561..9b2cc0e6d 100644
--- a/mod/home.php
+++ b/mod/home.php
@@ -185,7 +185,7 @@ function home_content(&$a, $update = 0, $load = false) {
$simple_update = (($update) ? " and item.item_unseen = 1 " : '');
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)
$simple_update = '';
@@ -221,6 +221,7 @@ function home_content(&$a, $update = 0, $load = false) {
$sql_extra3 $sql_extra $sql_nets",
intval(ABOOK_FLAG_BLOCKED)
);
+ $_SESSION['loadtime'] = datetime_convert();
}
// Then fetch all the children of the parents that are on this page
$parents_str = '';
diff --git a/mod/like.php b/mod/like.php
index dc4531fbb..cfd848636 100755
--- a/mod/like.php
+++ b/mod/like.php
@@ -303,7 +303,7 @@ function like_content(&$a) {
$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 ",
dbesc($observer['xchan_hash']),
intval($item_id),
@@ -316,6 +316,12 @@ function like_content(&$a) {
require_once('include/items.php');
foreach($r as $rr) {
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)
diff --git a/mod/network.php b/mod/network.php
index f71a7569a..0cf535769 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -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...
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)
$simple_update = '';
@@ -445,7 +445,7 @@ function network_content(&$a, $update = 0, $load = false) {
}
else {
if(! $firehose) {
- // update
+ // this is an update
$r = q("SELECT item.parent AS item_id FROM item
left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
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 ",
intval(ABOOK_FLAG_BLOCKED)
);
+ $_SESSION['loadtime'] = datetime_convert();
}
}