aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Like.php
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-01-14 14:28:35 +0000
committerMario <mario@mariovavti.com>2021-01-14 14:28:35 +0000
commit83f0c3d1ddcedc2324021f5f0d7a7e0b319da0d3 (patch)
tree6e1326e41b35eabda06972a8d4fff797e042d8b0 /Zotlabs/Module/Like.php
parente5a70744c0653c56bb432e6325f2de629e3f3b56 (diff)
downloadvolse-hubzilla-83f0c3d1ddcedc2324021f5f0d7a7e0b319da0d3.tar.gz
volse-hubzilla-83f0c3d1ddcedc2324021f5f0d7a7e0b319da0d3.tar.bz2
volse-hubzilla-83f0c3d1ddcedc2324021f5f0d7a7e0b319da0d3.zip
some work to fix r_preview in list mode
Diffstat (limited to 'Zotlabs/Module/Like.php')
-rw-r--r--Zotlabs/Module/Like.php63
1 files changed, 36 insertions, 27 deletions
diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php
index 358611b1b..f5f3515c0 100644
--- a/Zotlabs/Module/Like.php
+++ b/Zotlabs/Module/Like.php
@@ -41,41 +41,52 @@ class Like extends \Zotlabs\Web\Controller {
private function like_response($arr) {
- if($arr['conv_mode'] === 'channel') {
+ $page_mode = (($arr['item']['item_thread_top'] && $_REQUEST['page_mode']) ? $_REQUEST['page_mode'] : 'r_preview');
+ $conv_mode = (($_REQUEST['conv_mode']) ? $_REQUEST['conv_mode'] : 'network');
+
+ if($conv_mode === 'channel') {
$parts = explode('@', $arr['owner_xchan']['xchan_addr']);
profile_load($parts[0]);
}
-
$item_normal = item_normal();
- $activities = q("SELECT item.*, item.id AS item_id FROM item
- WHERE uid = %d $item_normal
- AND thr_parent = '%s'
- AND verb IN ('%s', '%s', '%s', '%s', '%s')",
- intval($arr['item']['uid']),
- dbesc($arr['item']['mid']),
- dbesc(ACTIVITY_LIKE),
- dbesc(ACTIVITY_DISLIKE),
- dbesc(ACTIVITY_ATTEND),
- dbesc(ACTIVITY_ATTENDNO),
- dbesc(ACTIVITY_ATTENDMAYBE)
- );
-
- xchan_query($activities,true);
-
- $convitems[] = $arr['item'];
- $convitems = array_merge($convitems, $activities);
+ if($page_mode === 'list') {
+ $items = q("SELECT item.*, item.id AS item_id FROM item
+ WHERE uid = %d $item_normal
+ AND parent = %d",
+ intval($arr['item']['uid']),
+ intval($arr['item']['parent'])
+ );
+ xchan_query($items,true);
+ $items = fetch_post_tags($items, true);
+ $items = conv_sort($items, 'commented');
+ }
+ else {
+ $activities = q("SELECT item.*, item.id AS item_id FROM item
+ WHERE uid = %d $item_normal
+ AND thr_parent = '%s'
+ AND verb IN ('%s', '%s', '%s', '%s', '%s')",
+ intval($arr['item']['uid']),
+ dbesc($arr['item']['mid']),
+ dbesc(ACTIVITY_LIKE),
+ dbesc(ACTIVITY_DISLIKE),
+ dbesc(ACTIVITY_ATTEND),
+ dbesc(ACTIVITY_ATTENDNO),
+ dbesc(ACTIVITY_ATTENDMAYBE)
+ );
+ xchan_query($activities,true);
+ $items = array_merge([$arr['item']], $activities);
+ $items = fetch_post_tags($items, true);
+ }
- $convitems = fetch_post_tags($convitems,true);
$ret = [
'success' => 1,
'orig_id' => $arr['orig_item_id'], //this is required for pubstream items where $item_id != $item['id']
'id' => $arr['item']['id'],
- 'html' => conversation($convitems, $arr['conv_mode'], true, 'r_preview'),
+ 'html' => conversation($items, $conv_mode, true, $page_mode),
];
-
return $ret;
}
@@ -102,7 +113,7 @@ class Like extends \Zotlabs\Web\Controller {
}
$verb = notags(trim($_GET['verb']));
- $mode = (($_GET['conv_mode'] === 'channel') ? 'channel' : 'network');
+ $mode = (($_GET['conv_mode']) ? $_GET['conv_mode'] : '');
if(! $verb)
$verb = 'like';
@@ -407,8 +418,7 @@ class Like extends \Zotlabs\Web\Controller {
$ret = self::like_response([
'item' => $item,
'orig_item_id' => $item_id,
- 'owner_xchan' => $thread_owner,
- 'conv_mode' => $mode
+ 'owner_xchan' => $thread_owner
]);
json_return_and_die($ret);
}
@@ -597,8 +607,7 @@ class Like extends \Zotlabs\Web\Controller {
$ret = self::like_response([
'item' => $item,
'orig_item_id' => $item_id,
- 'owner_xchan' => $thread_owner,
- 'conv_mode' => $mode
+ 'owner_xchan' => $thread_owner
]);
json_return_and_die($ret);