aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Lib
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2024-02-01 11:42:55 +0000
committerMario <mario@mariovavti.com>2024-02-01 11:42:55 +0000
commitdd204ec34f473d7e0b133d35b08f3c4dc8d3ffef (patch)
tree3d995b7602c48721cf486585e1f3e3aa4b81fb0c /Zotlabs/Lib
parentb3a5dd8aa8c8990e6139fc817f9c9f706d2e0976 (diff)
downloadvolse-hubzilla-dd204ec34f473d7e0b133d35b08f3c4dc8d3ffef.tar.gz
volse-hubzilla-dd204ec34f473d7e0b133d35b08f3c4dc8d3ffef.tar.bz2
volse-hubzilla-dd204ec34f473d7e0b133d35b08f3c4dc8d3ffef.zip
start using uuid for internal reference instead of base64 encoded mid
Diffstat (limited to 'Zotlabs/Lib')
-rw-r--r--Zotlabs/Lib/Enotify.php16
-rw-r--r--Zotlabs/Lib/ThreadItem.php19
-rw-r--r--Zotlabs/Lib/ThreadStream.php4
3 files changed, 21 insertions, 18 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);