aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Daemon/Cache_embeds.php15
-rw-r--r--Zotlabs/Lib/ThreadItem.php6
-rw-r--r--Zotlabs/Lib/ThreadStream.php2
-rw-r--r--Zotlabs/Module/Pin.php5
-rw-r--r--Zotlabs/Widget/Messages.php2
-rw-r--r--Zotlabs/Widget/Pinned.php95
-rw-r--r--boot.php2
-rw-r--r--include/items.php20
-rw-r--r--view/tpl/pinned_item.tpl6
9 files changed, 48 insertions, 105 deletions
diff --git a/Zotlabs/Daemon/Cache_embeds.php b/Zotlabs/Daemon/Cache_embeds.php
index d5adfcc59..99b1c7ac0 100644
--- a/Zotlabs/Daemon/Cache_embeds.php
+++ b/Zotlabs/Daemon/Cache_embeds.php
@@ -6,23 +6,28 @@ class Cache_embeds {
static public function run($argc,$argv) {
- if(! $argc == 2)
+ if(!$argc == 2) {
return;
+ }
- $c = q("select body from item where id = %d ",
- dbesc(intval($argv[1]))
+ $c = q("select uid, aid, body, item_private from item where uuid = '%s'",
+ dbesc($argv[1])
);
- if(! $c)
+ if(!$c) {
return;
+ }
$item = $c[0];
// bbcode conversion by default processes embeds that aren't already cached.
// Ignore the returned html output.
-
bbcode($item['body']);
+ // photocache addon hook to prefetch one copy of public item images for the sys channel
+ call_hooks('cache_prefetch_hook', $item);
+
return;
}
+
}
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php
index 929792916..c3b01e6b1 100644
--- a/Zotlabs/Lib/ThreadItem.php
+++ b/Zotlabs/Lib/ThreadItem.php
@@ -54,6 +54,8 @@ class ThreadItem {
continue;
}
+ $this->mid_uuid_map[$item['mid']] = $item['uuid'];
+
$child = new ThreadItem($item);
$this->add_child($child);
}
@@ -98,6 +100,8 @@ class ThreadItem {
$conv = $this->get_conversation();
$observer = $conv->get_observer();
+ $conv->mid_uuid_map[$item['mid']] = $item['uuid'];
+
$acl = new AccessList([]);
$acl->set($item);
@@ -452,7 +456,7 @@ class ThreadItem {
'wait' => t('Please wait'),
'thread_level' => $thread_level,
'settings' => $settings,
- 'thr_parent_uuid' => ((isset($item['thr_parent_uuid']) && $item['thr_parent'] !== $item['parent_mid']) ? $item['thr_parent_uuid'] : ''),
+ 'thr_parent_uuid' => (($item['parent_mid'] != $item['thr_parent']) ? $conv->mid_uuid_map[$item['thr_parent']] : ''),
'contact_id' => (($contact) ? $contact['abook_id'] : ''),
'moderate' => ($item['item_blocked'] == ITEM_MODERATED),
'moderate_approve' => t('Approve'),
diff --git a/Zotlabs/Lib/ThreadStream.php b/Zotlabs/Lib/ThreadStream.php
index 4e11ba252..ee18d8de1 100644
--- a/Zotlabs/Lib/ThreadStream.php
+++ b/Zotlabs/Lib/ThreadStream.php
@@ -24,6 +24,8 @@ class ThreadStream {
private $prepared_item = '';
public $reload = '';
private $cipher = 'AES-128-CCM';
+ public $mid_uuid_map = [];
+
// $prepared_item is for use by alternate conversation structures such as photos
// wherein we've already prepared a top level item which doesn't look anything like
diff --git a/Zotlabs/Module/Pin.php b/Zotlabs/Module/Pin.php
index de3c75622..14a45c10d 100644
--- a/Zotlabs/Module/Pin.php
+++ b/Zotlabs/Module/Pin.php
@@ -29,8 +29,9 @@ class Pin extends \Zotlabs\Web\Controller {
if(! $observer)
http_status_exit(403, 'Forbidden');
- $r = q("SELECT * FROM item WHERE id = %d AND id = parent AND item_private = 0 LIMIT 1",
- $item_id
+ $r = q("SELECT * FROM item WHERE id = %d AND uid = %d AND id = parent AND item_private = 0 LIMIT 1",
+ intval($item_id),
+ intval(local_channel())
);
if(! $r) {
notice(t('Unable to locate original post.'));
diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php
index ef4a35ece..761679120 100644
--- a/Zotlabs/Widget/Messages.php
+++ b/Zotlabs/Widget/Messages.php
@@ -28,6 +28,8 @@ class Messages {
intval(TERM_FILE)
);
+ $file_tags = [];
+
if ($r) {
foreach($r as $rr) {
$file_tags[] = $rr['term'];
diff --git a/Zotlabs/Widget/Pinned.php b/Zotlabs/Widget/Pinned.php
index be6b98434..9daf396b8 100644
--- a/Zotlabs/Widget/Pinned.php
+++ b/Zotlabs/Widget/Pinned.php
@@ -67,19 +67,19 @@ class Pinned {
$attend = null;
$canvote = false;
- $conv_responses = [];
-
- if(in_array($item['obj_type'], ['Event', ACTIVITY_OBJ_EVENT])) {
- $conv_responses['attendyes'] = [ 'title' => t('Attending','title') ];
- $conv_responses['attendno'] = [ 'title' => t('Not attending','title') ];
- $conv_responses['attendmaybe'] = [ 'title' => t('Might attend','title') ];
- if($commentable && $observer) {
- $attend = [ t('I will attend'), t('I will not attend'), t('I might attend') ];
- $isevent = true;
- }
+ $response_verbs[] = 'like';
+
+ if(feature_enabled(\App::$profile['profile_uid'],'dislike')) {
+ $response_verbs[] = 'dislike';
+ }
+
+ $response_verbs[] = 'announce';
+
+ if ($item['obj_type'] === 'Question') {
+ $response_verbs[] = 'answer';
}
- $this->activity($item, $conv_responses);
+ $responses = get_responses($response_verbs, $item);
$verified = (intval($item['item_verified']) ? t('Message signature validated') : '');
$forged = ((! intval($item['item_verified']) && $item['sig']) ? t('Message signature incorrect') : '');
@@ -110,6 +110,9 @@ class Pinned {
'text' => strip_tags($body['html']),
'id' => $item['id'],
'mids' => json_encode([ $midb64 ]),
+ 'mid' => $item['uuid'],
+ 'rawmid' => $item['mid'],
+ 'parent' => $item['parent'],
'isevent' => $isevent,
'attend' => $attend,
'conlabels' => [],
@@ -151,7 +154,7 @@ class Pinned {
'hide' => (! $is_new && isset($observer['xchan_hash']) && $observer['xchan_hash'] != $owner['xchan_hash'] ? t("Don't show") : ''),
// end toolbar buttons
'modal_dismiss' => t('Close'),
- 'responses' => $conv_responses,
+ 'responses' => $responses,
'author_id' => (($author['xchan_addr']) ? $author['xchan_addr'] : $author['xchan_url'])
];
@@ -193,74 +196,14 @@ class Pinned {
if(empty($mids_list))
return [];
- $r = q("SELECT * FROM item WHERE uuid IN ( '%s' ) AND uid = %d AND id = parent AND item_private = 0 ORDER BY created DESC",
+
+ $r = q("SELECT parent FROM item WHERE uuid IN ( '%s' ) AND uid = %d AND id = parent AND item_private = 0",
dbesc(implode(",", $mids_list)),
intval($this->uid)
);
- if($r)
- return $r;
-
- return [];
- }
+ return items_by_parent_ids($r[0]['parent'], blog_mode: true);
- /*
- * @brief List activities on item
- *
- * @param array $item
- * @param array $conv_responses
- * @return array
- *
- */
- private function activity($item, &$conv_responses) {
-
- foreach(array_keys($conv_responses) as $verb) {
- $verb_sql = '';
-
- switch($verb) {
- case 'like':
- $verb_sql = " AND verb IN ('Like', '" . ACTIVITY_LIKE . "') ";
- break;
- case 'dislike':
- $verb_sql = " AND verb IN ('Dislike', '" . ACTIVITY_DISLIKE . "') ";
- break;
- case 'attendyes':
- $verb_sql = " AND verb IN ('Accept', '" . ACTIVITY_ATTEND . "') ";
- break;
- case 'attendno':
- $verb_sql = " AND verb IN ('Reject', '" . ACTIVITY_ATTENDNO . "') ";
- break;
- case 'attendmaybe':
- $verb_sql = " AND verb IN ('TentativeAccept', '" . ACTIVITY_ATTENDMAYBE . "') ";
- break;
- default:
- break;
- }
-
- $r = q("SELECT * FROM item WHERE parent = %d AND id <> parent $verb_sql AND item_deleted = 0",
- intval($item['id'])
- );
- if(! $r) {
- unset($conv_responses[$verb]);
- continue;
- }
-
- $conv_responses[$verb]['count'] = count($r);
- $conv_responses[$verb]['button'] = get_response_button_text($verb, $conv_responses[$verb]['count']);
-
- foreach($r as $rr) {
-
- $author = q("SELECT * FROM xchan WHERE xchan_hash = '%s' LIMIT 1",
- dbesc($rr['author_xchan'])
- );
- $name = (($author && $author[0]['xchan_name']) ? $author[0]['xchan_name'] : t('Unknown'));
- $conv_responses[$verb]['list'][] = (($rr['author_xchan'] && $author && $author[0]['xchan_photo_s']) ?
- '<a class="dropdown-item" href="' . chanlink_hash($rr['author_xchan']) . '">' . '<img class="menu-img-1" src="' . zid($author[0]['xchan_photo_s']) . '" alt="' . urlencode($name) . '" /> ' . $name . '</a>' :
- '<a class="dropdown-item" href="#" class="disabled">' . $name . '</a>'
- );
- }
- }
-
- $conv_responses['count'] = count($conv_responses);
}
+
}
diff --git a/boot.php b/boot.php
index 05926720a..e988ab85c 100644
--- a/boot.php
+++ b/boot.php
@@ -70,7 +70,7 @@ require_once('include/security.php');
define('PLATFORM_NAME', 'hubzilla');
-define('STD_VERSION', '10.3.29');
+define('STD_VERSION', '10.3.32');
define('ZOT_REVISION', '6.0');
define('DB_UPDATE_VERSION', 1263);
diff --git a/include/items.php b/include/items.php
index 06ee34476..edf87a7fd 100644
--- a/include/items.php
+++ b/include/items.php
@@ -2076,9 +2076,8 @@ function item_store($arr, $allow_exec = false, $deliver = true, $addAndSync = tr
item_update_parent_commented($arr);
-
- if(strpos($arr['body'],'[embed]') !== false) {
- Master::Summon([ 'Cache_embeds', $current_post ]);
+ if (str_contains($arr['body'], '[/embed]') || str_contains($arr['body'], '[/img]') || str_contains($arr['body'], '[/zmg]')) {
+ Master::Summon(['Cache_embeds', $arr['uuid']]);
}
$ret['success'] = true;
@@ -2422,8 +2421,8 @@ function item_store_update($arr, $allow_exec = false, $deliver = true, $addAndSy
*/
call_hooks('item_stored_update',$arr);
- if(strpos($arr['body'],'[embed]') !== false) {
- Master::Summon([ 'Cache_embeds', $orig_post_id ]);
+ if (str_contains($arr['body'], '[/embed]') || str_contains($arr['body'], '[/img]') || str_contains($arr['body'], '[/zmg]')) {
+ Master::Summon(['Cache_embeds', $arr['uuid']]);
}
$ret['success'] = true;
@@ -5461,15 +5460,6 @@ function items_by_parent_ids(string $ids, string $thr_parents = '', string $perm
$thr_parent_sql = " AND item.thr_parent IN (" . protect_sprintf($thr_parents) . ") ";
}
- $thr_parent_uuid_sql = '';
- $thr_parent_uuid_sql_join = '';
-
- if (!$thread_allow) {
- // this is required for navigation between replies if thread_allow is false
- $thr_parent_uuid_sql = "tp.uuid AS thr_parent_uuid,";
- $thr_parent_uuid_sql_join = "LEFT JOIN item tp ON item.thr_parent = tp.mid AND item.uid = tp.uid";
- }
-
$permission_sql_c = '';
if ($permission_sql) {
$permission_sql_c = str_replace('item.', 'c.', $permission_sql);
@@ -5477,7 +5467,6 @@ function items_by_parent_ids(string $ids, string $thr_parents = '', string $perm
$ret = q(
"SELECT item.*,
- $thr_parent_uuid_sql
$activity_sql
FROM item
LEFT JOIN item c
@@ -5486,7 +5475,6 @@ function items_by_parent_ids(string $ids, string $thr_parents = '', string $perm
AND c.thr_parent = item.mid
$item_normal_c
$permission_sql_c
- $thr_parent_uuid_sql_join
WHERE $blog_mode_sql in (%s)
AND (
item.verb NOT IN ('Like', 'Dislike', 'Announce')
diff --git a/view/tpl/pinned_item.tpl b/view/tpl/pinned_item.tpl
index 927b5ef80..b5b5c931e 100644
--- a/view/tpl/pinned_item.tpl
+++ b/view/tpl/pinned_item.tpl
@@ -100,13 +100,11 @@
</div>
{{/if}}
<div class="p-2 wall-item-tools d-flex justify-content-between">
- <div class="wall-item-tools-left hstack gap-1" id="wall-item-tools-left-{{$item.id}}">
+ <div class="wall-item-tools-left hstack gap-1" id="pinned-item-tools-left-{{$id}}">
{{foreach $responses as $verb=>$response}}
- {{if !($verb == 'comment' && (($toplevel && !$blog_mode) || $response.count == 0))}}
- <button type="button" title="{{$response.count}} {{$response.button.label}}" class="btn btn-sm btn-link{{if !$observer_activity.$verb}} link-secondary{{/if}} wall-item-{{$response.button.class}}" onclick="request({{$item.id}}, '{{$item.rawmid}}', '{{$verb}}', {{$item.parent}}, '{{$item.mid}}'); return false;" id="pinned-item-{{$verb}}-{{$id}}">
+ <button type="button" title="{{$response.count}} {{$response.button.label}}" class="btn btn-sm btn-link{{if !$observer_activity.$verb}} link-secondary{{/if}} wall-item-{{$response.button.class}}" onclick="request({{$id}}, '{{$rawmid}}', '{{$verb}}', {{$parent}}, '{{$mid}}'); return false;" id="pinned-item-{{$verb}}-{{$id}}">
<i class="bi bi-{{$response.button.icon}} generic-icons"></i>{{if $response.count}}<span style="display: inline-block; margin-top: -.25rem;" class="align-top">{{$response.count}}</span>{{/if}}
</button>
- {{/if}}
{{/foreach}}
<div class="">
<div id="like-rotator-{{$id}}" class="spinner-wrapper">