diff options
Diffstat (limited to 'Zotlabs/Widget')
-rw-r--r-- | Zotlabs/Widget/Channel_activities.php | 4 | ||||
-rw-r--r-- | Zotlabs/Widget/Messages.php | 29 | ||||
-rw-r--r-- | Zotlabs/Widget/Pinned.php | 10 |
3 files changed, 33 insertions, 10 deletions
diff --git a/Zotlabs/Widget/Channel_activities.php b/Zotlabs/Widget/Channel_activities.php index 06080f8c8..a799ea81e 100644 --- a/Zotlabs/Widget/Channel_activities.php +++ b/Zotlabs/Widget/Channel_activities.php @@ -179,7 +179,7 @@ class Channel_activities { $account = App::get_account(); - $r = q("SELECT channel_id, channel_name, xchan_photo_s FROM channel + $r = q("SELECT channel_id, channel_name, xchan_addr, xchan_photo_s FROM channel LEFT JOIN xchan ON channel_hash = xchan_hash WHERE channel_account_id = %d AND channel_id != %d AND channel_removed = 0", @@ -223,7 +223,7 @@ class Channel_activities { $i[] = [ 'url' => z_root() . '/manage/' . $rr['channel_id'], 'title' => '', - 'summary' => '<img src="' . $rr['xchan_photo_s'] . '" class="menu-img-2">' . $rr['channel_name'], + 'summary' => '<div class="text-truncate lh-sm"><img src="' . $rr['xchan_photo_s'] . '" class="menu-img-2">' . '<strong>' . $rr['channel_name'] . '</strong><br><small class="opacity-75">' . $rr['xchan_addr'] . '</small></div>', 'footer' => $footer ]; diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index 8c413e16e..0a8900c4f 100644 --- a/Zotlabs/Widget/Messages.php +++ b/Zotlabs/Widget/Messages.php @@ -35,7 +35,8 @@ class Messages { 'notice_messages_title' => t('Notices'), 'loading' => t('Loading'), 'empty' => t('No messages'), - 'unseen_count' => t('Unseen') + 'unseen_count' => t('Unseen'), + 'filter' => t('Filter by name or address') ] ]); @@ -47,7 +48,8 @@ class Messages { return; $offset = $options['offset'] ?? 0; - $type = $options['type'] ?? 'default'; + $type = $options['type'] ?? ''; + $author = $options['author'] ?? ''; if ($offset == -1) { return; @@ -63,10 +65,12 @@ class Messages { $entries = []; $limit = 30; $dummy_order_sql = ''; + $author_sql = ''; $loadtime = (($offset) ? $_SESSION['messages_loadtime'] : datetime_convert()); $vnotify = get_pconfig(local_channel(), 'system', 'vnotify', -1); - $vnotify_sql = ''; + $vnotify_sql_c = ''; + $vnotify_sql_i = ''; if (!($vnotify & VNOTIFY_LIKE)) { $vnotify_sql_c = " AND c.verb NOT IN ('" . dbesc(ACTIVITY_LIKE) . "', '" . dbesc(ACTIVITY_DISLIKE) . "') "; @@ -77,6 +81,10 @@ class Messages { $vnotify_sql_i = " AND i.verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') "; } + if($author) { + $author_sql = " AND i.owner_xchan = '" . protect_sprintf(dbesc($author)) . "' "; + } + switch($type) { case 'direct': $type_sql = ' AND i.item_private = 2 '; @@ -100,6 +108,7 @@ class Messages { AND i.created <= '%s' $type_sql AND i.item_thread_top = 1 + $author_sql $item_normal_i ORDER BY i.created DESC $dummy_order_sql LIMIT $limit OFFSET $offset", @@ -153,7 +162,7 @@ class Messages { $summary = '...'; } else { - $summary = substr_words($summary, 68); + $summary = substr_words($summary, 140); } switch(intval($item['item_private'])) { @@ -169,6 +178,7 @@ class Messages { $entries[$i]['author_name'] = $item['author']['xchan_name']; $entries[$i]['author_addr'] = (($item['author']['xchan_addr']) ? $item['author']['xchan_addr'] : $item['author']['xchan_url']); + $entries[$i]['author_img'] = $item['author']['xchan_photo_s']; $entries[$i]['info'] = $info; $entries[$i]['created'] = datetime_convert('UTC', date_default_timezone_get(), $item['created']); $entries[$i]['summary'] = $summary; @@ -240,6 +250,7 @@ class Messages { if (!local_channel()) return; + $limit = 30; $offset = 0; @@ -247,7 +258,14 @@ class Messages { $offset = intval($options['offset']); } - $notices = q("SELECT * FROM notify WHERE uid = %d + $author_url = $options['author'] ?? ''; + $author_sql = ''; + + if($author_url) { + $author_sql = " AND url = '" . protect_sprintf(dbesc($author_url)) . "' "; + } + + $notices = q("SELECT * FROM notify WHERE uid = %d $author_sql ORDER BY created DESC LIMIT $limit OFFSET $offset", intval(local_channel()) ); @@ -265,6 +283,7 @@ class Messages { $entries[$i]['author_name'] = $notice['xname']; $entries[$i]['author_addr'] = $notice['url']; + $entries[$i]['author_img'] = $notice['photo'];// $item['author']['xchan_photo_s']; $entries[$i]['info'] = ''; $entries[$i]['created'] = datetime_convert('UTC', date_default_timezone_get(), $notice['created']); $entries[$i]['summary'] = $summary; diff --git a/Zotlabs/Widget/Pinned.php b/Zotlabs/Widget/Pinned.php index 83036e98c..6d2618deb 100644 --- a/Zotlabs/Widget/Pinned.php +++ b/Zotlabs/Widget/Pinned.php @@ -42,6 +42,8 @@ class Pinned { $observer = \App::get_observer(); + xchan_query($items); + foreach($items as $item) { $midb64 = gen_link_id($item['mid']); @@ -49,8 +51,8 @@ class Pinned { if(isset($observer['xchan_hash']) && in_array($observer['xchan_hash'], get_pconfig($item['uid'], 'pinned_hide', $midb64, []))) continue; - $author = channelx_by_hash($item['author_xchan']); - $owner = channelx_by_hash($item['owner_xchan']); + $author = $item['author']; + $owner = $item['owner']; $profile_avatar = $author['xchan_photo_m']; $profile_link = chanlink_hash($item['author_xchan']); @@ -159,7 +161,9 @@ 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' => $conv_responses, + 'author_id' => (($author['xchan_addr']) ? $author['xchan_addr'] : $author['xchan_url']) + ]; $tpl = get_markup_template('pinned_item.tpl'); |