diff options
author | Mario <mario@mariovavti.com> | 2023-02-09 01:52:48 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2023-02-09 01:52:48 +0000 |
commit | 09c9b47265b144c905a51434c40002d8aef526e5 (patch) | |
tree | ff006fb316e3aa49ab49a6ed067aac4aea152b63 /Zotlabs/Widget | |
parent | ea2b653b9bd831e835e19d4f5f1e560cee2f200e (diff) | |
download | volse-hubzilla-09c9b47265b144c905a51434c40002d8aef526e5.tar.gz volse-hubzilla-09c9b47265b144c905a51434c40002d8aef526e5.tar.bz2 volse-hubzilla-09c9b47265b144c905a51434c40002d8aef526e5.zip |
fix more hubloc confusion, implement hq widget author filter and some autocomplete fixes
Diffstat (limited to 'Zotlabs/Widget')
-rw-r--r-- | Zotlabs/Widget/Messages.php | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index edd15c2a5..418e49169 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,6 +65,7 @@ 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); @@ -78,6 +81,10 @@ class Messages { $vnotify_sql_i = " AND i.verb NOT IN ('" . dbesc(ACTIVITY_DISLIKE) . "') "; } + if($author) { + $author_sql = " AND i.author_xchan = '" . protect_sprintf(dbesc($author)) . "' "; + } + switch($type) { case 'direct': $type_sql = ' AND i.item_private = 2 '; @@ -101,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", @@ -241,6 +249,7 @@ class Messages { if (!local_channel()) return; + $limit = 30; $offset = 0; @@ -248,7 +257,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()) ); |