aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2022-12-26 09:08:54 +0000
committerMario <mario@mariovavti.com>2022-12-26 09:08:54 +0000
commitd2d6be73b8428c11c2461961a920ed3e3e656f64 (patch)
tree6a5216b3696ee4cdd19e7db8a3bffbbecc2c5f1b
parenta46e2c1e6db63b03552bba9d6699b8509fd6daa0 (diff)
downloadvolse-hubzilla-d2d6be73b8428c11c2461961a920ed3e3e656f64.tar.gz
volse-hubzilla-d2d6be73b8428c11c2461961a920ed3e3e656f64.tar.bz2
volse-hubzilla-d2d6be73b8428c11c2461961a920ed3e3e656f64.zip
fix subquery in hq widget and order by hubloc_id desc in handle_tag() to make sure we get the most recent entry when using privacy tags
-rw-r--r--Zotlabs/Widget/Messages.php8
-rw-r--r--include/text.php4
2 files changed, 7 insertions, 5 deletions
diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php
index 9a3f0fa9c..a7e3b08fc 100644
--- a/Zotlabs/Widget/Messages.php
+++ b/Zotlabs/Widget/Messages.php
@@ -69,10 +69,12 @@ class Messages {
$vnotify_sql = '';
if (!($vnotify & VNOTIFY_LIKE)) {
- $vnotify_sql = " AND c.verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
+ $vnotify_sql_c = " AND c.verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
+ $vnotify_sql_i = " AND i.verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') ";
}
elseif (!feature_enabled(local_channel(), 'dislike')) {
- $vnotify_sql = " AND c.verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') ";
+ $vnotify_sql_c = " AND c.verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') ";
+ $vnotify_sql_i = " AND i.verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') ";
}
switch($type) {
@@ -90,7 +92,7 @@ class Messages {
}
$items = q("SELECT *,
- (SELECT count(*) FROM item c WHERE c.uid = %d AND c.parent = i.parent AND c.item_unseen = 1 AND c.item_thread_top = 0 $item_normal_c $vnotify_sql) AS unseen_count
+ (SELECT count(*) FROM item c WHERE c.uid = %d AND c.parent = i.parent AND c.item_unseen = 1 AND c.item_thread_top = 0 $item_normal_c $vnotify_sql_c) AS unseen_count
FROM item i WHERE i.uid = %d
AND i.created <= '%s'
$type_sql
diff --git a/include/text.php b/include/text.php
index 1608f5435..35ce465d6 100644
--- a/include/text.php
+++ b/include/text.php
@@ -2970,7 +2970,7 @@ function handle_tag(&$body, &$str_tags, $profile_uid, $tag, $in_network = true)
$newname = substr($name,1);
$newname = substr($newname,0,-1);
- $r = q("SELECT * FROM xchan WHERE ( xchan_addr = '%s' OR xchan_url = '%s' ) AND xchan_deleted = 0 AND NOT xchan_network IN ('rss', 'anon', 'unknown')",
+ $r = q("SELECT * FROM xchan LEFT JOIN hubloc ON hubloc_hash = xchan_hash WHERE ( xchan_addr = '%s' OR xchan_url = '%s' ) AND xchan_deleted = 0 AND NOT xchan_network IN ('rss', 'anon', 'unknown') ORDER BY hubloc_id DESC",
dbesc($newname),
dbesc($newname)
);
@@ -3005,7 +3005,7 @@ function handle_tag(&$body, &$str_tags, $profile_uid, $tag, $in_network = true)
if((! $r) && strpos($newname,'@')) {
$r = q("SELECT * FROM xchan LEFT JOIN hubloc ON xchan_hash = hubloc_hash
- WHERE hubloc_addr = '%s' AND xchan_deleted = 0 AND NOT xchan_network IN ('rss', 'anon', 'unknown')",
+ WHERE hubloc_addr = '%s' AND xchan_deleted = 0 AND NOT xchan_network IN ('rss', 'anon', 'unknown') ORDER BY hubloc_id DESC",
dbesc($newname)
);
}