mirror of
https://framagit.org/hubzilla/core.git
synced 2026-06-21 00:52:33 -04:00
fix edgecase for notices and make mod hq backwards compatible
This commit is contained in:
@@ -37,6 +37,15 @@ class Hq extends \Zotlabs\Web\Controller {
|
||||
$item_hash = $_REQUEST['mid'];
|
||||
}
|
||||
|
||||
$identifier = 'uuid';
|
||||
$encoded_item_hash = null;
|
||||
|
||||
if (str_starts_with($item_hash, 'b64.')) {
|
||||
$encoded_item_hash = $item_hash;
|
||||
$item_hash = unpack_link_id($item_hash);
|
||||
$identifier = 'mid';
|
||||
}
|
||||
|
||||
$item_normal = item_normal();
|
||||
$item_normal_update = item_normal_update();
|
||||
$sys = get_sys_channel();
|
||||
@@ -49,7 +58,7 @@ class Hq extends \Zotlabs\Web\Controller {
|
||||
// select the target item with a bias to our own item
|
||||
$sql_order = ((local_channel() > $sys['channel_id']) ? 'DESC' : 'ASC');
|
||||
|
||||
$r = q("select id, uid, mid, parent_mid, thr_parent, verb, item_type, item_deleted, item_blocked from item where uid in (%d, %d) and uuid = '%s' order by uid $sql_order limit 2",
|
||||
$r = q("select id, uid, mid, parent_mid, thr_parent, verb, item_type, item_deleted, item_blocked from item where uid in (%d, %d) and $identifier = '%s' order by uid $sql_order limit 2",
|
||||
intval(local_channel()),
|
||||
intval($sys['channel_id']),
|
||||
dbesc($item_hash)
|
||||
@@ -151,7 +160,7 @@ class Hq extends \Zotlabs\Web\Controller {
|
||||
'$dbegin' => '',
|
||||
'$verb' => '',
|
||||
'$net' => '',
|
||||
'$mid' => $item_hash
|
||||
'$mid' => $encoded_item_hash ?? $item_hash
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ class Messages {
|
||||
$entries[$i]['summary'] = $summary;
|
||||
//$entries[$i]['b64mid'] = gen_link_id($item['mid']);
|
||||
$entries[$i]['b64mid'] = $item['uuid'];
|
||||
$entries[$i]['href'] = z_root() . '/hq/' . gen_link_id($item['mid']);
|
||||
$entries[$i]['href'] = z_root() . '/hq/' . $item['uuid'];
|
||||
$entries[$i]['icon'] = $icon;
|
||||
$entries[$i]['unseen_count'] = (($item['unseen_count']) ? $item['unseen_count'] : (($item['item_unseen']) ? ' ' : ''));
|
||||
$entries[$i]['unseen_class'] = (($item['item_unseen']) ? 'primary' : 'secondary');
|
||||
@@ -293,8 +293,8 @@ class Messages {
|
||||
$entries[$i]['info'] = '';
|
||||
$entries[$i]['created'] = datetime_convert('UTC', date_default_timezone_get(), $notice['created']);
|
||||
$entries[$i]['summary'] = $summary;
|
||||
$entries[$i]['b64mid'] = (($notice['ntype'] & NOTIFY_INTRO) ? '' : basename($notice['link']));
|
||||
$entries[$i]['href'] = (($notice['ntype'] & NOTIFY_INTRO) ? $notice['link'] : z_root() . '/hq/' . basename($notice['link']));
|
||||
$entries[$i]['b64mid'] = (($notice['ntype'] & NOTIFY_INTRO) ? '' : ((str_contains($notice['hash'], '-')) ? $notice['hash'] : basename($notice['link'])));
|
||||
$entries[$i]['href'] = (($notice['ntype'] & NOTIFY_INTRO) ? $notice['link'] : z_root() . '/hq/' . ((str_contains($notice['hash'], '-')) ? $notice['hash'] : basename($notice['link'])));
|
||||
$entries[$i]['icon'] = (($notice['ntype'] & NOTIFY_INTRO) ? '<i class="fa fa-user-plus"></i>' : '');
|
||||
|
||||
$i++;
|
||||
|
||||
Reference in New Issue
Block a user