aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Lib/Enotify.php16
-rw-r--r--Zotlabs/Lib/ThreadItem.php19
-rw-r--r--Zotlabs/Lib/ThreadStream.php4
-rw-r--r--Zotlabs/Module/Channel.php50
-rw-r--r--Zotlabs/Module/Display.php20
-rw-r--r--Zotlabs/Module/Dreport.php5
-rw-r--r--Zotlabs/Module/Hq.php15
-rw-r--r--Zotlabs/Module/Item.php12
-rw-r--r--Zotlabs/Module/Like.php2
-rw-r--r--Zotlabs/Module/Pin.php2
-rw-r--r--Zotlabs/Module/Pubstream.php19
-rw-r--r--Zotlabs/Module/Search.php4
-rw-r--r--Zotlabs/Module/Sse_bs.php4
-rw-r--r--Zotlabs/Module/Subthread.php5
-rw-r--r--Zotlabs/Module/Tagger.php2
-rw-r--r--Zotlabs/Widget/Messages.php3
-rw-r--r--Zotlabs/Widget/Pinned.php2
-rw-r--r--boot.php2
-rw-r--r--include/conversation.php18
-rw-r--r--include/event.php2
-rw-r--r--include/items.php15
-rw-r--r--view/js/main.js8
-rw-r--r--view/tpl/conv_item.tpl4
23 files changed, 122 insertions, 111 deletions
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php
index d8e6f575a..a9eaf3136 100644
--- a/Zotlabs/Lib/Enotify.php
+++ b/Zotlabs/Lib/Enotify.php
@@ -486,6 +486,8 @@ class Enotify {
require_once('include/html2bbcode.php');
+/*
+
do {
$dups = false;
$hash = random_string();
@@ -494,10 +496,12 @@ class Enotify {
if ($r)
$dups = true;
} while ($dups === true);
+*/
+
$datarray = [];
- $datarray['hash'] = $hash;
+ $datarray['hash'] = $params['item']['uuid'] ?? new_uuid();
$datarray['sender_hash'] = $sender['xchan_hash'];
$datarray['xname'] = $sender['xchan_name'];
$datarray['url'] = $sender['xchan_url'];
@@ -557,7 +561,7 @@ class Enotify {
);
$r = q("select id from notify where hash = '%s' and uid = %d limit 1",
- dbesc($hash),
+ dbesc($datarray['hash']),
intval($recip['channel_id'])
);
if ($r) {
@@ -871,7 +875,8 @@ class Enotify {
'photo' => $item['author']['xchan_photo_s'],
'when' => (($edit) ? datetime_convert('UTC', date_default_timezone_get(), $item['edited']) : datetime_convert('UTC', date_default_timezone_get(), $item['created'])),
'class' => (intval($item['item_unseen']) ? 'notify-unseen' : 'notify-seen'),
- 'b64mid' => (($item['mid']) ? gen_link_id($item['mid']) : ''),
+ // 'b64mid' => (($item['mid']) ? gen_link_id($item['mid']) : ''),
+ 'b64mid' => (($item['uuid']) ? $item['uuid'] : ''),
//'b64mid' => ((in_array($item['verb'], [ACTIVITY_LIKE, ACTIVITY_DISLIKE])) ? gen_link_id($item['thr_parent']) : gen_link_id($item['mid'])),
'thread_top' => (($item['item_thread_top']) ? true : false),
'message' => bbcode(escape_tags($itemem_text)),
@@ -897,9 +902,6 @@ class Enotify {
if(strpos($message, $tt['xname']) === 0)
$message = substr($message, strlen($tt['xname']) + 1);
- $mid = basename($tt['link']);
-
- $b64mid = gen_link_id($mid);
$x = [
'notify_link' => (($tt['ntype'] === NOTIFY_MAIL) ? $tt['link'] : z_root() . '/notify/view/' . $tt['id']),
'name' => $tt['xname'],
@@ -907,7 +909,7 @@ class Enotify {
'photo' => $tt['photo'],
'when' => datetime_convert('UTC', date_default_timezone_get(), $tt['created']),
'hclass' => (($tt['seen']) ? 'notify-seen' : 'notify-unseen'),
- 'b64mid' => (($tt['otype'] == 'item') ? $b64mid : ''),
+ 'b64mid' => (($tt['otype'] == 'item') ? $tt['hash'] : ''),
'notify_id' => (($tt['otype'] == 'item') ? $tt['id'] : ''),
'message' => $message
];
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php
index 77f26c386..b6df1baf1 100644
--- a/Zotlabs/Lib/ThreadItem.php
+++ b/Zotlabs/Lib/ThreadItem.php
@@ -34,6 +34,7 @@ class ThreadItem {
private $channel = null;
private $display_mode = 'normal';
private $reload = '';
+ private $mid_uuid_map = [];
public function __construct($data) {
@@ -46,6 +47,7 @@ class ThreadItem {
// Prepare the children
if(isset($data['children'])) {
+
foreach($data['children'] as $item) {
/*
@@ -56,7 +58,6 @@ class ThreadItem {
continue;
}
-
$child = new ThreadItem($item);
$this->add_child($child);
}
@@ -65,6 +66,8 @@ class ThreadItem {
unset($this->data['children']);
}
+
+
// allow a site to configure the order and content of the reaction emoji list
if($this->toplevel) {
$x = get_config('system','reactions');
@@ -82,7 +85,7 @@ class ThreadItem {
* _ false on failure
*/
- public function get_template_data($conv_responses, $thread_level=1, $conv_flags = []) {
+ public function get_template_data($conv_responses, $mid_uuid_map, $thread_level=1, $conv_flags = []) {
$result = [];
$item = $this->get_data();
@@ -351,7 +354,7 @@ class ThreadItem {
$dreport_link = '';
if((intval($item['item_type']) == ITEM_TYPE_POST) && (! get_config('system','disable_dreport')) && strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC',"now - $keep_reports days")) > 0) {
$dreport = t('Delivery Report');
- $dreport_link = gen_link_id($item['mid']);
+ $dreport_link = '?mid=' . $item['mid'];
}
$is_new = false;
@@ -381,8 +384,8 @@ class ThreadItem {
call_hooks('dropdown_extras',$dropdown_extras_arr);
$dropdown_extras = $dropdown_extras_arr['dropdown_extras'];
- $midb64 = gen_link_id($item['mid']);
- $mids = [ $midb64 ];
+ //$midb64 = gen_link_id($item['mid']);
+ $mids = [ $item['uuid'] ];
$response_mids = [];
foreach($response_verbs as $v) {
if(isset($conv_responses[$v]['mids'][$item['mid']])) {
@@ -530,14 +533,12 @@ class ThreadItem {
'wait' => t('Please wait'),
'thread_level' => $thread_level,
'settings' => $settings,
- 'thr_parent' => (($item['parent_mid'] != $item['thr_parent']) ? gen_link_id($item['thr_parent']) : ''),
+ 'thr_parent_uuid' => (($item['parent_mid'] != $item['thr_parent']) ? $mid_uuid_map[$item['thr_parent']] : ''),
'contact_id' => (($contact) ? $contact['abook_id'] : ''),
'moderate' => ($item['item_blocked'] == ITEM_MODERATED),
'moderate_approve' => t('Approve'),
'moderate_delete' => t('Delete'),
'rtl' => in_array($item['lang'], rtl_languages()),
-
-
);
$arr = array('item' => $item, 'output' => $tmp_item);
@@ -560,7 +561,7 @@ class ThreadItem {
if(($this->get_display_mode() === 'normal') && ($nb_children > 0)) {
foreach($children as $child) {
- $result['children'][] = $child->get_template_data($conv_responses, $thread_level + 1,$conv_flags);
+ $result['children'][] = $child->get_template_data($conv_responses, $mid_uuid_map, $thread_level + 1,$conv_flags);
}
// Collapse
if(($nb_children > $visible_comments) || ($thread_level > 1)) {
diff --git a/Zotlabs/Lib/ThreadStream.php b/Zotlabs/Lib/ThreadStream.php
index 2ad24a690..72d2bd2f8 100644
--- a/Zotlabs/Lib/ThreadStream.php
+++ b/Zotlabs/Lib/ThreadStream.php
@@ -211,7 +211,7 @@ class ThreadStream {
* _ The data requested on success
* _ false on failure
*/
- public function get_template_data($conv_responses) {
+ public function get_template_data($conv_responses, $mid_uuid_map) {
$result = array();
foreach($this->threads as $item) {
@@ -220,7 +220,7 @@ class ThreadStream {
$item_data = $this->prepared_item;
}
else {
- $item_data = $item->get_template_data($conv_responses);
+ $item_data = $item->get_template_data($conv_responses, $mid_uuid_map);
}
if(!$item_data) {
logger('Failed to get item template data ('. $item->get_id() .').', LOGGER_DEBUG, LOG_ERR);
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php
index e8c3316e9..4e6811a10 100644
--- a/Zotlabs/Module/Channel.php
+++ b/Zotlabs/Module/Channel.php
@@ -101,16 +101,23 @@ class Channel extends Controller {
App::$meta->set('robots', 'noindex, noarchive');
}
+ $identifier = 'uuid';
+ $mid = $_REQUEST['mid'] ?? '';
+
+ if (str_starts_with($mid, 'b64.')) {
+ $mid = unpack_link_id($mid);
+ $identifier = 'mid';
+ }
+
+ if ($mid === false) {
+ http_status_exit(404, 'Not found');
+ }
+
if (ActivityStreams::is_as_request($channel)) {
// Somebody may attempt an ActivityStreams fetch on one of our message permalinks
// Make it do the right thing.
- $mid = ((x($_REQUEST, 'mid')) ? unpack_link_id($_REQUEST['mid']) : '');
- if ($mid === false) {
- http_status_exit(404, 'Not found');
- }
-
if ($mid) {
$obj = null;
if (strpos($mid, z_root() . '/item/') === 0) {
@@ -127,6 +134,7 @@ class Channel extends Controller {
$obj->init();
}
}
+
as_return_and_die(Activity::encode_person($channel, true), $channel);
}
@@ -155,15 +163,9 @@ class Channel extends Controller {
profile_load($which, $profile);
// Add Opengraph markup
- $mid = ((x($_REQUEST, 'mid')) ? unpack_link_id($_REQUEST['mid']) : '');
-
- if ($mid === false) {
- notice(t('Malformed message id.') . EOL);
- return;
- }
if ($mid) {
- $r = q("SELECT * FROM item WHERE mid = '%s' AND uid = %d AND item_private = 0 LIMIT 1",
+ $r = q("SELECT * FROM item WHERE $identifier = '%s' AND uid = %d AND item_private = 0 LIMIT 1",
dbesc($mid),
intval($channel['channel_id'])
);
@@ -178,7 +180,16 @@ class Channel extends Controller {
$category = $datequery = $datequery2 = '';
- $mid = ((x($_REQUEST, 'mid')) ? unpack_link_id($_REQUEST['mid']) : '');
+ $mid = $_REQUEST['mid'] ?? '';
+ $identifier = 'uuid';
+ $encoded_mid = null;
+
+ if (str_starts_with($mid, 'b64.')) {
+ $encoded_mid = $mid;
+ $mid = unpack_link_id($mid);
+ $identifier = 'mid';
+ }
+
if ($mid === false) {
notice(t('Malformed message id.') . EOL);
return;
@@ -322,7 +333,7 @@ class Channel extends Controller {
if (($update) && (!$load)) {
if ($mid) {
- $r = q("SELECT parent AS item_id from item where mid = '%s' and uid = %d $item_normal_update
+ $r = q("SELECT parent AS item_id, uuid from item where $identifier = '%s' and uid = %d $item_normal_update
AND item_wall = 1 $simple_update $sql_extra limit 1",
dbesc($mid),
intval(App::$profile['profile_uid'])
@@ -370,7 +381,7 @@ class Channel extends Controller {
if ($noscript_content || $load) {
if ($mid) {
- $r = q("SELECT parent AS item_id from item where mid = '%s' and uid = %d $item_normal
+ $r = q("SELECT parent AS item_id, uuid from item where $identifier = '%s' and uid = %d $item_normal
AND item_wall = 1 $sql_extra limit 1",
dbesc($mid),
intval(App::$profile['profile_uid'])
@@ -396,7 +407,6 @@ class Channel extends Controller {
}
}
if ($r) {
-
$parents_str = ids_to_querystr($r, 'item_id');
$r = q("SELECT item.*, item.id AS item_id
@@ -427,12 +437,8 @@ class Channel extends Controller {
$mode = (($search) ? 'search' : 'channel');
- if ((!$update) && (!$load)) {
-
-
- //if we got a decoded hash we must encode it again before handing to javascript
- $mid = gen_link_id($mid);
+ if ((!$update) && (!$load)) {
// This is ugly, but we can't pass the profile_uid through the session to the ajax updater,
// because browser prefetching might change it on us. We have to deliver it with the page.
@@ -470,7 +476,7 @@ class Channel extends Controller {
'$file' => '',
'$cats' => (($category) ? urlencode($category) : ''),
'$tags' => (($hashtags) ? urlencode($hashtags) : ''),
- '$mid' => (($mid) ? urlencode($mid) : ''),
+ '$mid' => $encoded_mid ?? $mid,
'$verb' => '',
'$net' => '',
'$dend' => $datequery,
diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php
index 9e46d7620..a1e8d0d1d 100644
--- a/Zotlabs/Module/Display.php
+++ b/Zotlabs/Module/Display.php
@@ -38,7 +38,14 @@ class Display extends Controller {
$item_hash = $_REQUEST['mid'];
}
- $item_hash = unpack_link_id($item_hash);
+ $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';
+ }
if ($item_hash === false) {
App::$error = 400;
@@ -104,7 +111,7 @@ class Display extends Controller {
$target_item = null;
- $r = q("select id, uid, mid, parent, parent_mid, thr_parent, verb, item_type, item_deleted, author_xchan, item_blocked from item where mid = '%s' limit 1",
+ $r = q("select id, uid, mid, parent, parent_mid, thr_parent, verb, item_type, item_deleted, author_xchan, item_blocked from item where $identifier = '%s' limit 1",
dbesc($item_hash)
);
@@ -157,13 +164,6 @@ class Display extends Controller {
if((! $update) && (! $load)) {
- // if the target item is not a post (eg a like) we want to address its thread parent
-
- //$mid = ((($target_item['verb'] == ACTIVITY_LIKE) || ($target_item['verb'] == ACTIVITY_DISLIKE)) ? $target_item['thr_parent'] : $target_item['mid']);
-
- // if we got a decoded hash we must encode it again before handing to javascript
- $mid = gen_link_id($target_item['mid']);
-
$o .= '<div id="live-display"></div>' . "\r\n";
$o .= "<script> var profile_uid = " . ((intval(local_channel())) ? local_channel() : (-1))
. "; var netargs = '?f='; var profile_page = " . App::$pager['page'] . "; </script>\r\n";
@@ -196,7 +196,7 @@ class Display extends Controller {
'$dbegin' => '',
'$verb' => '',
'$net' => '',
- '$mid' => (($mid) ? urlencode($mid) : '')
+ '$mid' => $encoded_item_hash ?? $item_hash
));
head_add_link([
diff --git a/Zotlabs/Module/Dreport.php b/Zotlabs/Module/Dreport.php
index f5ad80eef..4a0ba4bbe 100644
--- a/Zotlabs/Module/Dreport.php
+++ b/Zotlabs/Module/Dreport.php
@@ -13,11 +13,10 @@ class Dreport extends \Zotlabs\Web\Controller {
$table = 'item';
$channel = \App::get_channel();
- $mid = ((argc() > 1) ? unpack_link_id(argv(1)) : '');
+ $mid = $_REQUEST['mid'] ?? '';
- if($mid === 'push') {
+ if(argv(1) === 'push') {
$table = 'push';
- $mid = ((argc() > 2) ? unpack_link_id(argv(2)) : '');
if($mid) {
$i = q("select id from item where mid = '%s' and uid = %d and ( author_xchan = '%s' or ( owner_xchan = '%s' and item_wall = 1 )) ",
diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php
index 5c3ae9273..36ab8e410 100644
--- a/Zotlabs/Module/Hq.php
+++ b/Zotlabs/Module/Hq.php
@@ -30,16 +30,11 @@ class Hq extends \Zotlabs\Web\Controller {
$item_hash = '';
if(argc() > 1 && argv(1) !== 'load') {
- $item_hash = unpack_link_id(argv(1));
+ $item_hash = argv(1);
}
if(isset($_REQUEST['mid'])) {
- $item_hash = unpack_link_id($_REQUEST['mid']);
- }
-
- if($item_hash === false) {
- notice(t('Malformed message id.') . EOL);
- return;
+ $item_hash = $_REQUEST['mid'];
}
$item_normal = item_normal();
@@ -54,7 +49,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 mid = '%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 uuid = '%s' order by uid $sql_order limit 2",
intval(local_channel()),
intval($sys['channel_id']),
dbesc($item_hash)
@@ -118,7 +113,7 @@ class Hq extends \Zotlabs\Web\Controller {
//$mid = ((($target_item['verb'] == ACTIVITY_LIKE) || ($target_item['verb'] == ACTIVITY_DISLIKE)) ? $target_item['thr_parent'] : $target_item['mid']);
// if we got a decoded hash we must encode it again before handing to javascript
- $mid = gen_link_id($target_item['mid']);
+ // $mid = gen_link_id($target_item['mid']);
}
else {
$mid = '';
@@ -156,7 +151,7 @@ class Hq extends \Zotlabs\Web\Controller {
'$dbegin' => '',
'$verb' => '',
'$net' => '',
- '$mid' => (($mid) ? urlencode($mid) : '')
+ '$mid' => $item_hash
]);
}
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php
index 25ccb0cbf..09e4904c1 100644
--- a/Zotlabs/Module/Item.php
+++ b/Zotlabs/Module/Item.php
@@ -275,7 +275,7 @@ class Item extends Controller {
if (argc() > 1 && argv(1) !== 'drop') {
- $x = q("select uid, item_wall, llink, mid from item where mid = '%s' or mid = '%s' or uuid = '%s'",
+ $x = q("select uid, item_wall, llink, mid, uuid from item where mid = '%s' or mid = '%s' or uuid = '%s'",
dbesc(z_root() . '/item/' . argv(1)),
dbesc(z_root() . '/activity/' . argv(1)),
dbesc(argv(1))
@@ -285,7 +285,7 @@ class Item extends Controller {
if (intval($xv['item_wall'])) {
$c = channelx_by_n($xv['uid']);
if ($c) {
- goaway(z_root() . '/channel/' . $c['channel_address'] . '?mid=' . gen_link_id($xv['mid']));
+ goaway(z_root() . '/channel/' . $c['channel_address'] . '?mid=' . $xv['uuid']);
}
}
}
@@ -1285,7 +1285,7 @@ class Item extends Controller {
'from_xchan' => $datarray['author_xchan'],
'to_xchan' => $datarray['owner_xchan'],
'item' => $datarray,
- 'link' => z_root() . '/display/' . gen_link_id($datarray['mid']),
+ 'link' => z_root() . '/display/' . $datarray['uuid'],
'verb' => ACTIVITY_POST,
'otype' => 'item',
'parent' => $parent,
@@ -1303,7 +1303,7 @@ class Item extends Controller {
'from_xchan' => $datarray['author_xchan'],
'to_xchan' => $datarray['owner_xchan'],
'item' => $datarray,
- 'link' => z_root() . '/display/' . gen_link_id($datarray['mid']),
+ 'link' => z_root() . '/display/' . $datarray['uuid'],
'verb' => ACTIVITY_POST,
'otype' => 'item'
]);
@@ -1349,7 +1349,7 @@ class Item extends Controller {
}
$datarray['id'] = $post_id;
- $datarray['llink'] = z_root() . '/display/' . gen_link_id($datarray['mid']);
+ $datarray['llink'] = z_root() . '/display/' . $datarray['uuid'];
call_hooks('post_local_end', $datarray);
@@ -1373,7 +1373,7 @@ class Item extends Controller {
if ($return_path) {
if ($return_path === 'hq') {
- goaway(z_root() . '/hq/' . gen_link_id($datarray['mid']));
+ goaway(z_root() . '/hq/' . $datarray['uuid']);
}
goaway(z_root() . "/" . $return_path);
diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php
index 4dd43b682..68234eb93 100644
--- a/Zotlabs/Module/Like.php
+++ b/Zotlabs/Module/Like.php
@@ -513,7 +513,7 @@ class Like extends Controller {
$arr['thr_parent'] = $item['mid'];
$ulink = '[zrl=' . $item_author['xchan_url'] . '][bdi]' . $item_author['xchan_name'] . '[/bdi][/zrl]';
$alink = '[zrl=' . $observer['xchan_url'] . '][bdi]' . $observer['xchan_name'] . '[/bdi][/zrl]';
- $plink = '[zrl=' . z_root() . '/display/' . gen_link_id($item['mid']) . ']' . $post_type . '[/zrl]';
+ $plink = '[zrl=' . z_root() . '/display/' . $item['uuid'] . ']' . $post_type . '[/zrl]';
$allow_cid = $item['allow_cid'];
$allow_gid = $item['allow_gid'];
$deny_cid = $item['deny_cid'];
diff --git a/Zotlabs/Module/Pin.php b/Zotlabs/Module/Pin.php
index f82327ce6..de3c75622 100644
--- a/Zotlabs/Module/Pin.php
+++ b/Zotlabs/Module/Pin.php
@@ -37,7 +37,7 @@ class Pin extends \Zotlabs\Web\Controller {
http_status_exit(404, 'Not found');
}
- $midb64 = gen_link_id($r[0]['mid']);
+ $midb64 = $r[0]['uuid'];
$pinned = (in_array($midb64, get_pconfig($r[0]['uid'], 'pinned', $r[0]['item_type'], [])) ? true : false);
switch(argv(1)) {
diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php
index 08de168cb..c40751fdc 100644
--- a/Zotlabs/Module/Pubstream.php
+++ b/Zotlabs/Module/Pubstream.php
@@ -40,7 +40,15 @@ class Pubstream extends \Zotlabs\Web\Controller {
$site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false);
- $mid = ((isset($_REQUEST['mid'])) ? unpack_link_id($_REQUEST['mid']) : '');
+ $mid = $_REQUEST['mid'] ?? '';
+ $identifier = 'uuid';
+ $encoded_mid = null;
+
+ if (str_starts_with($mid, 'b64.')) {
+ $encoded_mid = $mid;
+ $mid = unpack_link_id($mid);
+ $identifier = 'mid';
+ }
if ($mid === false) {
notice(t('Malformed message id.') . EOL);
@@ -108,9 +116,6 @@ class Pubstream extends \Zotlabs\Web\Controller {
. "; var profile_page = " . \App::$pager['page']
. "; divmore_height = " . intval($maxheight) . "; </script>\r\n";
- //if we got a decoded hash we must encode it again before handing to javascript
- $mid = gen_link_id($mid);
-
\App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array(
'$baseurl' => z_root(),
'$pgtype' => 'pubstream',
@@ -136,7 +141,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
'$cats' => '',
'$tags' => (($hashtags) ? urlencode($hashtags) : ''),
'$dend' => '',
- '$mid' => (($mid) ? urlencode($mid) : ''),
+ '$mid' => $encoded_mid ?? $mid,
'$verb' => '',
'$net' => (($net) ? urlencode($net) : ''),
'$dbegin' => ''
@@ -198,7 +203,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
$r = q("SELECT parent AS item_id FROM item
left join abook on item.author_xchan = abook.abook_xchan
$net_query
- WHERE item.mid = '%s' and item.item_private = 0
+ WHERE item.$identifier = '%s' and item.item_private = 0
$uids $site_firehose_sql
$item_normal
and (abook.abook_blocked = 0 or abook.abook_flags is null)
@@ -225,7 +230,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
$r = q("SELECT parent AS item_id FROM item
left join abook on item.author_xchan = abook.abook_xchan
$net_query
- WHERE item.mid = '%s' and item.item_private = 0
+ WHERE item.$identifier = '%s' and item.item_private = 0
$uids $site_firehose_sql $item_normal_update $simple_update
and (abook.abook_blocked = 0 or abook.abook_flags is null)
$sql_extra $net_query2",
diff --git a/Zotlabs/Module/Search.php b/Zotlabs/Module/Search.php
index 6b1060570..335dcc6e7 100644
--- a/Zotlabs/Module/Search.php
+++ b/Zotlabs/Module/Search.php
@@ -75,13 +75,13 @@ class Search extends Controller {
if ($f) {
$mid = $f[0]['message_id'];
foreach ($f as $m) {
- if (str_starts_with($url, $m['message_id'])) {
+ if (basename($url) === $m['message_id']) {
$mid = $m['message_id'];
break;
}
}
- goaway(z_root() . '/hq/' . gen_link_id($mid));
+ goaway(z_root() . '/hq/' . $mid);
}
else {
// try other fetch providers (e.g. diaspora, pubcrawl)
diff --git a/Zotlabs/Module/Sse_bs.php b/Zotlabs/Module/Sse_bs.php
index f335a9ada..1f56d8033 100644
--- a/Zotlabs/Module/Sse_bs.php
+++ b/Zotlabs/Module/Sse_bs.php
@@ -153,7 +153,7 @@ class Sse_bs extends Controller {
call_hooks('update_unseen',$x);
if($x['update'] === 'unset' || intval($x['update'])) {
- q("UPDATE item SET item_unseen = 0 WHERE uid = %d AND mid in (%s) AND item_unseen = 1",
+ q("UPDATE item SET item_unseen = 0 WHERE uid = %d AND uuid in (%s) AND item_unseen = 1",
intval(self::$uid),
$str // this is dbesc() in the above foreach loop
);
@@ -454,7 +454,7 @@ class Sse_bs extends Controller {
$sql_extra3 = '';
$sse_mids_all = unserialise($_SESSION['sse_mids_all']) ?? [];
if ($sse_mids_all) {
- $sql_extra3 = " AND mid NOT IN (" . protect_sprintf(implode(',', $sse_mids_all)) . ") ";
+ $sql_extra3 = " AND uuid NOT IN (" . protect_sprintf(implode(',', $sse_mids_all)) . ") ";
}
$uids = " AND uid IN ( " . $sys['channel_id'] . " ) ";
diff --git a/Zotlabs/Module/Subthread.php b/Zotlabs/Module/Subthread.php
index a796d85cb..e8181dde3 100644
--- a/Zotlabs/Module/Subthread.php
+++ b/Zotlabs/Module/Subthread.php
@@ -106,9 +106,6 @@ class Subthread extends \Zotlabs\Web\Controller {
else
killme();
-
-
-
$uuid = item_message_id();
$mid = z_root() . '/item/' . $uuid;
@@ -149,7 +146,7 @@ class Subthread extends \Zotlabs\Web\Controller {
$ulink = '[zrl=' . $item_author['xchan_url'] . ']' . $item_author['xchan_name'] . '[/zrl]';
$alink = '[zrl=' . $observer['xchan_url'] . ']' . $observer['xchan_name'] . '[/zrl]';
- $plink = '[zrl=' . z_root() . '/display/' . gen_link_id($item['mid']) . ']' . $post_type . '[/zrl]';
+ $plink = '[zrl=' . z_root() . '/display/' . $item['uuid'] . ']' . $post_type . '[/zrl]';
$arr['body'] = sprintf( $bodyverb, $alink, $ulink, $plink );
diff --git a/Zotlabs/Module/Tagger.php b/Zotlabs/Module/Tagger.php
index 4aaae5885..ebe28c444 100644
--- a/Zotlabs/Module/Tagger.php
+++ b/Zotlabs/Module/Tagger.php
@@ -86,7 +86,7 @@ class Tagger extends \Zotlabs\Web\Controller {
$clean_term = trim($term,'"\' ');
$links = array(array('rel' => 'alternate','type' => 'text/html',
- 'href' => z_root() . '/display/' . gen_link_id($item['mid'])));
+ 'href' => z_root() . '/display/' . $item['uuid']));
$target = json_encode(array(
'type' => $targettype,
diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php
index b56fc86f9..1d8a3b1da 100644
--- a/Zotlabs/Widget/Messages.php
+++ b/Zotlabs/Widget/Messages.php
@@ -187,7 +187,8 @@ class Messages {
$entries[$i]['info'] = $info;
$entries[$i]['created'] = datetime_convert('UTC', date_default_timezone_get(), $item['created']);
$entries[$i]['summary'] = $summary;
- $entries[$i]['b64mid'] = gen_link_id($item['mid']);
+ //$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]['icon'] = $icon;
$entries[$i]['unseen_count'] = (($item['unseen_count']) ? $item['unseen_count'] : (($item['item_unseen']) ? '&#8192;' : ''));
diff --git a/Zotlabs/Widget/Pinned.php b/Zotlabs/Widget/Pinned.php
index bd1c0e462..764b19e38 100644
--- a/Zotlabs/Widget/Pinned.php
+++ b/Zotlabs/Widget/Pinned.php
@@ -46,7 +46,7 @@ class Pinned {
foreach($items as $item) {
- $midb64 = gen_link_id($item['mid']);
+ $midb64 = $item['uuid'];
if(isset($observer['xchan_hash']) && in_array($observer['xchan_hash'], get_pconfig($item['uid'], 'pinned_hide', $midb64, [])))
continue;
diff --git a/boot.php b/boot.php
index 92583aec0..d80f9bd1c 100644
--- a/boot.php
+++ b/boot.php
@@ -62,7 +62,7 @@ require_once('include/conversation.php');
require_once('include/acl_selectors.php');
define('PLATFORM_NAME', 'hubzilla');
-define('STD_VERSION', '8.9.5');
+define('STD_VERSION', '8.9.6');
define('ZOT_REVISION', '6.0');
define('DB_UPDATE_VERSION', 1262);
diff --git a/include/conversation.php b/include/conversation.php
index c7057b09d..9683e02f0 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -789,16 +789,14 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
if(strcmp(datetime_convert('UTC','UTC',$item['created']),datetime_convert('UTC','UTC','now - 12 hours')) > 0)
$is_new = true;
- $conv_link_mid = (($mode == 'moderate') ? gen_link_id($item['parent_mid']) : gen_link_id($item['mid']));
-
- $conv_link = z_root() . '/display/' . $conv_link_mid;
+ $conv_link = z_root() . '/display/' . $item['uuid'];
if(local_channel()) {
- $conv_link = z_root() . '/hq/' . $conv_link_mid;
+ $conv_link = z_root() . '/hq/' . $item['uuid'];
}
if ($mode === 'pubstream-new') {
- $conv_link = z_root() . '/pubstream?mid=' . $conv_link_mid;
+ $conv_link = z_root() . '/pubstream?mid=' . $item['uuid'];
}
$contact = [];
@@ -816,8 +814,8 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
'delete' => t('Delete'),
'preview_lbl' => $preview_lbl,
'id' => (($preview) ? 'P0' : $item['item_id']),
- 'mid' => gen_link_id($item['mid']),
- 'mids' => json_encode([gen_link_id($item['mid'])]),
+ 'mid' => $item['uuid'],
+ 'mids' => json_encode([$item['uuid']]),
'linktitle' => sprintf( t('View %s\'s profile @ %s'), $profile_name, $profile_link),
'author_id' => (($item['author']['xchan_addr']) ? $item['author']['xchan_addr'] : $item['author']['xchan_url']),
'profile_url' => $profile_link,
@@ -918,6 +916,8 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
continue;
}
+ $mid_uuid_map[$item['mid']] = $item['uuid'];
+
$item['pagedrop'] = $page_dropping;
if($item['id'] == $item['parent'] || $r_preview) {
@@ -936,7 +936,7 @@ function conversation($items, $mode, $update, $page_mode = 'traditional', $prepa
}
}
- $threads = $conv->get_template_data($conv_responses);
+ $threads = $conv->get_template_data($conv_responses, $mid_uuid_map);
if(!$threads) {
logger('[ERROR] conversation : Failed to get template data.', LOGGER_DEBUG);
$threads = array();
@@ -1246,7 +1246,7 @@ function builtin_activity_puller($item, &$conv_responses) {
if(! $item['thr_parent'])
$item['thr_parent'] = $item['parent_mid'];
- $conv_responses[$mode]['mids'][$item['thr_parent']][] = gen_link_id($item['mid']);
+ $conv_responses[$mode]['mids'][$item['thr_parent']][] = $item['uuid'];
if($item['obj_type'] === 'Answer')
continue;
diff --git a/include/event.php b/include/event.php
index da504c2d7..bb24030cf 100644
--- a/include/event.php
+++ b/include/event.php
@@ -1417,7 +1417,7 @@ function event_store_item($arr, $event) {
if($wall)
$item_arr['plink'] = $item_arr['mid'];
else
- $item_arr['plink'] = z_root() . '/display/' . gen_link_id($item_arr['mid']);
+ $item_arr['plink'] = z_root() . '/display/' . $item_arr['uuid'];
set_iconfig($item_arr, 'event','timezone',$arr['timezone'],true);
diff --git a/include/items.php b/include/items.php
index 56534c4e4..f30a986bb 100644
--- a/include/items.php
+++ b/include/items.php
@@ -1775,13 +1775,18 @@ function item_store($arr, $allow_exec = false, $deliver = true) {
$d1 = new DateTime('now +10 minutes', new DateTimeZone('UTC'));
$d2 = new DateTime($arr['created'] . '+00:00');
- if($d2 > $d1)
+
+ if($d2 > $d1) {
$arr['item_delayed'] = 1;
+ }
- $arr['llink'] = z_root() . '/display/' . gen_link_id($arr['mid']);
+ if(empty($arr['llink'])) {
+ $arr['llink'] = z_root() . '/display/' . $arr['uuid'];
+ }
- if(! $arr['plink'])
+ if(empty($arr['plink'])) {
$arr['plink'] = $arr['llink'];
+ }
if($arr['parent_mid'] === $arr['mid']) {
$parent_id = 0;
@@ -2501,7 +2506,7 @@ function send_status_notifications($post_id,$item) {
if($unfollowed)
return;
- $link = z_root() . '/display/' . gen_link_id($item['mid']);
+ $link = z_root() . '/display/' . $item['uuid'];
$y = q("select id from notify where link = '%s' and uid = %d limit 1",
dbesc($link),
@@ -3174,7 +3179,7 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $group = false
$item['mid'] = z_root() . '/item/' . $item['uuid'];
$item['parent_mid'] = $item['mid'];
$item['thr_parent'] = $item['mid'];
- $item['llink'] = z_root() . '/display/' . gen_link_id($item['mid']);
+ $item['llink'] = z_root() . '/display/' . $item['uuid'];
}
$r = q("UPDATE item SET author_xchan = '%s', mid = '%s', parent_mid = '%s', thr_parent = '%s', llink = '%s' WHERE id = %d",
diff --git a/view/js/main.js b/view/js/main.js
index 127b41197..ba863b111 100644
--- a/view/js/main.js
+++ b/view/js/main.js
@@ -825,12 +825,12 @@ function scrollToItem() {
if(justifiedGalleryActive)
return;
- var submid = ((bParam_mid.length) ? bParam_mid : 'abcdefg');
- var encoded = ((submid.substr(0,4) == 'b64.') ? true : false);
- var submid_encoded = ((encoded) ? submid : window.btoa(submid));
+ let submid = ((bParam_mid.length) ? bParam_mid : 'abcdefg');
+ //var encoded = ((submid.substr(0,4) == 'b64.') ? true : false);
+ //var submid_encoded = ((encoded) ? submid : window.btoa(submid));
$('.thread-wrapper').filter(function() {
- if($(this).data('b64mids').indexOf(submid_encoded) > -1 && !$(this).hasClass('toplevel_item')) {
+ if($(this).data('b64mids').indexOf(submid) > -1 && !$(this).hasClass('toplevel_item')) {
if($('.collapsed-comments').length) {
var scrolltoid = $('.collapsed-comments').attr('id').substring(19);
$('#collapsed-comments-' + scrolltoid + ' .autotime').timeago();
diff --git a/view/tpl/conv_item.tpl b/view/tpl/conv_item.tpl
index 4194bc4da..25b60c473 100644
--- a/view/tpl/conv_item.tpl
+++ b/view/tpl/conv_item.tpl
@@ -45,8 +45,8 @@
{{/if}}
<small class="autotime" title="{{$item.isotime}}"><time class="dt-published" datetime="{{$item.isotime}}">{{$item.localtime}}</time>{{if $item.editedtime}}&nbsp;{{$item.editedtime}}{{/if}}{{if $item.expiretime}}&nbsp;{{$item.expiretime}}{{/if}}</small>
</div>
- {{if $item.thr_parent}}
- <a href="javascript:doscroll('{{$item.thr_parent}}',{{$item.parent}});" class="ms-3" title="{{$item.top_hint}}"><i class="fa fa-angle-double-up"></i></a>
+ {{if $item.thr_parent_uuid}}
+ <a href="javascript:doscroll('{{$item.thr_parent_uuid}}',{{$item.parent}});" class="ms-3" title="{{$item.top_hint}}"><i class="fa fa-angle-double-up"></i></a>
{{/if}}
{{if $item.pinned}}
<div class="wall-item-pinned" title="{{$item.pinned}}" id="wall-item-pinned-{{$item.id}}"><i class="fa fa-thumb-tack"></i></div>