From f4495fd441a06c2ee58dd5073348627803d5ccb3 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 17 Oct 2024 09:03:32 +0000 Subject: fix tags rendering in the editor --- view/theme/redbasic/css/style.css | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 6e6e19532..12f5e1bad 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -1363,12 +1363,16 @@ dl.bb-dl > dd > li { } .bootstrap-tagsinput .tag:before { - /* Copied from fa-asterisk, is there a better way to do it? */ - font-family: ForkAwesome; - font-weight: normal; - font-style: normal; - text-decoration: inherit; - content:"\f069 "; + font-family: bootstrap-icons; + font-size: 0.5rem; + content: "\F151"; + margin-right: .25rem; +} + +.bootstrap-tagsinput .tag [data-role="remove"]:after { + font-family: bootstrap-icons; + font-size: 0.5rem; + content: "\F659"; } /* Modified original CSS to match input in Redbasic */ -- cgit v1.2.3 From 1411eafa9b5411df9cfbd8b563025a6665a0a7db Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 18 Oct 2024 19:06:35 +0000 Subject: fix edit button not clickable if below right aside --- view/tpl/page_display.tpl | 2 +- view/tpl/page_display_empty.tpl | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/view/tpl/page_display.tpl b/view/tpl/page_display.tpl index e8c9c0e27..2e87c68e3 100644 --- a/view/tpl/page_display.tpl +++ b/view/tpl/page_display.tpl @@ -10,7 +10,7 @@
{{$date}}
{{$body}}
{{if $edit_link}} -
+
{{/if}} diff --git a/view/tpl/page_display_empty.tpl b/view/tpl/page_display_empty.tpl index 44baec361..c24fe08e5 100644 --- a/view/tpl/page_display_empty.tpl +++ b/view/tpl/page_display_empty.tpl @@ -1,6 +1,6 @@ {{$body}} {{if $edit_link}}
- +
{{/if}} -- cgit v1.2.3 From 92ce66e7667cdaa5a4142af5d491d65d0e26ee1a Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 18 Oct 2024 19:20:20 +0000 Subject: i guess a couple of weeks have passed by now --- boot.php | 7 ------- 1 file changed, 7 deletions(-) diff --git a/boot.php b/boot.php index 66dba84c3..8723874b9 100644 --- a/boot.php +++ b/boot.php @@ -1538,13 +1538,6 @@ function check_config() { App::set_baseurl(z_root()); - // Make sure each site has a system channel. This is now created on install - // so we just need to keep this around a couple of weeks until the hubs that - // already exist have one - $syschan_exists = get_sys_channel(); - if (!$syschan_exists) - create_sys_channel(); - new DB_Upgrade(DB_UPDATE_VERSION); plugins_sync(); -- cgit v1.2.3 From e649ba5b131e1a3f28b32e2271770a4a08c15b11 Mon Sep 17 00:00:00 2001 From: Mario Date: Fri, 18 Oct 2024 19:32:41 +0000 Subject: remove attach_upgrade() after 7 years it should not be required anymore --- Zotlabs/Daemon/Cron.php | 3 --- include/attach.php | 35 ----------------------------------- 2 files changed, 38 deletions(-) diff --git a/Zotlabs/Daemon/Cron.php b/Zotlabs/Daemon/Cron.php index d2c863572..3f5ce28eb 100644 --- a/Zotlabs/Daemon/Cron.php +++ b/Zotlabs/Daemon/Cron.php @@ -178,9 +178,6 @@ class Cron { } } - require_once('include/attach.php'); - attach_upgrade(); - // once daily run birthday_updates and then expire in background // FIXME: add birthday updates, both locally and for xprof for use diff --git a/include/attach.php b/include/attach.php index 654c9990d..2ee3401f6 100644 --- a/include/attach.php +++ b/include/attach.php @@ -2933,41 +2933,6 @@ function attach_syspaths($channel_id,$attach_hash) { return [ 'os_path' => $os_path, 'path' => $path ]; } -/** - * in earlier releases we did not fill in os_path and display_path in the attach DB structure. - * (It was not needed or used). Going forward we intend to make use of these fields. - * A cron task checks for empty values (as older attachments may have arrived at our site - * in a clone operation) and executes attach_syspaths() to generate these field values and correct - * the attach table entry. The operation is limited to 100 DB entries at a time so as not to - * overload the system in any cron run. Eventually it will catch up with old attach structures - * and switch into maintenance mode to correct any that might arrive in clone packets from older - * sites. - */ - - - -function attach_upgrade() { - $r = q("SELECT id, uid, hash FROM attach WHERE os_path = '' OR display_path = '' LIMIT 100"); - if($r) { - foreach($r as $rv) { - $x = attach_syspaths($rv['uid'],$rv['hash']); - if($x) { - q("update attach set os_path = '%s', display_path = '%s' where id = %d", - dbesc($x['os_path']), - dbesc($x['path']), - intval($rv['id']) - ); - q("update photo set os_path = '%s', display_path = '%s' where uid = %d and resource_id = '%s'", - dbesc($x['os_path']), - dbesc($x['path']), - intval($rv['uid']), - dbesc($rv['hash']) - ); - } - } - } -} - /** * Chunked uploader for integration with the blueimp jquery-uploader -- cgit v1.2.3 From 4d1be3aea583c26c6e24e88b464d5a366a4d2ef3 Mon Sep 17 00:00:00 2001 From: Mario Date: Sat, 19 Oct 2024 18:49:47 +0000 Subject: bring filed items to mod hq --- Zotlabs/Module/Hq.php | 1 + Zotlabs/Widget/Messages.php | 61 ++++++++++++++++++++++++++++++++++++-------- include/features.php | 10 +++++++- view/js/main.js | 2 +- view/tpl/messages_widget.tpl | 55 +++++++++++++++++++++++++++++++++++---- 5 files changed, 111 insertions(+), 18 deletions(-) diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index c8e6efe38..51caa179c 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -230,6 +230,7 @@ class Hq extends \Zotlabs\Web\Controller { $options['offset'] = $_REQUEST['offset'] ?? 0; $options['type'] = $_REQUEST['type'] ?? ''; $options['author'] = ((isset($_REQUEST['author'])) ? urldecode($_REQUEST['author']) : ''); + $options['file'] = ((isset($_REQUEST['file'])) ? urldecode($_REQUEST['file']) : ''); $ret = Messages::get_messages_page($options); diff --git a/Zotlabs/Widget/Messages.php b/Zotlabs/Widget/Messages.php index 294a982b1..f90b4f99e 100644 --- a/Zotlabs/Widget/Messages.php +++ b/Zotlabs/Widget/Messages.php @@ -23,20 +23,35 @@ class Messages { $_SESSION['messages_loadtime'] = datetime_convert(); + $r = q("SELECT DISTINCT(term) FROM term WHERE uid = %d AND ttype = %d ORDER BY term", + intval(local_channel()), + intval(TERM_FILE) + ); + + if ($r) { + foreach($r as $rr) { + $file_tags[] = $rr['term']; + } + } + $tpl = get_markup_template('messages_widget.tpl'); $o = replace_macros($tpl, [ '$entries' => $page['entries'] ?? [], '$offset' => $page['offset'] ?? 0, '$feature_star' => feature_enabled(local_channel(), 'star_posts'), + '$feature_file' => feature_enabled(local_channel(), 'filing'), + '$file_tags' => $file_tags, '$strings' => [ 'messages_title' => t('Public and restricted messages'), 'direct_messages_title' => t('Direct messages'), 'starred_messages_title' => t('Starred messages'), + 'filed_messages_title' => t('Filed messages'), 'notice_messages_title' => t('Notices'), 'loading' => t('Loading'), 'empty' => t('No messages'), 'unseen_count' => t('Unseen'), - 'filter' => t('Filter by name or address') + 'filter' => t('Filter by name or address'), + 'file_filter' => t('Filter by file name') ] ]); @@ -50,6 +65,7 @@ class Messages { $offset = $options['offset'] ?? 0; $type = $options['type'] ?? ''; $author = $options['author'] ?? ''; + $file = $options['file'] ?? ''; if ($offset == -1) { return; @@ -67,8 +83,9 @@ class Messages { $item_normal_c = str_replace('item.', 'c.', $item_normal); $entries = []; $limit = 30; + $order_sql = 'i.created DESC'; $dummy_order_sql = ''; - $author_sql = ''; + $filter_sql = ''; $loadtime = (($offset) ? $_SESSION['messages_loadtime'] : datetime_convert()); $vnotify = get_pconfig(local_channel(), 'system', 'vnotify', -1); @@ -84,43 +101,55 @@ class Messages { $vnotify_sql_i = " AND i.verb NOT IN ('Dislike', '" . dbesc(ACTIVITY_DISLIKE) . "') "; } - if($author) { - $author_sql = " AND (i.owner_xchan = '" . protect_sprintf(dbesc($author)) . "') "; + if($type !== 'filed' && $author) { + $filter_sql = " AND (i.owner_xchan = '" . protect_sprintf(dbesc($author)) . "') "; + } + + if($type === 'filed' && $file) { + $filed_filter_sql = " AND (term.term = '" . protect_sprintf(dbesc($file)) . "') "; } switch($type) { case 'direct': - $type_sql = ' AND i.item_private = 2 '; + $type_sql = ' AND i.item_private = 2 AND i.item_thread_top = 1 '; // $dummy_order_sql has no other meaning but to trick // some mysql backends into using the right index. $dummy_order_sql = ', i.received DESC '; break; case 'starred': - $type_sql = ' AND i.item_starred = 1 '; + $type_sql = ' AND i.item_starred = 1 AND i.item_thread_top = 1 '; + break; + case 'filed': + $type_sql = ' AND i.id IN (SELECT term.oid FROM term WHERE term.ttype = ' . TERM_FILE . ' AND term.uid = i.uid ' . $filed_filter_sql . ')'; break; default: - $type_sql = ' AND i.item_private IN (0, 1) '; + $type_sql = ' AND i.item_private IN (0, 1) AND i.item_thread_top = 1 '; } $items = q("SELECT *, (SELECT count(*) FROM item c WHERE c.uid = %d AND c.parent = i.parent AND c.item_unseen = 1 AND c.item_thread_top = 0 $item_normal_c $vnotify_sql_c) AS unseen_count - FROM item i WHERE i.uid = %d + FROM item i + WHERE i.uid = %d AND i.created <= '%s' $type_sql - AND i.item_thread_top = 1 - $author_sql + $filter_sql $item_normal_i - ORDER BY i.created DESC $dummy_order_sql + ORDER BY $order_sql $dummy_order_sql LIMIT $limit OFFSET $offset", intval(local_channel()), intval(local_channel()), dbescdate($loadtime) ); + if ($type === 'filed') { + $items = fetch_post_tags($items); + } + xchan_query($items, false); $i = 0; $entries = []; + $ids = []; foreach($items as $item) { @@ -149,6 +178,16 @@ class Messages { $info .= t('via') . ' ' . $item['source']['xchan_name']; } + if ($type == 'filed') { + $info = ''; + foreach ($item['term'] as $t) { + if ($t['ttype'] !== TERM_FILE) { + continue; + } + $info .= ' ' . $t['term'] . ''; + } + } + $summary = $item['title']; if (!$summary) { $summary = $item['summary']; diff --git a/include/features.php b/include/features.php index d527f60e6..65ead6604 100644 --- a/include/features.php +++ b/include/features.php @@ -170,11 +170,19 @@ function get_features($filtered = true, $level = (-1)) { [ 'star_posts', t('Star Posts'), - t('Ability to mark special posts with a star indicator'), + t('Ability to mark conversations with a star'), false, Config::Get('feature_lock','star_posts'), ], + [ + 'filing', + t('File Posts'), + t('Ability to file posts'), + false, + Config::Get('feature_lock','filing'), + ], + [ 'reply_to', t('Reply on comment'), diff --git a/view/js/main.js b/view/js/main.js index f52720693..87025a1c8 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -212,7 +212,7 @@ $(document).ready(function() { prepareLiveUpdate(b64mid, notify_id); $('.message').removeClass('active'); $('[data-b64mid="' + b64mid + '"].message').addClass('active'); - $('[data-b64mid="' + b64mid + '"].message .badge').remove(); + $('[data-b64mid="' + b64mid + '"].message .unseen_count').remove(); } } } diff --git a/view/tpl/messages_widget.tpl b/view/tpl/messages_widget.tpl index 52a9b96f4..df91a05ef 100644 --- a/view/tpl/messages_widget.tpl +++ b/view/tpl/messages_widget.tpl @@ -16,6 +16,13 @@ {{/if}} + {{if $feature_file}} + + {{/if}}
+ {{if $feature_file}} +
+
+ + + {{foreach $file_tags as $opt=>$val}} + +
+
+ {{/if}} {{foreach $entries as $e}}
@@ -75,7 +94,7 @@
{{$e.info}} {{if $e.unseen_count}} - {{$e.unseen_count}} + {{$e.unseen_count}} {{/if}}
{{/foreach}} @@ -94,6 +113,7 @@ let author_hash; let author_url; let author; + let file; $(document).ready(function () { $('.messages-timeago').timeago(); @@ -109,6 +129,7 @@ $('#messages-container .message').remove(); $('#messages-author-container').addClass('active sticky-top'); $('#messages-author-input-clear').removeClass('d-none'); + author_hash = data.xid; author_url = data.url; author = messages_type === 'notification' ? author_url : author_hash; @@ -116,14 +137,27 @@ get_messages_page(); }); - $(document).on('click', '#messages-author-input-clear', function() { - $('#messages-author').val(''); + $("#messages-file").on('change', function(data) { + file = $("#messages-file").val(); + + $('#messages-container .message').remove(); + $('#messages-file-container').addClass('active sticky-top'); + $('#messages-file-input-clear').removeClass('d-none'); + + messages_offset = 0; + get_messages_page(); + }); + + $(document).on('click', '#messages-author-input-clear, #messages-file-input-clear', function() { + $('#messages-author, #messages-file').val(''); $("#messages-author").attr('placeholder', '{{$strings.filter}}'); + $("#messages-file").attr('placeholder', '{{$strings.file_filter}}'); $('#messages-author-container').removeClass('active sticky-top'); $('#messages-author-input-clear').addClass('d-none'); $('#messages-container .message').remove(); author = ''; + file = ''; author_hash = ''; author_url = ''; messages_offset = 0; @@ -145,6 +179,16 @@ messages_offset = 0; messages_type = $(this).data('messages_type'); author = messages_type === 'notification' ? author_url : author_hash; + + if (messages_type === 'filed') { + $('#messages-author-container').addClass('d-none'); + $('#messages-file-container').removeClass('d-none'); + } + else { + $('#messages-author-container').removeClass('d-none'); + $('#messages-file-container').addClass('d-none'); + } + $('#messages-container .message').remove(); get_messages_page(); }); @@ -167,7 +211,8 @@ data: { offset: messages_offset, type: messages_type, - author: author + author: author, + file: file } }).done(function(obj) { get_messages_page_active = false; @@ -185,7 +230,7 @@ e.author_addr, e.href, e.icon, - e.unseen_count ? '' + e.unseen_count + '' : '', + e.unseen_count ? '' + e.unseen_count + '' : '', e.author_img ); $('#messages-loading').before(html); -- cgit v1.2.3 From e0a91bed7a2b2b84a3385882952f198661c6ca98 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 23 Oct 2024 12:04:15 +0000 Subject: allow to file items from the public stream --- Zotlabs/Lib/ThreadItem.php | 2 +- Zotlabs/Module/Filer.php | 63 +++++++++++++++++++++++++++------------------- 2 files changed, 38 insertions(+), 27 deletions(-) diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php index 60a314da0..d21d85105 100644 --- a/Zotlabs/Lib/ThreadItem.php +++ b/Zotlabs/Lib/ThreadItem.php @@ -187,7 +187,7 @@ class ThreadItem { $drop = [ 'dropping' => true, 'delete' => t('Admin Delete') ]; } - $filer = ((($conv->get_profile_owner() == local_channel()) && (! array_key_exists('real_uid',$item))) ? t("Save to Folder") : false); + $filer = (((local_channel() && $conv->get_profile_owner() === local_channel()) || (local_channel() && App::$module === 'pubstream')) ? t("Save to Folder") : false); $profile_avatar = $item['author']['xchan_photo_s']; $profile_link = chanlink_hash($item['author_xchan']); diff --git a/Zotlabs/Module/Filer.php b/Zotlabs/Module/Filer.php index c2747e6c2..bf472eb67 100644 --- a/Zotlabs/Module/Filer.php +++ b/Zotlabs/Module/Filer.php @@ -1,43 +1,54 @@ 1) ? intval(\App::$argv[1]) : 0); - + + $term = unxmlify(trim($_GET['term'] ?? '')); + $item_id = ((App::$argc > 1) ? intval(App::$argv[1]) : 0); + logger('filer: tag ' . $term . ' item ' . $item_id); - + if($item_id && strlen($term)){ + + $sys = get_sys_channel(); + + $r = q("SELECT * FROM item WHERE (uid = %d OR uid = %d) AND id = %d + and item_type in (0,6,7) and item_deleted = 0 and item_unpublished = 0 + and item_delayed = 0 and item_pending_remove = 0 and item_blocked = 0 LIMIT 1", + intval(local_channel()), + intval($sys['channel_id']), + intval($item_id) + ); + + if ($r && $r[0]['uid'] === $sys['channel_id']) { + $r = [copy_of_pubitem(App::get_channel(), $r[0]['mid'])]; + } + + if(!$r) { + killme(); + } + + $item_id = $r[0]['id']; + // file item store_item_tag(local_channel(),$item_id,TERM_OBJ_POST,TERM_FILE,$term,''); - + // protect the entire conversation from periodic expiration - - $r = q("select parent from item where id = %d and uid = %d limit 1", - intval($item_id), + + q("update item set item_retained = 1, changed = '%s' where id = %d and uid = %d", + dbesc(datetime_convert()), + intval($r[0]['parent']), intval(local_channel()) ); - if($r) { - $x = q("update item set item_retained = 1, changed = '%s' where id = %d and uid = %d", - dbesc(datetime_convert()), - intval($r[0]['parent']), - intval(local_channel()) - ); - } - } + } else { $filetags = array(); $r = q("select distinct(term) from term where uid = %d and ttype = %d order by term asc", @@ -55,10 +66,10 @@ class Filer extends \Zotlabs\Web\Controller { '$title' => t('Save to Folder'), '$cancel' => t('Cancel') )); - + echo $o; } killme(); } - + } -- cgit v1.2.3 From e530476e6c5d2319f3a0a09dfe73ec181e923325 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 23 Oct 2024 12:06:32 +0000 Subject: make sure we select only sys channel items and remove dupes checking (this will be checked in item_store() anyway) --- include/items.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/include/items.php b/include/items.php index 876c20099..423d626ad 100644 --- a/include/items.php +++ b/include/items.php @@ -5112,25 +5112,19 @@ function copy_of_pubitem($channel,$mid) { return $item[0]; } - - $r = q("select * from item where parent_mid = (select parent_mid from item where mid = '%s' and uid = %d ) order by id ", + $r = q("select * from item where parent_mid = (select parent_mid from item where mid = '%s' and uid = %d) and uid = %d order by id ", dbesc($mid), + intval($syschan['channel_id']), intval($syschan['channel_id']) ); if($r) { $items = fetch_post_tags($r,true); foreach($items as $rv) { - $d = q("select id from item where mid = '%s' and uid = %d limit 1", - dbesc($rv['mid']), - intval($channel['channel_id']) - ); - if($d) { - continue; - } unset($rv['id']); unset($rv['parent']); + $rv['aid'] = $channel['channel_account_id']; $rv['uid'] = $channel['channel_id']; $rv['item_wall'] = 0; @@ -5143,5 +5137,6 @@ function copy_of_pubitem($channel,$mid) { } } + return $result; } -- cgit v1.2.3